Error Codes
The Binom Router API uses standard HTTP status codes to indicate the success or failure of an API request. This document provides a comprehensive list of error codes, their meanings, and recommended actions for resolving issues.
Error Response Format
All error responses follow a consistent JSON structure:
{
"error": {
"code": "ERROR_CODE",
"message": "Human-readable error description",
"details": "Additional context about the error",
"requestId": "unique-request-id-for-tracing",
"timestamp": "2024-02-07T12:34:56.789Z"
}
}
HTTP Status Codes
400 Bad Request
Description: The request was malformed or contains invalid parameters.
Common Causes:
- Invalid JSON syntax in request body
- Missing required fields in the request
- Invalid data types or format (e.g., malformed UUID, invalid date format)
- Validation errors for input parameters
Recommended Actions:
- Verify the request body is valid JSON
- Check that all required fields are present
- Validate data types and formats against API documentation
- Review the
detailsfield for specific validation errors
Example:
{
"error": {
"code": "BAD_REQUEST",
"message": "Invalid request parameters",
"details": "Field 'email' is required and must be a valid email address",
"requestId": "req_abc123",
"timestamp": "2024-02-07T12:34:56.789Z"
}
}
401 Unauthorized
Description: Authentication is required or has failed.
Common Causes:
- Missing or invalid API key
- Expired authentication token
- Incorrect credentials provided
- API key does not have required permissions
Recommended Actions:
- Ensure your API key is included in the
Authorizationheader - Verify the API key is valid and not expired
- Check that your credentials are correct
- Contact support if you believe your API key should have access
Example:
{
"error": {
"code": "UNAUTHORIZED",
"message": "Authentication required",
"details": "Valid API key must be provided in Authorization header",
"requestId": "req_def456",
"timestamp": "2024-02-07T12:34:56.789Z"
}
}
402 Payment Required
Description: Payment is required to access the requested resource.
Common Causes:
- Subscription plan does not include this feature
- API usage quota has been exceeded
- Account has overdue payments
- Feature requires premium subscription
Recommended Actions:
- Check your current subscription plan and features
- Review your API usage statistics
- Upgrade your subscription plan if needed
- Contact billing support for payment issues
Example:
{
"error": {
"code": "PAYMENT_REQUIRED",
"message": "Premium feature access required",
"details": "This endpoint requires a Premium subscription. Current plan: Basic",
"requestId": "req_ghi789",
"timestamp": "2024-02-07T12:34:56.789Z"
}
}
404 Not Found
Description: The requested resource could not be found.
Common Causes:
- Invalid endpoint URL
- Resource ID does not exist
- Resource has been deleted or moved
- Incorrect HTTP method for the endpoint
Recommended Actions:
- Verify the endpoint URL is correct
- Check that the resource ID exists and is valid
- Ensure you're using the correct HTTP method (GET, POST, PUT, DELETE)
- Review the API documentation for correct endpoint paths
Example:
{
"error": {
"code": "NOT_FOUND",
"message": "Resource not found",
"details": "Route with ID '550e8400-e29b-41d4-a716-446655440000' does not exist",
"requestId": "req_jkl012",
"timestamp": "2024-02-07T12:34:56.789Z"
}
}
429 Too Many Requests
Description: The client has sent too many requests in a given amount of time.
Common Causes:
- Exceeded rate limit for your API key
- Too many concurrent requests
- Burst of requests exceeding allowed threshold
Recommended Actions:
- Implement exponential backoff in your client
- Check the
Retry-Afterheader for suggested wait time - Reduce request frequency
- Consider upgrading your plan for higher rate limits
Response Headers:
Retry-After: Number of seconds to wait before retryingX-RateLimit-Limit: Maximum requests per time windowX-RateLimit-Remaining: Remaining requests in current windowX-RateLimit-Reset: Unix timestamp when the rate limit resets
Example:
{
"error": {
"code": "TOO_MANY_REQUESTS",
"message": "Rate limit exceeded",
"details": "Maximum of 1000 requests per hour exceeded. Please retry after 3600 seconds.",
"requestId": "req_mno345",
"timestamp": "2024-02-07T12:34:56.789Z"
}
}
500 Internal Server Error
Description: An unexpected error occurred on the server.
Common Causes:
- Unexpected server-side error
- Database connection failure
- Third-party service outage
- Configuration issue
Recommended Actions:
- Retry the request after a short delay
- Check the system status page for ongoing incidents
- If the error persists, contact support with the
requestId - Ensure your request is not causing the server error
Example:
{
"error": {
"code": "INTERNAL_SERVER_ERROR",
"message": "An unexpected error occurred",
"details": "The server encountered an unexpected condition. Please try again later.",
"requestId": "req_pqr678",
"timestamp": "2024-02-07T12:34:56.789Z"
}
}
503 Service Unavailable
Description: The service is temporarily unavailable due to maintenance or overload.
Common Causes:
- Scheduled maintenance in progress
- Server overload or high traffic
- Database maintenance
- Critical service degradation
Recommended Actions:
- Check the
Retry-Afterheader for estimated availability - Review the system status page for maintenance announcements
- Implement retry logic with exponential backoff
- Wait before retrying the request
Response Headers:
Retry-After: Number of seconds to wait before retrying
Example:
{
"error": {
"code": "SERVICE_UNAVAILABLE",
"message": "Service temporarily unavailable",
"details": "The service is undergoing scheduled maintenance. Expected to be back in 30 minutes.",
"requestId": "req_stu901",
"timestamp": "2024-02-07T12:34:56.789Z"
}
}
Best Practices for Error Handling
- Always check the HTTP status code before processing the response body
- Log error responses including the
requestIdfor debugging - Implement retry logic for 429, 500, and 503 errors with exponential backoff
- Handle rate limiting gracefully by respecting the
Retry-Afterheader - Validate your requests before sending to avoid 400 errors
- Monitor your API usage to prevent hitting rate limits
- Keep your authentication credentials secure and up-to-date
Quick Reference Table
| Status Code | Error Code | Title | Retryable |
|---|---|---|---|
| 400 | BAD_REQUEST | Invalid Request | No |
| 401 | UNAUTHORIZED | Authentication Failed | No |
| 402 | PAYMENT_REQUIRED | Payment Required | No |
| 404 | NOT_FOUND | Resource Not Found | No |
| 429 | TOO_MANY_REQUESTS | Rate Limit Exceeded | Yes |
| 500 | INTERNAL_SERVER_ERROR | Server Error | Yes |
| 503 | SERVICE_UNAVAILABLE | Service Unavailable | Yes |