Skip to main content
POST
/
v1
/
emails
Generate Email
curl --request POST \
  --url https://brew.new/api/v1/emails \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "prompt": "Create a welcome email for new customers who joined Brew today.",
  "brandId": "jn7a8w4q8m9k2p1x7c3b5v6n9h7s2d4f",
  "contentUrl": "https://example.com/blog/product-launch"
}
'
{
  "emailId": "email_2SmZOWV3ZQ7W5x6g3m4p",
  "emailHtml": "<!DOCTYPE html><html><body>Welcome to Brew.</body></html>",
  "emailPng": "https://storage.example.com/emails/email_2SmZOWV3ZQ7W5x6g3m4p.png"
}

Authorizations

Authorization
string
header
default: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

Body

application/json

Email generation prompt and optional brand context.

prompt
string
required
Minimum string length: 1
brandId
string
contentUrl
string<uri>
referenceEmailId
string

Response

Generated email artifact or a text response if no email artifact was produced.

emailId
string
required
Minimum string length: 1
emailHtml
string
required
emailPng
string<uri>
emailMobilePng
string<uri>