error object containing structured information about what went wrong. The error format follows Stripe’s API error conventions for consistency and familiarity.
Error response structure
Response format
Error attributes
string
required
The category of error. See error types below.
string
required
A short string indicating the specific error. See error codes below.
string
required
A human-readable message providing details about the error.
string
If the error is parameter-specific, the name of the parameter related to the error. May be
null.string
required
ISO 8601 timestamp of when the error occurred.
string
required
URL to documentation about this error type.
HTTP status codes
The API uses conventional HTTP response codes to indicate success or failure:Error types
Thetype field categorizes the error:
Error codes
Thecode field provides a programmatic identifier for handling specific errors:
Common error examples
Resource not found (404)
When requesting a resource that doesn’t exist or belongs to another account:Response
Validation error (422)
When creating or updating a resource with invalid data:Response
Nested resource not found (404)
When a nested resource reference is invalid:Response
Authentication error (401)
When the API token is missing or invalid:Response
Handling errors
Programmatic error handling
Use thetype and code fields to handle errors programmatically:
Best practices
- Always check for the
errorobject in non-2xx responses. - Use
codefor programmatic handling, notmessage(messages may change). - Display
messageto users — it is designed to be human-readable. - Use
paramto highlight form fields that need correction. - Log
timestampand full error for debugging. - Implement exponential backoff for
rate_limit_error. - Check
doc_urlfor detailed documentation about specific errors.
Rate limiting
When you exceed rate limits, you will receive:Support
For questions about API errors or unexpected error responses, contact support with:- The full error response JSON
- The request that caused the error (excluding sensitive data)
- The timestamp of the error