Errors
Errors are returned as JSON with this base shape:
{
"error": { "code": "insufficient_scope", "message": "Human-readable message" },
"requestId": "req_3f9a1c2b7d4e8f60"
}error.code is stable and machine-readable; error.message is human-facing. Some errors attach extra fields as documented below. Key your retry and handling logic off the HTTP status and error.code. The same requestId is returned in the X-Request-ID response header; quote it when you contact support.
Validation errors carry a code and per-field details:
{
"error": {
"code": "validation_failed",
"message": "Request validation failed.",
"details": [
{ "field": "currency", "message": "Required" }
]
},
"requestId": "req_3f9a1c2b7d4e8f60"
}A request blocked by one of your policies returns 403 with the code policy_violation; the message is the blocking policy's reason:
{
"error": {
"code": "policy_violation",
"message": "Order exceeds maximum unapproved amount"
},
"requestId": "req_3f9a1c2b7d4e8f60"
}Status codes
200 OK
Request succeeded
201 Created
Resource created
204 No Content
Request succeeded, nothing to return (used by DELETE)
400 Bad Request
Validation failed; body malformed; required parameter missing
401 Unauthorized
API key missing, unknown, or revoked
403 Forbidden
Authenticated but the key lacks required scope, or a policy blocked the operation
404 Not Found
Resource does not exist for the calling tenant
409 Conflict
Terminal-state conflict (e.g. completing an already-completed payment)
413 Payload Too Large
Request body is larger than 1 MB; see Request size limits
429 Too Many Requests
Rate limit exceeded; see Rate limits
500 Internal Server Error
Bug on our side — safe to retry idempotent requests
502 Bad Gateway
Downstream billing system returned an error or could not be reached
Common error codes
error.code
Status
When it appears
validation_failed
400
The request body or parameters failed validation; see details
api_key_required
401
No API key was sent
invalid_api_key
401
The API key is not recognized
api_key_revoked
401
The API key has been revoked
insufficient_scope
403
The API key lacks a scope the endpoint requires
policy_violation
403
One of your policies blocked the operation
not_found
404
The resource (for example an account or subscription) does not exist for your tenant
no_billing_integration
404
The endpoint needs an active billing integration (Stripe or Zuora) and none is configured
internal_error
500
An error on our side; safe to retry idempotent requests
live_quote_unavailable
502
The order needs live billing-system pricing, but the billing integration cannot quote it
live_quote_failed
502
The live billing-system quote was attempted and failed
Request size limits
Body size. A JSON request body may be at most 1 MB. A larger body is refused with
413 Payload Too Large.Lists and maps. Arrays and key–value maps in a request body have a maximum length (for example, the line items of an order or the event types of a webhook). Limits vary by field and are set above observed production use. An over-limit list or map returns
400with the error codevalidation_failedand one detail naming the field, its length and the limit:
If a list is over its limit, the response reports the size error instead of item-level errors. Split the request or send fewer entries.
Retrying
4xxerrors should not be retried without changing the request.429should be retried afterX-RateLimit-Reset(a Unix timestamp).5xxerrors are safe to retry; use exponential backoff. Be aware that the API does not currently de-duplicate retried writes server-side, so guard against duplicates client-side (e.g. don't retry aPOSTthat may have succeeded without first checking viaGET).
Related
Last updated
Was this helpful?
