curl --request POST \
--url https://brew.new/api/v1/emails/import \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"format": "html",
"title": "Spring sale",
"content": "<html><body><h1>Spring sale</h1><p>20% off everything.</p><img src=\"https://example.com/banner.png\" alt=\"banner\"></body></html>"
}
'{
"emailId": "2SmZOWV3ZQ7W5x6g3m4pA",
"emailVersionId": "8g3m4pA2SmZOWV3ZQ7W5x",
"html": "<!DOCTYPE html><html><body>Welcome to Brew.</body></html>",
"previewImage": "https://storage.example.com/emails/2SmZOWV3ZQ7W5x6g3m4pA.png",
"assetReport": {
"discovered": 1,
"rehosted": 1,
"retained": 0,
"stripped": 0,
"warnings": []
},
"group": null
}Import an email
Converts existing markup into a new, fully editable Brew design. Source structure is preserved and every discoverable safe public resource is rehosted; when rehosting fails a validated public URL is kept with a warning, and private, malformed and blocked references are stripped. Free: a deterministic compiler with no model and no credits.
Use when you already have HTML, MJML, React Email JSX or a saved .eml message. To author from a brief use generateEmail; for a Figma frame use importFigmaDesign.
Input content (the raw source as a string) and format: html (a document or fragment), mjml, jsx (a module with a default-exported component or a bare <Html> element; static values, PreviewProps and local sub-components fold, anything executable is rejected with the offending line) or eml (the HTML body is imported, inline cid: images are rehosted, other attachments are dropped, and the Subject becomes the title). HTML, MJML and EML land as source-preserved designs with an editable projection; JSX lands as a native React Email design. Optional baseUrl resolves relative image paths; optional title and subjectLine (the design-default inbox subject; an EML Subject is the default); optional groupId (grp_… or ungrouped) or groupName (resolve or create), not both; omit to land Ungrouped. Limits: 5,000,000 UTF-8 bytes, 256 remote resources, 8 concurrent fetches, 10 MB per resource and 50 MB aggregate downloads.
Returns 201 { emailId, emailVersionId, html, previewImage?, assetReport, group, subjectLine? }.
Errors 422 EMAIL_IMPORT_FAILED when the markup cannot become an editable design (a lossy round trip persists nothing); 404 EMAIL_GROUP_NOT_FOUND for an unknown groupId; 413 PAYLOAD_TOO_LARGE over the byte cap; 422 BRAND_NOT_READY while the brand is still extracting.
See also generateEmail, importFigmaDesign, auditEmail.
curl --request POST \
--url https://brew.new/api/v1/emails/import \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"format": "html",
"title": "Spring sale",
"content": "<html><body><h1>Spring sale</h1><p>20% off everything.</p><img src=\"https://example.com/banner.png\" alt=\"banner\"></body></html>"
}
'{
"emailId": "2SmZOWV3ZQ7W5x6g3m4pA",
"emailVersionId": "8g3m4pA2SmZOWV3ZQ7W5x",
"html": "<!DOCTYPE html><html><body>Welcome to Brew.</body></html>",
"previewImage": "https://storage.example.com/emails/2SmZOWV3ZQ7W5x6g3m4pA.png",
"assetReport": {
"discovered": 1,
"rehosted": 1,
"retained": 0,
"stripped": 0,
"warnings": []
},
"group": null
}Authorizations
Send your Brew API key as Authorization: Bearer brew_xxx.
Headers
Optional idempotency key for safe retries. Reusing the same key with the same request body returns the original response for 24 hours.
1 - 100The brand this request acts on. REQUIRED for organization-scoped credentials (otherwise 400 BRAND_ID_REQUIRED — there is no default brand); list ids with GET /v1/brands. Brand-scoped credentials may omit it, and sending a different brand returns 403 BRAND_SCOPE_MISMATCH. A brand outside your organization returns 404 BRAND_NOT_FOUND.
1 - 64Body
html: an HTML email document or fragment · mjml: MJML markup · jsx: React Email — a module with a default-exported component, or a bare <Html> element · eml: a saved RFC 822 message
html, mjml, jsx, eml 11 - 200Inbox subject line to set on the design (subjectLine — distinct from title, the canvas name). Sends still take an explicit per-send subject; this is the design's default, seeded into the send dialog and returned by GET /v1/emails/{emailId}.
1 - 250File the design under an existing group (grp_…), or ungrouped. Mutually exclusive with groupName.
1 - 64File the design under a group resolved (or created) by this name. Mutually exclusive with groupId.
1 - 60Response
The design was imported + persisted. Free — no model runs. emailVersionId pins the exact version for sends + automation nodes.
Was this page helpful?