Before you go, take 40% off annual plans

Leave your email and get 40% off any TurboWorkflow plan paid annually, for your first 2 years.

Applies to annual billing only. We only use your email to honour this discount.

Skip to content
TurboWorkflow
API reference

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 pathWhat it does
POST {base}/e/{token}Set the step's email (a variant) from a JSON body
POST {base}/e/{token}/uploadUpload an image for the body; answers its public URL
POST {base}/e/{token}/attachmentUpload a file and attach it to the step
GET {base}/e/{token}/imported-emailsThe step's imported-emails sheet: file, and how many contacts it covers
POST {base}/e/{token}/imported-emailsUpload a sheet of per-contact emails; replaces the step's sheet

Campaign

Method and pathWhat it does
POST {base}/ce/{token}Set the campaign's subject and/or HTML
POST {base}/ce/{token}/attachmentUpload a file and attach it to the campaign

Set a step's email — POST {base}/e/{token}

Send Content-Type: application/json.

FieldTypeValues
subjectstringThe subject. Merge tags work.
htmlstringThe HTML body. Merge tags work.
modestringtemplate (your HTML), prompt (AI writes it), imported (per-contact sheet)
typestringnew (new thread) or reply (reply in the previous email's thread)
subjectModestringstatic or prompt (AI writes the subject; prompt mode only)
subjectInstructionstringThe instruction for an AI subject
subjectOverridebooleanFor a reply, use subject instead of the thread's subject
promptobjectFor prompt mode: model, userPrompt, systemPrompt, contextFields (null = all fields, [] = none, or a list of field keys), fallback (fail or template)
importFallbackstringFor imported mode, what a contact missing from the sheet gets: hold, template or prompt
namestringThe variant's name, for example Test B
activebooleanWhether the variant is in the A/B rotation
variantIdstringWhich 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.

AnswerBody
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

  • POST a multipart file (.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. Answers 201: { "nodeId", "imported", "skipped", "skippedCount", "duplicates", "noSubject", "noSubjectCount", "status" }. noSubject lists sheet rows with a blank subject (they send with the Template subject).
  • GET answers { "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.

AnswerBody
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

StatusMeaning
400"Expected a 'file' field." or the file is empty
404Unknown address, or the step is gone
409(Campaigns) already launched
413The file, or the email's attachments together, are over the size cap
415That file type is not allowed

Worked example

Write a step's email, with an image, from a shell.

TerminalCode
URL="https://acme.zocton.com/turboworkflow/api/e/PASTE_THE_SECRET" # 1. Upload the image and keep its address IMG=$(curl -s -X POST "$URL/upload" -F "[email protected]" | sed 's/.*"url":"\([^"]*\)".*/\1/') # 2. Set the whole email: subject, body, mode and type curl -s -X POST "$URL" \ -H 'Content-Type: application/json' \ -d "{ \"subject\": \"Quick question, {{contact.firstName | there}}\", \"mode\": \"template\", \"type\": \"new\", \"html\": \"<p>Hi {{contact.firstName | there}},</p><p><img src='$IMG' alt=''></p><p>Worth a chat?</p>\" }" # → {"ok":true}

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.

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.

Last modified on