Error Response Formats
REST API Errors
All REST API errors follow this structure:JSON-RPC Errors
JSON-RPC errors follow the JSON-RPC 2.0 specification:JSON-RPC Error Codes
| Code | Meaning | Description |
|---|---|---|
| -32600 | Invalid Request | The JSON sent is not a valid Request object |
| -32601 | Method not found | The method does not exist / is not available |
| -32602 | Invalid params | Invalid method parameter(s) |
| -32603 | Internal error | Internal JSON-RPC error |
| -32000 | Server error | Generic server error |
HTTP Status Codes
| Code | Meaning | Description |
|---|---|---|
| 200 | OK | Request succeeded |
| 400 | Bad Request | Invalid request parameters or query validation error |
| 401 | Unauthorized | Missing or invalid API key |
| 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 SQL query syntax
- Invalid parameter values
- Missing required parameters
- Parameter out of range
- Invalid JSON-RPC request format
401 Unauthorized
Missing or invalid API key. REST API Example:- Missing API key header
- Invalid API key
- Inactive or revoked API key
x-api-key header or api-key query parameter.
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:/health endpoint.
SQL Query Errors
Invalid Query
400 Bad Request
LIMIT Exceeded
400 Bad Request
Query Too Long
400 Bad Request
Error Handling Examples
JavaScript/TypeScript (REST API)
JavaScript/TypeScript (JSON-RPC)
Python (REST API)
Python (JSON-RPC)
Retry Logic
Implement retry logic for transient errors (500, 503, 429):REST API
JSON-RPC
Error Handling Best Practices
Check for errors first
Check for errors first
Always check for errors in JSON-RPC responses before accessing result data.
Handle specific error codes
Handle specific error codes
Handle specific error codes (-32600, -32601, -32602, -32000) 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 data fields.
Provide user-friendly messages
Provide user-friendly messages
Translate technical error messages to user-friendly messages in your UI.
Respect rate limits
Respect rate limits
Monitor rate limit headers and implement backoff when approaching limits.
