code for the specific reason. Do not parse message; its wording can change.
v2 envelope
Successful v2 responses use
{ "success": true, "requestId", "timestamp", "data", "meta"? }. See Stack traces for what server errors expose.
v1 envelope
v1 error bodies keep every field they had before and add three:requestId, code and errorInfo. Nothing was removed or renamed.
errorInfo.details is, in this order: the errors array, a nested error details, an object with the extra context the route returned (available, required, reason, requiredFeatures, validEventTypes), or a legacy top-level details value. It is omitted when there is none.
An out-of-credits call returns the extra fields next to the standard ones:
402 has no specific code today, so it carries the fallback ERROR. Branch on the HTTP status for it.
errorInfo is the v1 spelling of v2’s error. v1 cannot put an object under error because several v1 routes already return error as a string and existing integrations read it.- Per-item errors inside a successful
POST /calls/bulkresponse (results[].error) are not error envelopes. They keep their{ code, message }shape, wherecodeis an HTTP-style number. - The tracking endpoint (
/track) returns a nestederror: { code, message }object, anderrorInfois copied from it. - A webhook test delivery that reaches your URL but fails returns
200withsuccess: false. It is a result, not an error envelope, so it has noerrorInfo. - Responses that are not JSON objects (arrays, files, streams, redirects,
track.js) are never wrapped.
Mapping v1 errorInfo to v2 error
A client that reads
errorInfo.code and errorInfo.message first, and falls back to message, works on v1 responses from before and after this change. The dashboard does this.
HTTP status codes
Error code table
One catalog serves both versions. A code never changes its meaning, and new codes can be added at any time (see Versioning). Handle unknown codes by falling back to the HTTP status.
When a v1 handler sets no specific code, the code is derived from the status: 400
BAD_REQUEST (VALIDATION_ERROR when the message is “Validation failed”), 401 UNAUTHENTICATED, 402 INSUFFICIENT_CREDITS, 403 FORBIDDEN, 404 NOT_FOUND, 405 METHOD_NOT_ALLOWED, 409 CONFLICT, 413 PAYLOAD_TOO_LARGE, 415 UNSUPPORTED_MEDIA_TYPE, 422 UNPROCESSABLE_ENTITY, 429 RATE_LIMITED, 502 UPSTREAM_ERROR, 503 SERVICE_UNAVAILABLE, 504 UPSTREAM_TIMEOUT, any other 5xx INTERNAL_ERROR, any other 4xx ERROR.
Items inside a v2 bulk call response carry their own error: { code, message } (for example INSUFFICIENT_CREDITS or INTERNAL_ERROR); see the migration guide.
Stack traces
Error responses never include a stack trace unless the operator of the deployment explicitly setsEXPOSE_STACK_TRACES=true. NODE_ENV has no effect on this. The flag is meant for local debugging only. Unexpected 4xx errors that are not caused by your input return the generic message Bad request, and 5xx errors return Internal server error.
Handling errors
- Retry
429and503after theRetry-Afterheader, with backoff. Retry500only with anIdempotency-Key(see Idempotency). - Do not retry other
4xxresponses without changing the request. - Quote
requestIdwhen you contact support.