> AI agents: this is one page from PostHog's docs. Full index of Markdown docs for LLMs: https://posthog.com/llms.txt # Workflows API Canonical URL: https://posthog.com/docs/workflows/api ## On this page - [When to use the API](#when-to-use-the-api) - [Endpoints](#endpoints) - [API reference](#api-reference) - [Authentication](#authentication) - [Other surfaces](#other-surfaces) 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 | Surface | Use it when | | --- | --- | | [Server SDKs](https://posthog.com/docs/workflows/reference.md#server-sdks) | Your backend sends transactional email in Node.js, Python, Go, .NET, Rust, Ruby, Elixir, or PHP. The SDKs retry with idempotency keys for you. | | API | Your language has no SDK, or you sync templates, broadcasts, automations, and opt-outs with your own systems. | | [MCP](https://posthog.com/docs/workflows/mcp.md) | You want your coding agent to build and change automations and broadcasts for you in plain language. | | [Web app](https://posthog.com/docs/workflows/web-app.md) | You build, test, and watch automations and broadcasts yourself. | To send your first email with `curl`, follow [send transactional emails with the API](https://posthog.com/docs/workflows/installation/api.md). ## 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 endpoint | What 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. | Reference | What it covers | | --- | --- | | [Transactional email](https://posthog.com/docs/api/transactional-email.md) | Send email, upload attachments, and check the status of a send. | | [Email templates](https://posthog.com/docs/api/email-templates.md) | Manage the templates in the email library, and mark a template as transactional. | | [Email logs](https://posthog.com/docs/api/email-logs.md) | Read the sends of the last 30 days, with the timeline of each send. | | [Broadcasts](https://posthog.com/docs/api/broadcasts.md) | Manage 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. | | [Workflows](https://posthog.com/docs/api/workflows.md) | Manage automations and their drafts, publish them, and read their runs. | | [Email subscriptions](https://posthog.com/docs/api/email-subscriptions.md) | Manage opt-outs and message categories. | | [Suppression list](https://posthog.com/docs/api/email-subscriptions-2.md) | Add 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](https://posthog.com/docs/workflows/reference/limits.md#api-and-sdk-limits). For every other lookup page, see the [Workflows reference](https://posthog.com/docs/workflows/reference.md). ## Authentication Send the key as a bearer token. | Key | Endpoints | Scopes | | --- | --- | --- | | [Project secret API key](https://posthog.com/docs/api/project-secret-api-keys.md) | Sending endpoints | `transactional_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 key](https://posthog.com/docs/api/personal-api-keys.md) | Project endpoints | `hog_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](https://posthog.com/docs/workflows/mcp.md) – ask your agent to do the same things in plain language. - [Web app](https://posthog.com/docs/workflows/web-app.md) – do the same things in PostHog. - [PostHog API reference](https://posthog.com/docs/api.md) – every PostHog API, not only Workflows.