Messaging
For instructions on how to authenticate to use this endpoint, see API overview.
Endpoints
GET | |
POST | |
POST |
Retrieve messaging emails
Get the status of one transactional email by the message_id that the send returned, for 30 days after the send. Needs a project secret API key with the transactional_email:read scope. A key with hog_flow:read also works, but that scope reaches the rest of Workflows too. The first status is recorded a few seconds after the send, so a read right after a send can answer 404. Treat that 404 as queued and read again a few seconds later.
Required API key scopes
transactional_email:readPath parameters
- idstring
Response
Example request
GET /api /projects /:project_id /messaging /emails /:idExample response
Status 200
Status 401 The request has no project secret API key.
Status 404 No email of this project has this ID, or it is older than 30 days. In the first seconds after a send, it means the email is queued but its first status isn't recorded yet.
Create messaging preferences
Opt one recipient out of topics, or back in, in one call. all_marketing applies first, then each topic in order, and the whole change is saved at once. The same change twice ends the same, but a retry that lands after a newer change undoes that change. Workflows sends skip a marketing topic the recipient opted out of. Needs a project secret API key with the messaging_preference:write scope, which cannot send email. A key with hog_flow:write also works, but that scope can send transactional email too.
Required API key scopes
messaging_preference:writeRequest parameters
- identifierstring
- all_marketingboolean
- topicsobject
Response
Example request
POST /api /projects /:project_id /messaging /preferencesExample response
Status 200
Status 401 The request has no project secret API key.
Status 404 A topic key names no topic of this project, with the code `unknown_topic`. Nothing changed.
Create messaging send email
Send one transactional email to one recipient. Name a template made transactional in template_id, and message_data fills its {{ variables.* }} placeholders. Or send content your code rendered with a template_key, a subject and html or text: PostHog sends it as is, and its metrics and run history group under the key. Transactional emails skip opt-outs and frequency caps. Send an Idempotency-Key header to retry safely without sending the email twice. Needs the transactional_email:write scope. A key with hog_flow:write also works, but that scope reaches the rest of Workflows too.
Required API key scopes
transactional_email:writeRequest parameters
- tostring
- message_dataobject
- template_idstring
- template_keystring
- distinct_idstring | null
- subjectstring
- htmlstring
- textstring
- reply_toarray
- cc
- bcc
- attachmentsarray | null
- capture_engagementboolean
- fromstring
Response
Example request
POST /api /projects /:project_id /messaging /send /email




