Error Response Format
All error responses follow a consistent structure:Error Codes
Authentication Errors (401)
Payment Errors (402)
Not Found Errors (404)
Validation Errors (422)
Rate Limit Errors (429)
Server Errors (500)
Automatic Retries
Retries are handled automatically with exponential backoff. You can customize the retry behavior:GETandDELETErequests are always retried on transient errorsPOSTrequests are only retried when anidempotencyKeyis provided- The
Retry-Afterheader from 429 responses is respected automatically - Retried status codes: 429, 500, 503, 504, and network errors
Complete Error Handling Pattern
Here’s a complete error handling example using typed error classes:Logging and Monitoring
Request Logging
Use built-in debug hooks for observability:Error Tracking
Best Practices
Always include requestId in logs
Always include requestId in logs
The
meta.requestId helps with debugging and support requests.Implement circuit breakers for high-volume
Implement circuit breakers for high-volume
If errors persist, temporarily stop requests to prevent cascading failures.
Handle partial results separately
Handle partial results separately
Partial results (
partial: true) are successes with some failures handle
them differently from full failures.Validate input before sending
Validate input before sending
Catch validation errors client-side when possible to reduce failed API
calls.
Use structured error classes
Use structured error classes
Create error classes that make it easy to check error types and extract
details.
Next Steps
API Reference
Complete API documentation with error codes
Rate Limits
Understand and manage rate limits