Error Handling and Rate Limiting
When an error occurs, the API returns a standardized error response in the following format:
json
{
"_status": "ERR",
"_error": {
"code": 422,
"message": "Validation failed",
"details": {
"customer.name": "Name is required",
"customer.id_number": "Invalid ID number format"
}
}
}Common HTTP Status Codes
200 OK: Request successful201 Created: Resource created successfully400 Bad Request: Invalid request data401 Unauthorized: Authentication required or invalid403 Forbidden: Insufficient permissions404 Not Found: Resource not found422 Unprocessable Entity: Validation errors500 Internal Server Error: Server error
Best Practices for Error Handling
Always check the response status
- Check both HTTP status code and
_statusfield - Handle both successful and error responses
- Check both HTTP status code and
Implement proper error recovery
- Retry on temporary failures (e.g., rate limits)
- Log errors for debugging
- Provide meaningful error messages to end users
Handle specific error codes
401: Re-authenticate and retry422: Validate input data429: Implement backoff strategy5xx: Consider circuit breaker pattern
Validation Best Practices
- Validate data before sending
- Check required fields
- Verify data formats
- Ensure business rule compliance
Rate Limiting
Rate limiting is 3. Handle rate limiting gracefully with exponential backoff
- Standard rate limit: 100 requests per minute per API key
- Burst limit: 10 requests per second
- Rate limit headers are included in responses
