Email ingest API
The email ingest API lets your own scripts, tools or AI agents write the email inside a workflow step or a campaign: the subject, the HTML body, images, attachments, and a sheet of prewritten per-contact emails. TurboWorkflow then does the sending, pacing and tracking.
It is for teams who write or generate emails outside TurboWorkflow — in a repository, a CMS or a pipeline — and want to push them in without copy and paste.
Where to find it
- A workflow email step: open the step → API URL. It shows three addresses — POST (set content), POST image and POST attachment — with copy buttons, and Regenerate.
- A campaign: open Design the email → API URL (shown once the campaign is saved as a draft) — POST (set content) and POST attachment.
Before you start
- A workflow with an email step, or a draft campaign.
- Anything that can make an HTTP request.
How it is authenticated
The secret in the address is the credential. There is no API key and no sign-in for these calls: anyone with the address can set that one email's content and upload files to it. Keep it like a password.
- Each email step has its own address; each campaign has one.
- Regenerate makes a new address at once; the old one stops working. There is no expiry otherwise.
- An unknown or regenerated address answers
404, so it gives nothing away. - Zocton API keys (
zk_…) are not used here. For the Zocton MCP, see MCP for AI assistants; for keys in general, see API keys.
Use the address exactly as the app shows it — it is on your own workspace address, for
example https://acme.zocton.com/turboworkflow/api/e/<secret>. Below, {base} is that
address up to and including /api.
Endpoints
Workflow email step
| Method and path | What it does |
|---|---|
POST {base}/e/{token} | Set the step's email (a variant) from a JSON body |
POST {base}/e/{token}/upload | Upload an image for the body; answers its public URL |
POST {base}/e/{token}/attachment | Upload a file and attach it to the step |
GET {base}/e/{token}/imported-emails | The step's imported-emails sheet: file, and how many contacts it covers |
POST {base}/e/{token}/imported-emails | Upload a sheet of per-contact emails; replaces the step's sheet |
Campaign
| Method and path | What it does |
|---|---|
POST {base}/ce/{token} | Set the campaign's subject and/or HTML |
POST {base}/ce/{token}/attachment | Upload a file and attach it to the campaign |
Set a step's email — POST {base}/e/{token}
Send Content-Type: application/json.
| Field | Type | Values |
|---|---|---|
subject | string | The subject. Merge tags work. |
html | string | The HTML body. Merge tags work. |
mode | string | template (your HTML), prompt (AI writes it), imported (per-contact sheet) |
type | string | new (new thread) or reply (reply in the previous email's thread) |
subjectMode | string | static or prompt (AI writes the subject; prompt mode only) |
subjectInstruction | string | The instruction for an AI subject |
subjectOverride | boolean | For a reply, use subject instead of the thread's subject |
prompt | object | For prompt mode: model, userPrompt, systemPrompt, contextFields (null = all fields, [] = none, or a list of field keys), fallback (fail or template) |
importFallback | string | For imported mode, what a contact missing from the sheet gets: hold, template or prompt |
name | string | The variant's name, for example Test B |
active | boolean | Whether the variant is in the A/B rotation |
variantId | string | Which A/B variant to write. Without it, the first. |
Send the whole email on every call. Each call sets the whole variant: a field you
leave out goes back to its default (an empty body, template mode, new type and so on).
An id in the body is ignored.
| Answer | Body |
|---|---|
200 | { "ok": true } |
400 | { "error": "Expected a JSON body." }, or the first validation problem |
404 | { "error": "Not found" } (unknown address), "Email step not found.", "Variant not found." |
Upload an image — POST {base}/e/{token}/upload
Multipart form with one field, file — PNG, JPG, GIF, WebP or SVG. Answers 201 with
{ "url": "…" }. It does not change the email: put the URL in the html you send next.
Attach a file — POST {base}/e/{token}/attachment and POST {base}/ce/{token}/attachment
Multipart form with one field, file — an image, document, video or audio file (see
Uploads). Answers 201 with the attachment:
{ "uploadId", "url", "filename", "size", "contentType", "key" }.
Imported emails — GET and POST {base}/e/{token}/imported-emails
POSTa multipartfile(.xlsx, .xls or .csv) with the headings Email Address, Subject, Preview and Email Body — the step's template from the app works best. It replaces the step's sheet. Answers201:{ "nodeId", "imported", "skipped", "skippedCount", "duplicates", "noSubject", "noSubjectCount", "status" }.noSubjectlists sheet rows with a blank subject (they send with the Template subject).GETanswers{ "imported": null }when nothing is imported, else{ "imported": { "fileName", "source", "importedAt", "match": { "audience", "imported", "matched", "missing", "extra" } } }.- Uploading does not switch the step to send them: also
POST {base}/e/{token}with"mode": "imported"(and the rest of the email — see above). - Refused with
400: no file, wrong type, too large, a missing or doubled heading, another step's or workflow's template, no usable rows. See Imported emails.
Set a campaign's email — POST {base}/ce/{token}
JSON with subject, html, or both. Other fields are ignored.
| Answer | Body |
|---|---|
200 | { "ok": true } |
400 | { "error": "Expected a JSON body." } or "Nothing to update — send subject and/or html." |
404 | { "error": "Not found" } |
409 | { "error": "This campaign has already been launched." } — content and attachments can only change while it is a draft |
Errors for file uploads
| Status | Meaning |
|---|---|
400 | "Expected a 'file' field." or the file is empty |
404 | Unknown address, or the step is gone |
409 | (Campaigns) already launched |
413 | The file, or the email's attachments together, are over the size cap |
415 | That file type is not allowed |
Worked example
Write a step's email, with an image, from a shell.
Code
Open the step: the subject and body are there, and the workflow's Activity records the change. Check it with Send a test mail before you start the workflow.
Good to know
- Writing an email does not start or change a workflow's run. On a started workflow, the new content goes to contacts who have not reached the step yet.
- Open and click tracking, UTM tags and the unsubscribe link are added at send time, not
by this API. Put
{{unsubscribe}}in your HTML to place the link yourself. - Copy HTML from your own source, not from a preview in the app: previews remove links.
- The app gets these addresses from its own routes (one per email step, one per campaign). Those need a signed-in TurboWorkflow session; they do not accept API keys.
- TurboWorkflow has no other public REST API. To read workflows or act on them from an AI assistant, use the Zocton MCP.
Related
FAQ
How is the email ingest API authenticated?
By the secret in the address itself — keep it like a password. Regenerate makes a new one at once.
Do I have to send the whole email each time?
Yes. Each call sets the whole variant; a field you leave out goes back to its default.
Does writing an email start the workflow?
No. It only sets the content; starting is done in the app or the MCP.