Endpoints
draft, accumulates versions as you iterate, and must be approved before a blast or flow can use it.
AI generation is asynchronous. Creating with a
prompt returns 202 Accepted with a generation_id, and you poll the generation endpoint to track progress. Only one generation can run per email at a time.Idempotency
POST /v1/emails accepts an optional Idempotency-Key header. Retrying with the same key replays the stored result instead of creating a duplicate email. If a request with the same key is still being processed, the API returns 409 Conflict with error_code: "idempotency_in_progress". The same header works on the editing endpoints.
Create an Email
Request Body
Include
prompt to queue an AI generation (202 Accepted). Without a prompt, the email is created immediately (201 Created) — seeded from an approved template when template_id is present, or as a blank draft scaffolded from your workspace branding.
Request Example
Response Example
202 Accepted
Create From a Template
Passtemplate_id to start from an approved email template instead of a prompt or a blank scaffold:
template_id is present:
- The template must exist in the same workspace and be approved
- The template’s HTML is copied into the new email
- The template’s
default_subject,default_preview_text,default_from_name,default_from_address, anddefault_reply_to_emailare inherited as the email’s sender headers
prompt return 201 Created with the email object.
Start From Your Own HTML
POST /v1/emails does not accept raw HTML directly. To start from your own code, create a blank draft (omit prompt and template_id), then replace its content with POST /v1/emails/{emailId}/save-code — up to 2 MB of HTML. Blasts can also create an inline email seeded from your own html when setting the blast’s email.
Poll a Generation
status moves through generating to completed or failed. Completed generations include the version they produced and paths to their content:
200 OK
error_code: "generation_failed" and an error_message instead.
Read Content
text/html content type — not JSON.
Common Errors
Next: Edit Emails
Iterate with AI, save your own HTML, and manage the plain-text alternative.