Newsletter flows API
A newsletter flow runs emails, waits and conditions for subscribers of one audience. Publish a draft before turning the flow on. A subscriber can run each flow once.
Last updated
Endpoints
Use newsletters:read for GET and newsletters:write for writes. Flow endpoints return 404 while flows are unavailable.
| Endpoint | Behavior |
|---|---|
GET /v1/newsletter-flows | List flows. Filter by audience_id. Returns { data }. |
POST /v1/newsletter-flows | Create an off flow. Send audience_id, name and optional template. Returns 201 with the flow detail. |
GET /v1/newsletter-flows/:id | Get the flow detail with current, draft and email_updated_at. |
PATCH /v1/newsletter-flows/:id | Set name or status (on or off). Returns the flow. |
DELETE /v1/newsletter-flows/:id | Delete the flow and stop its active runs. Returns 204. |
PUT /v1/newsletter-flows/:id/draft | Replace the draft graph at revision. Returns the updated draft version. |
POST /v1/newsletter-flows/:id/publish | Publish revision with email_updated_at and optional move_runs. Returns { version, moved_runs }. |
POST /v1/newsletter-flows/:id/resume | Clear the health pause. Returns the flow. |
POST /v1/newsletter-flows/:id/emails | Create a flow email. Returns 201 with { newsletter_id, updated_at }. |
PATCH /v1/newsletter-flows/:id/emails/:newsletterId | Edit a flow email. Returns { newsletter_id, updated_at }. |
GET /v1/newsletter-flows/:id/stats | Get { version_id, events, active }. Set version_id to select a published version for the event counts. Defaults to the current version. |
GET /v1/newsletter-flows/:id/runs | List runs as { data }. Filter by state and subscriber_id. limit defaults to 50 and accepts 1 to 100. |
POST /v1/newsletter-flows/:id/runs | Start runs for 1 to 100 subscriber_ids. Returns { data } with one result per input. |
DELETE /v1/newsletter-flows/:id/runs/:runId | Stop a run. Returns 204. |
Templates are empty (the default), welcome_series and lead_magnet. Templates with emails require a configured newsletter sender.
Build the draft graph
Create a flow email before adding its ID to an email step. Supply content_markdown or blocks. Email writes also accept subject, preview_text, sender_identity_id, track_engagement, add_utm_tags and styling_mode.
{
"revision": 1,
"graph": {
"trigger": {
"kind": "api"
},
"first": "stp_000000000001",
"steps": {
"stp_000000000001": {
"kind": "wait",
"minutes": 60,
"next": "stp_000000000002"
},
"stp_000000000002": {
"kind": "email",
"newsletterId": "nws_123",
"next": null
}
}
}
}- Trigger kinds are
subscribed,apiandlink_clicked. A click trigger takesnewsletterId(nullable) andhrefwithmatch(exact or prefix) andvalue. - A condition step has
yes,noandthenlinks. Itsconditioncan check an email above it for a click or open, check membership in a segment, or evaluate one segment rule. After a join, the emails above include those of both paths. A click or open condition whosestepIdisnullcounts any email of the flow, including emails since removed from it. - A path whose last link is
nullcontinues at thethenstep of the nearest condition around it, or of the next one out when that isnull. At the top level, the run finishes. An{"kind":"exit"}step ends the run on its path, whateverthensays. - A wait takes
from:arrival(the default) counts from when the reader reaches it, andlast_emailfrom the reader's last email of this flow, or from the start of the run before any email. When that time has passed, the reader goes on at once. - The graph can contain up to 100 steps and 50 emails, each email once. Every step must be reached from
firstat exactly one place, throughnext,yes,noandthen, so paths cannot cycle and athenstep cannot also sit on one of its condition's paths.
The OpenAPI specification lists every field and graph variant.
Publish and turn on
Send the current draft.revision and the flow detail's email_updated_at map to publish. Both draft writes and publish can return 409 draft_changed. Reload the flow and reapply your changes to the new draft.
Active runs keep their version by default. With move_runs: true, publication moves eligible runs whose path to the current step is unchanged. If legacy readers still await conversion, moving runs returns 409 conversion_in_progress. Wait for conversion or publish without moving runs. Set status to on to enable the flow.
Manage runs
Manual starts require a published flow that is on. Each result contains subscriber_id and status, in the order you supplied the subscribers.
startedThe run started.already_ranThe subscriber already has a run for this flow.not_eligibleThe subscriber cannot receive this marketing email.not_foundThe subscriber ID does not belong to the flow's audience.refused_by_keyThe API key cannot email this subscriber.
Audience-restricted keys can see and change flows only for allowed audiences. Recipient restrictions apply to each start and stop. Flow-wide changes that affect delivery require a key that can manage the audience's newsletter sending. Run events are available through the webhooks API.