Skip to main content
Brew uses API key authentication. Each key is scoped to one brand or to your whole organization at creation time, carries a permission scope set, and ships over HTTPS as either an Authorization: Bearer header or the convenience X-API-Key header.

Quickstart

Get a key at brew.new/settings/api.

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:
Find brand ids with 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-Id is a header, and it is the only way to name a brand. No endpoint accepts a brandId field in a body or query string. Sending one returns 400 INVALID_REQUEST with param: "brandId".
  • Reads return only the resolved brand’s data, and writes change only that brand. An identifier from another brand returns 404 (not 403), so the API never confirms that a resource exists elsewhere. An X-Brand-Id naming a brand outside your organization returns 404 BRAND_NOT_FOUND for 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), and GET /v1/usage. The no-auth discovery surfaces, GET /v1/health and GET /v1/help, are not brand-scoped either. Every other authenticated endpoint is brand-scoped.
Use a brand key when an integration only ever touches one brand. If it leaks, the damage stays inside that brand. Use an organization key for tooling that works across brands, like a script that creates brands. A brand can have any number of keys (dev, staging, production, per-service, per-teammate). Organization and brand credentials owns this contract in full: which operations are organization-level, when you get 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 or all. 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-keys operations require an org:admin dashboard session, so keys are minted, rotated, and revoked from the dashboard, never by another key.
These are roadmap items where there’s customer pull; tell us at the link below if your integration needs any of them.

Errors

Authentication failures and permission errors use the standard envelope and codes documented in Errors.

See Also

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:

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.