> ## Documentation Index
> Fetch the complete documentation index at: https://docs.brew.new/llms.txt
> Use this file to discover all available pages before exploring further.

# Send Your First Email with the Public API v1

> Get a key and go from a prompt to a sent, on-brand email in about five lines of curl. The full v1 surface: designs, sends, analytics, and automations.

<Note>
  **January 2026** · Available on all plans.
</Note>

## What Shipped

Brew now has a Public API. Everything you do in the app (generate an
on-brand design, send it through your verified domain, read the
analytics, wire up event-driven automations) is a documented HTTP
endpoint under `https://brew.new/api/v1`, backed by an OpenAPI 3.1
spec. Bring your own backend; Brew stays the creation and delivery
engine.

The surface is built around one idea: **emails are pure designs, and a
send is the unit of delivery and analytics.** A design carries no send
state and no type, so you can send the same one as many times as you
like, and every send is a `sendId` you poll for status and stats.

## Send Your First Email in \~5 Lines

Create a key at [brew.new/settings/api](https://brew.new/settings/api)
(each key is bound to one brand at creation), then generate a design and
send it. Assuming you already have a verified domain and a saved
audience:

```bash theme={null}
# 1. Generate an on-brand design from a prompt → returns { emailId }
curl -sX POST https://brew.new/api/v1/emails \
  -H "Authorization: Bearer $BREW_API_KEY" \
  -d '{ "prompt": "Welcome email for new subscribers" }'

# 2. QA it first → delivers synchronously, returns 200 { status: "sent", recipient }
curl -sX POST https://brew.new/api/v1/sends \
  -H "Authorization: Bearer $BREW_API_KEY" \
  -d '{ "emailId": "eml_123", "test": true, "subject": "Welcome to Brew", "to": "you@example.com" }'

# 3. Send it for real → returns 202 { sendId }
curl -sX POST https://brew.new/api/v1/sends \
  -H "Authorization: Bearer $BREW_API_KEY" \
  -d '{ "emailId": "eml_123", "domainId": "dom_123", "audienceId": "aud_123", "subject": "Welcome to Brew" }'
```

The test send (step 2) is the same `POST /v1/sends` endpoint with
`{ "test": true }`. It delivers synchronously from the Brew sender to a
single address, so it needs no verified domain or audience. Don't have
the ids for the real send yet? `GET /v1/domains` and `GET /v1/audiences`
list them, and `GET /v1/brand` returns the brand your key is pinned to
(check `ready` before generating).

## Watch It Land

Poll the send you just started for its lifecycle and aggregated stats,
and add `include=events` for the per-recipient feed:

```bash theme={null}
curl -s "https://brew.new/api/v1/analytics/sends?sendId=snd_123&include=events" \
  -H "Authorization: Bearer $BREW_API_KEY"
```

Every `POST` takes an `Idempotency-Key` header, so a retried send never
goes out twice.

## What's in v1

* **Designs**: generate (`POST /v1/emails`), import existing
  HTML / MJML / JSX, AI-edit, version, and restore.
* **Sends**: one polymorphic `POST /v1/sends` for both the real send
  and the `{ test: true }` QA send, plus cancel-before-it-goes-out.
* **Analytics**: read-only reporting over sends and their per-recipient
  events.
* **Automations**: wire a trigger to a graph of send / wait / filter /
  split nodes and fire it per-recipient from your backend.
* **Contacts, audiences, domains, brand, templates**: the supporting
  resources, all scoped to the one brand your key is bound to.

Three no-auth discovery endpoints let an agent learn the whole surface
before it even has a key: `GET /v1/help` (structured JSON),
`GET /v1/llms.txt` (prose for agents), and `GET /v1/health`.

## Prefer Typed Wrappers?

Brew ships an official TypeScript SDK, `@brew.new/sdk`, with a
resource-oriented method for every endpoint (`brew.emails.generate`,
`brew.emails.send`, `brew.analytics.sends.list`, …). Or generate a
client in any language from the OpenAPI spec.

## Get Started

[Read the API Introduction](/api-reference/api/api-introduction) for the
full quickstart and endpoint reference, or
[generate your own SDK](/sdks/openapi-codegen) from the spec.

## Related

* [API Introduction](/api-reference/api/api-introduction)
* [TypeScript SDK Overview](/sdks/overview)
* [Generate Your Own SDK](/sdks/openapi-codegen)
* [API Changelog](/changelog/api)
