Skip to main content
Most non-2xx responses from the Brew Public API v1 return the standard JSON error envelope. The trigger-fire endpoint keeps a legacy fire envelope for 400 PAYLOAD_MISMATCH; branch on the stable code or status field, not 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 (409)

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:

Foundational Error Codes (Every Endpoint)

These can appear on any v1 endpoint:

Resource-Specific Codes

Triggers (/v1/automations/triggers)

Automations (/v1/automations)

Automation Runs (/v1/automations/runs)

Emails (/v1/emails)

Sends (/v1/sends)

Credits and Billing

Domains Lifecycle (/v1/domains)

Audiences (/v1/audiences)

Contacts + Fields (/v1/contacts, /v1/fields)

Analytics (/v1/analytics/trigger-instances)

Chat Context (/v1/chats/{chatId})

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.