Skip to main content
Every non-2xx response from the Brew Public API v1 returns the standard JSON error envelope, including the trigger-fire endpoint, which now reports a bad payload as 400 INVALID_PAYLOAD in that same envelope. Branch on the stable code, never on a human-readable message that can change.

The Error Envelope

Every code on this page has a stable anchor at #<code-in-kebab-case>, so INSUFFICIENT_CREDITS is addressable as /api-reference/api/errors#insufficient-credits. Link those anchors from support threads, runbooks, and agent prompts. Today the envelope’s docs value is the page URL; appending the per-code fragment on the API side is an open question tracked in the repo notes.

details Shape: PUBLISH_VALIDATION_FAILED (422)

When PATCH /v1/automations/{automationId} with { published: true } is blocked, details.blockers[] enumerates every node-level reason so callers can render a fix-it list.

details Shape: AUTOMATION_GRAPH_INVALID (400)

When POST /v1/automations (or PATCH with new nodes/connections) fails the server-side FK + structural resolver, details.issues[] enumerates every problem. Each carries a kind you can branch on:

Error Code Catalog

Generated from the OpenAPI specification, so it lists every code the API can return and nothing it cannot. “Every operation” holds the codes any endpoint may answer with; the rest are grouped by the resource that raises them. Each code keeps its stable #<code-in-kebab-case> anchor.

Every operation

Audiences

Automations

Brands

Chats

Contacts

Content

Contracts

Domains

Emails

Fields

Figma

Integrations

Runs

Sends

Triggers

Row-Level Codes

Batch contact writes (POST /v1/contacts, POST /v1/contacts/import-csv) can answer 2xx and still reject individual rows. Those rejections arrive in a per-row errors[] array rather than as the response status, and each entry carries its own code: The accepted rows still apply, so read summary and errors[] rather than branching on the status alone.

Warnings

A 2xx response can also carry a warnings[] array. A warning never fails the request; it reports something you probably want to fix.

SDK Error Handling (TypeScript)

The official @brew.new/sdk throws a typed BrewApiError on every non-2xx response, exposing the full envelope:

Branching Agent / SDK Logic on code

Three rules:
  1. code is stable. It’s part of our public contract. We will not change the spelling of a code; we may add new ones.
  2. type is a coarse bucket for default UX. Use type === 'rate_limit' to gate a retry; use type === 'authentication_error' to ask the user to re-issue the key.
  3. Never branch on message. Operator-facing copy may change between releases.

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.