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; new Date() and Date.now() with no arguments read the clock once at import and are saved as fixed text with a current_time_frozen warning, and process.env.X reads as undefined; anything else 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, 50 MB aggregate downloads, 128 distinct inline SVG images and 8 seconds of inline SVG rendering (past either, the rest are dropped with a warning).
Returns 201 { emailId, emailVersionId, html, previewImage?, assetReport, group, subjectLine? }. Each source element with content that a design could not keep is listed once in assetReport.warnings as { code: "element_dropped", location: "markup", host: "<tag>" }: inline svg, math and canvas, and button, select, textarea or table caption holding text are left out of the editable projection (the original source keeps them); audio, video, iframe, object and embed are removed from both, with audio/video fallback content kept. Email clients block SVG images, so an SVG image, hosted or inline (data:image/svg+xml in a src or background attribute or a CSS url()), becomes a hosted PNG: twice the pixel box its <img> sets (the SVG fitted as its preserveAspectRatio says), otherwise its own size so the layout holds. An inline one that will not render is removed (in JSX, its src) and listed as element_dropped with host svg; a hosted one that will not render, or whose URL has a # fragment, stays an SVG. Source words the editable design does not carry are named once as { code: "text_dropped", location: "markup", host: "<words>" }; version 1 keeps the exact source. JSX clock reads are named as { code: "current_time_frozen", location: "module", host: "Date.now() (line 10)" } (the first 20).
Errors 400 INVALID_REQUEST (naming the field in param) when title, subjectLine or content holds an unpaired surrogate (half of an emoji); 422 EMAIL_IMPORT_FAILED when the markup cannot be compiled into a design or its editable model is over the size budget, with nothing persisted; 502 EMAIL_IMPORT_PERSISTENCE_FAILED when the markup converted but the design could not be stored (nothing was created; the message carries the request id to give support); 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
Headers
The 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
Response
The design was imported + persisted. Free — no model runs. emailVersionId pins the exact version for sends + automation nodes; a step pinned to the latest version follows later edits and restores.
Was this page helpful?