Generate an email design
Generates a new design through the Brew email agent. Emails are pure DESIGNS in the decoupled model — no send state, no type. Sending happens later — POST /v1/sends delivers the design to a target (a saved audience, an inline list, or a single address) via a verified domain (or fires a one-off test with test: true), or a sendEmail node in an automation graph references the returned emailId + emailVersionId.
Returns 201 with { emailId, emailVersionId, html, previewImage?, group, subjectLine? } when a design was persisted, or 200 with { response } when the agent answered in prose without writing a design. Optional subjectLine sets the design-default inbox subject (POST /v1/sends still takes an explicit per-send subject). Optional targetGroupId (grp_… or ungrouped) or targetGroupName (resolve-or-create) — not both; omit to land Ungrouped. Unknown targetGroupId → 404 EMAIL_GROUP_NOT_FOUND. Supports Idempotency-Key for safe retries.
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
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.
What the email is about — campaign goal, key content, offer, tone. The more specific (product names, dates, discount, audience), the better the design.
1Up to 8 source URLs to build the email FROM — each is crawled and synthesized into one email (newsletters, recaps, product roundups).
8An existing design (emailId from list_email_designs) to use as the style/layout reference for the new email.
Marketing email category that steers the design treatment (exemplars, hero recipe, personalization) — mirrors what the in-app agent infers per request. One of: welcome, newsletter, promotional, product-launch, product-update, cart-abandonment, event-invitation, event-reminder, feedback-request, re-engagement, referral, business, internal, general. Omit for a general treatment. Transactional emails (receipts, password resets, order confirmations) are sent via automations with a trigger, not this endpoint.
welcome, newsletter, promotional, product-launch, product-update, cart-abandonment, event-invitation, event-reminder, feedback-request, re-engagement, referral, business, internal, general 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=.
1 - 250Existing canvas group id (grp_…), or ungrouped. Mutually exclusive with targetGroupName.
1 - 64Resolve-or-create a group by this name. Mutually exclusive with targetGroupId.
1 - 60Response
The agent answered in prose without writing a design ({ response }).
1