Workflows API

Use the API to send email from any language, see what you sent, and manage templates, broadcasts, automations, and opt-outs from your own systems.

When to use the API

SurfaceUse it when
Server SDKsYour backend sends transactional email in Node.js, Python, Go, .NET, Rust, Ruby, Elixir, or PHP. The SDKs retry with idempotency keys for you.
APIYour language has no SDK, or you sync templates, broadcasts, automations, and opt-outs with your own systems.
MCPYou want your coding agent to build and change automations and broadcasts for you in plain language.
Web appYou build, test, and watch automations and broadcasts yourself.

To send your first email with curl, follow send transactional emails with the API.

Endpoints

There are two kinds of endpoint:

  • Sending endpoints run on your server with a project secret API key. They send email, upload attachments, read the status of a send, and update a person's opt-outs.
  • Project endpoints use a personal API key. They read your send history, and manage templates, broadcasts, automations, opt-outs, and the suppression list.

Sending endpointWhat it does
POST /api/messaging/send/email/Send one email.
POST /api/messaging/send/email_batch/Send one email to up to 100 recipients, each with their own copy.
POST /api/messaging/attachments/uploads/Get upload URLs for files to attach to an email.
GET /api/messaging/emails/:message_id/Get the status of one send, such as delivered or bounced.
POST /api/messaging/preferences/Update a person's opt-outs from your own preferences page.

API reference

Each reference page lists every endpoint and field.

ReferenceWhat it covers
Transactional emailSend email, upload attachments, and check the status of a send.
Email templatesManage the templates in the email library, and mark a template as transactional.
Email logsRead the sends of the last 30 days, with the timeline of each send.
BroadcastsManage broadcasts, schedules, and batch jobs. POST /api/projects/:project_id/hog_flows/user_blast_radius/ counts how many people a set of filters reaches, so you can check an audience before you send.
WorkflowsManage automations and their drafts, publish them, and read their runs.
Email subscriptionsManage opt-outs and message categories.
Suppression listAdd and remove addresses on the suppression list, one at a time or in bulk.

For rate limits, attachment sizes, and bulk request sizes, see API and SDK limits. For every other lookup page, see the Workflows reference.

Authentication

Send the key as a bearer token.

KeyEndpointsScopes
Project secret API keySending endpointstransactional_email:write to send and upload attachments, transactional_email:read to read the status of a send, and messaging_preference:write to update opt-outs
Personal API keyProject endpointshog_flow:read to read and hog_flow:write to make changes. The send history and the suppression list also need person:read, because they show recipients. Counts of what people did after an email also need query:read. Launching or scheduling a broadcast also needs person:read. Counting an audience with user_blast_radius also needs the read scope for the data its filters use, such as person:read, group:read, or query:read.

Keep a project secret API key on your server. Keep a hog_flow:write key as safe as a password: it can turn on automations that email real people.

Other surfaces

  • MCP – ask your agent to do the same things in plain language.
  • Web app – do the same things in PostHog.
  • PostHog API reference – every PostHog API, not only Workflows.

Still have questions?

Was this page useful?