Skip to main content
Every error response is JSON and carries the request id (see Request IDs). Use the HTTP status for control flow and the 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:
A v1 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.
Other v1 details:
  • Per-item errors inside a successful POST /calls/bulk response (results[].error) are not error envelopes. They keep their { code, message } shape, where code is an HTTP-style number.
  • The tracking endpoint (/track) returns a nested error: { code, message } object, and errorInfo is copied from it.
  • A webhook test delivery that reaches your URL but fails returns 200 with success: false. It is a result, not an error envelope, so it has no errorInfo.
  • 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 sets EXPOSE_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 429 and 503 after the Retry-After header, with backoff. Retry 500 only with an Idempotency-Key (see Idempotency).
  • Do not retry other 4xx responses without changing the request.
  • Quote requestId when you contact support.