Skip to main content
POST

Authorizations

Authorization
string
header
default:Bearer brew_your_api_key
required

Send your Brew API key as Authorization: Bearer brew_xxx.

Headers

Idempotency-Key
string

Optional idempotency key for safe retries. Reusing the same key with the same request body returns the original response for 24 hours.

Required string length: 1 - 100
X-Brand-Id
string

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.

Required string length: 1 - 64

Body

application/json

Generation prompt plus optional source URLs / reference design. The brand comes from the credential (or the X-Brand-Id header on an organization-scoped one) and must not be passed in the body.

prompt
string
required

What the email is about — campaign goal, key content, offer, tone. The more specific (product names, dates, discount, audience), the better the design.

Minimum string length: 1
contentUrls
string<uri>[]

Up to 8 source URLs to build the email FROM — each is crawled and synthesized into one email (newsletters, recaps, product roundups).

Maximum array length: 8
referenceEmailId
string

The emailId of an existing design to redraw in this brand's voice — one of this brand's own designs (GET /v1/emails) or a public gallery template (GET /v1/templates). Its layout and structure are the reference; the copy, imagery and styling become this brand's.

category
enum<string>

Email category that steers the design treatment (exemplars, hero recipe, personalization) — mirrors what the in-app agent infers per request. One of: welcome, onboarding, newsletter, content, event-invitation, event-reminder, event-recap, product-launch, product-update, product-pitch, promotional, cart-abandonment, re-engagement, subscription, feedback-request, referral, company-news, fundraising, order-confirmation, shipping-update, receipt, password-reset, verification, security-alert, account-update, notification, support, internal, business, general. Omit for a general treatment. Transactional categories (receipt, password-reset, order-confirmation, …) steer receipt/reset design conventions; to DELIVER those emails, wire the design into an automation with a trigger and a transactional-purpose sending domain, then fire the trigger.

Available options:
welcome,
onboarding,
newsletter,
content,
event-invitation,
event-reminder,
event-recap,
product-launch,
product-update,
product-pitch,
promotional,
cart-abandonment,
re-engagement,
subscription,
feedback-request,
referral,
company-news,
fundraising,
order-confirmation,
shipping-update,
receipt,
password-reset,
verification,
security-alert,
account-update,
notification,
support,
internal,
business,
general
title
string

Canvas name, 2-4 words (e.g. 'Newsletter Welcome'). Omit and Brew names it.

Required string length: 1 - 200
subjectLine
string

Inbox 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}.

Required string length: 1 - 250
lang
enum<string>

ISO 639-1 language code of the email's copy (or zh-Hans / zh-Hant). Omit and Brew's language model reads it from the finished body; a value you set is kept and never re-detected. Becomes the HTML document's lang (and dir for right-to-left languages) on every send and export. One of: en, de, fr, es, pt, it, nl, pl, sv, da, no, fi, cs, sk, hu, ro, bg, el, tr, ru, uk, hr, sr, sl, lt, lv, et, ca, ar, he, fa, ur, hi, bn, th, vi, id, ms, tl, ja, ko, zh-Hans, zh-Hant, sw, af.

Available options:
en,
de,
fr,
es,
pt,
it,
nl,
pl,
sv,
da,
no,
fi,
cs,
sk,
hu,
ro,
bg,
el,
tr,
ru,
uk,
hr,
sr,
sl,
lt,
lv,
et,
ca,
ar,
he,
fa,
ur,
hi,
bn,
th,
vi,
id,
ms,
tl,
ja,
ko,
zh-Hans,
zh-Hant,
sw,
af
groupId
string

File the design under an existing group (grp_…), or ungrouped. Mutually exclusive with groupName.

Required string length: 1 - 64
groupName
string

File the design under a group resolved (or created) by this name. Mutually exclusive with groupId.

Required string length: 1 - 60

Response

The agent answered in prose without writing a design ({ response }).

response
string
required
Minimum string length: 1