Error Response Formats
REST API Errors
All REST API errors follow this structure:GraphQL Errors
GraphQL errors follow the standard GraphQL error format:HTTP Status Codes
| Code | Meaning | Description |
|---|---|---|
| 200 | OK | Request succeeded |
| 400 | Bad Request | Invalid request parameters or GraphQL validation error |
| 404 | Not Found | Resource not found |
| 429 | Too Many Requests | Rate limit exceeded |
| 500 | Internal Server Error | Server error |
| 503 | Service Unavailable | Service temporarily unavailable |
Error Types
400 Bad Request
Invalid request parameters or validation errors. REST API Example:- Invalid date format
- Invalid parameter values
- Missing required parameters
- Parameter out of range
- Invalid GraphQL query syntax
404 Not Found
Resource not found. REST API Example:- Transaction signature doesn’t exist
- Invalid endpoint
- Resource was deleted
429 Too Many Requests
Rate limit exceeded. REST API Example:500 Internal Server Error
Server error. REST API Example:503 Service Unavailable
Service temporarily unavailable. REST API Example:GraphQL-Specific Error Codes
COMPLEXITY_EXCEEDED
Query complexity exceeds the maximum allowed (1000).queryComplexity query to check before execution. Optimize query by adding filters, reducing group by dimensions, or using pagination.
PAGINATION_REQUIRED
Query returns more than 10k rows without pagination.pagination: { first: 1000 } to your query.
INVALID_FILTER
Invalid filter value or combination.VALIDATION_ERROR
Input validation failed.Error Handling Examples
JavaScript/TypeScript (REST API)
JavaScript/TypeScript (GraphQL)
Python (REST API)
Python (GraphQL)
Retry Logic
Implement retry logic for transient errors (500, 503, 429):REST API
GraphQL
Error Handling Best Practices
Check for errors first
Check for errors first
Always check for errors in GraphQL responses before accessing data.
Handle specific error codes
Handle specific error codes
Handle specific error codes (COMPLEXITY_EXCEEDED, PAGINATION_REQUIRED) with appropriate actions.
Implement retry logic
Implement retry logic
Retry transient errors (500, 503, 429) with exponential backoff.
Log error details
Log error details
Log error details for debugging, including error codes and extensions.
Provide user-friendly messages
Provide user-friendly messages
Translate technical error messages to user-friendly messages in your UI.
