Error Response Model
When an error occurs, the API returns anError object:
Response Pattern
All API methods return a tuple of(response, status_code):
HTTP Status Codes
Success Codes
- 200 OK - Request succeeded (GET, PATCH, PUT)
- 201 Created - Resource created successfully (POST)
Error Codes
- 400 Bad Request - Invalid request parameters or data
- 401 Unauthorized - Authentication failed or missing
- 404 Not Found - Resource not found
- 500 Internal Server Error - Server error
Common Errors
Authentication Errors
Resource Not Found
Invalid Data
Aggregate Errors
When creating or updating aggregates, you may receive anAggregateError:
Error Handling Patterns
Basic Pattern
Retry Pattern
Validation Pattern
Best Practices
- Always check status codes - Don’t assume success
- Handle specific errors - Use isinstance() to check error types
- Log errors - Record errors for debugging
- Validate input - Check data before sending to API
- Use retries for server errors - Implement exponential backoff
- Don’t retry client errors - 4xx errors won’t succeed on retry
- Provide user feedback - Convert errors to user-friendly messages