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:
codeis stable. It’s part of our public contract. We will not change the spelling of a code; we may add new ones.typeis a coarse bucket for default UX. Usetype === 'rate_limit'to gate a retry; usetype === 'authentication_error'to ask the user to re-issue the key.- Never branch on
message. Operator-facing copy may change between releases.
See Also
- Rate limits:
429 RATE_LIMITED+Retry-Aftercookbook. - Idempotency:
409 IDEMPOTENCY_CONFLICTsemantics. - Authentication:
401/403codes. - TypeScript SDK error handling: patterns + retry helpers.
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.