Skip to main content
PATCH

Authorizations

Authorization
string
header
default:Bearer brew_your_api_key
required

Send your Brew API key as Authorization: Bearer brew_xxx.

Headers

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

Path Parameters

emailId
string
required

Design id returned by POST /v1/emails and listed by GET /v1/emails.

Required string length: 1 - 64
Example:

"2SmZOWV3ZQ7W5x6g3m4pA"

Body

application/json

A natural-language prompt edit (optional emailVersionId source pin, optional contentUrls) and/or the envelope fields title, subjectLine, lang and groupId — at least one of the five. Identity lives on the path.

prompt
string

The edit to make, in plain language — e.g. "swap the hero for the spring campaign image and tighten the CTA copy". Scoped edits beat full rewrites. Omit to only patch title, subjectLine, lang or groupId (at least one of the five is required).

Minimum string length: 1
emailVersionId
string

Pin the edit to a specific source version (from GET /v1/emails/{emailId}?include=versions). Requires prompt. Omit to edit the current latest.

Required string length: 1 - 64
contentUrls
string<uri>[]

Up to 8 URLs whose content grounds the edit (e.g. the product page the new section should describe).

Maximum array length: 8
title
string

Rename the design (its canvas name, distinct from subjectLine). Deterministic and free; alone it patches the head in place, with prompt the new version inherits 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> | null

Set the language of the email (ISO 639-1, or zh-Hans / zh-Hant). Part of the free envelope patch: no AI run, no new version. Once set it is kept: Brew no longer re-detects it after edits. null clears a language you set, and Brew reads it again from the email.

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,
null
groupId
string | null

Move the design into this existing group (grp_…); null moves it to Ungrouped; omit to leave its group alone. Part of the free envelope patch: no AI run, no new version.

Required string length: 1 - 64

Response

The edited design (a prompt edit writes a new latest version row and is USAGE-metered), the current head (a title / subjectLine envelope patch — no new version, free), or a text response if the agent returned prose instead of a design.

emailId
string
required
Minimum string length: 1
emailVersionId
string
required
Minimum string length: 1
html
string
required
group
object | null
required
previewImage
string<uri>
subjectLine
string
title
string