404 for unknown routes, and rate-limit rejections — uses the same envelope:
requestId also appears in the X-Request-Id response header. Log it and quote it in support tickets.
Fields
string
required
The error family. One of
invalid_request_error, authentication_error, permission_error, rate_limit_error, card_error, or api_error.string
required
A stable machine-readable code. Branch on
code, not message. See the table below.string
required
Human-readable explanation. Not stable — do not parse it.
string
The specific request field the error refers to, when applicable. Omitted otherwise.
string
required
Server request ID, equal to the
X-Request-Id header.type/code/message. card_error responses on publish include shortfall, suggestedPack, billingPortalUrl, and declineCode; quote_changed includes quotedCost and currentCost. See Publishing and payments.
Status codes and common codes
Handling in code
Branch onerror.code, not error.message or the HTTP status alone. Codes are stable across releases; messages and status codes may be tightened over time.
insufficient_credits, card_declined, card_authentication_required) never bind the Idempotency-Key — retry publish with a new key after funding.