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

An existing design (emailId from list_email_designs) to use as the style/layout reference for the new email.

category
enum<string>

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.

Available options:
welcome,
newsletter,
promotional,
product-launch,
product-update,
cart-abandonment,
event-invitation,
event-reminder,
feedback-request,
re-engagement,
referral,
business,
internal,
general

Response

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

response
string
required
Minimum string length: 1