Authorization: Bearer header or the convenience X-API-Key header.
Quickstart
Headers (Use ONE)
Send exactly one. Sending both is allowed; sending neither returns
401 AUTHENTICATION_REQUIRED. Malformed keys return 401 INVALID_API_KEY; revoked keys return 401 API_KEY_REVOKED.
Brand vs Organization Keys
Every key is scoped when you create it, and the scope can’t change later. It covers either one brand or your whole organization.
An organization key names its brand on each request:
GET /v1/brands. An organization key sees every brand there. A brand key sees only its own, so the same call tells any key which brand it can reach.
These rules hold for both kinds:
X-Brand-Idis a header, and it is the only way to name a brand. No endpoint accepts abrandIdfield in a body or query string. Sending one returns400 INVALID_REQUESTwithparam: "brandId".- Reads return only the resolved brand’s data, and writes change only that brand. An identifier from another brand returns
404(not403), so the API never confirms that a resource exists elsewhere. AnX-Brand-Idnaming a brand outside your organization returns404 BRAND_NOT_FOUNDfor the same reason. - Organization-level endpoints take no
X-Brand-Id:/v1/brands(brand lifecycle),GET /v1/templates(the public template catalog),GET /v1/flows(public email flows), andGET /v1/usage. The no-auth discovery surfaces,GET /v1/healthandGET /v1/help, are not brand-scoped either. Every other authenticated endpoint is brand-scoped.
400 BRAND_ID_REQUIRED, 403 BRAND_SCOPE_MISMATCH, or
403 ORG_SCOPE_REQUIRED, and how that differs from 403 INSUFFICIENT_ROLE.
Permission Scopes
Each key carries one or more permission scopes. Routes require either the route’s scope orall. Missing permission returns 403 INSUFFICIENT_PERMISSIONS with error.param pointing at the missing scope name.
Scope Implication (Coarse Scopes Satisfy Granular Ones)
Brew supports both coarse scopes (contacts, emails, automations) and granular least-privilege scopes (audiences, domains, sends). A coarse scope automatically satisfies the granular scopes it implies, so existing keys keep working. You only reach for the granular scopes when you want to lock a key down further.
The complete set of valid scope values accepted when a key is created is
contacts, emails, automations, audiences, domains, sends, brands, transactional, and all.
Per-Route Required Scope
A trailing* covers every method and nested route under that path prefix.
transactional is a reserved scope with no route today.
Principle of least privilege. For a back-end that only fires triggers, issue a key with automations only: even if it leaks, it can’t list contacts. For a service that only inspects send health, issue emails because the analytics reads require that scope; the key still cannot manage contacts or automations. The dashboard surfaces each key’s scope set so you can audit + rotate.
Key Lifecycle
Key CRUD is not part of the programmatic surface. The three
/v1/api-keys operations you see in the API reference back the dashboard’s own API page: they accept only a signed-in Clerk session whose active organization role is exactly org:admin. An API key, an OAuth connection, the MCP server, and the CLI all receive 403 on them, so a compromised key can never mint or revoke another. If you need programmatic key management for a SOC2 / SAST pipeline, contact us.
Production Security Checklist
What We Do NOT Support Today
For transparency:- OAuth 2.0 / token exchange for end-user authorization. The Brew Public API is server-to-server today; if you want per-user OAuth on top of the API, build it in your app and hold the Brew key on your server. Contact us if you have a use case that genuinely needs OAuth.
- PATCH request idempotency. See Idempotency for the supported methods and replay contract.
- Public key-management API. The
/v1/api-keysoperations require anorg:admindashboard session, so keys are minted, rotated, and revoked from the dashboard, never by another key.
Errors
Authentication failures and permission errors use the standard envelope and codes documented in Errors.See Also
- API introduction: the overview that links every reference page.
- Idempotency: set
Idempotency-Keyon every retriedPOST. - Rate limits: per-route policies + the
429cookbook. - SDK authentication: TypeScript SDK auth specifics.
Need Help?
Our team is ready to support you at every step of your journey with Brew. Choose the option that works best for you:- Self-Service Tools
- Talk to Our Team
Search Documentation
Type in the “Ask any question” search bar at the top left to instantly find relevant documentation pages.
ChatGPT/Claude Integration
Click “Open in ChatGPT” at the top right of any page to explore it further with ChatGPT or Claude.