Error Codes
Every API Express error returns a structured JSON response with a specific error code and human-readable message. This reference helps you handle every failure type gracefully.
Overview
API Express uses standard HTTP status codes combined with specific error codes in the response body. The HTTP status tells you the category (client error, server error). The error code tells you exactly what happened.
All errors return a consistent JSON structure — same format across all 10 APIs. This means you can write one error handler that works for every endpoint.
"status": "success" field. Error responses return 4xx or 5xx codes with "status": "error".Error Response Format
Every error response follows this structure:
{
"status": "error",
"code": "INVALID_API_KEY",
"message": "The API key provided is invalid or has been revoked.",
"http_status": 401,
"request_id": "req_1a2b3c4d5e6f",
"timestamp": "2026-10-05T10:30:42Z"
}
Field descriptions
| Field | Type | Description |
|---|---|---|
status | string | Always "error" for error responses |
code | string | Machine-readable error code (see reference below) |
message | string | Human-readable description of the error |
http_status | integer | HTTP status code (matches response header) |
request_id | string | Unique ID for this request — quote it when contacting support |
timestamp | string | ISO 8601 timestamp of when the error occurred |
field | string | (Optional) The specific input field that caused the error |
details | object | (Optional) Additional context for specific error types |
HTTP Status Codes
API Express uses the following HTTP status codes. Understanding the categories helps you build correct retry and error-handling logic.
| Status | Category | Meaning | Retry? |
|---|---|---|---|
| 200 | Success | Request completed successfully | No |
| 201 | Success | Resource created (e.g., async job queued) | No |
| 400 | Client error | Bad request — invalid parameters | No (fix input) |
| 401 | Client error | Unauthorized — invalid or missing API key | No (fix auth) |
| 403 | Client error | Forbidden — valid key, insufficient permission | No |
| 404 | Client error | Not found — resource doesn't exist | No |
| 422 | Client error | Unprocessable — input valid but semantically wrong | No (fix input) |
| 429 | Client error | Rate limit exceeded | Yes (after delay) |
| 500 | Server error | Internal error on our side | Yes |
| 502 | Server error | Upstream provider error | Yes |
| 503 | Server error | Service temporarily unavailable | Yes (with backoff) |
| 504 | Server error | Gateway timeout | Yes (with backoff) |
Error Code Reference
Below is the complete list of error codes returned by API Express, grouped by HTTP status.
Authentication errors (401)
| Code | Message | Cause |
|---|---|---|
MISSING_API_KEY | No API key provided | Authorization header missing |
INVALID_API_KEY | API key is invalid | Key doesn't exist or malformed |
REVOKED_API_KEY | API key has been revoked | Key was deleted in dashboard |
EXPIRED_API_KEY | API key has expired | Key past its expiration date |
Authorization errors (403)
| Code | Message | Cause |
|---|---|---|
IP_NOT_WHITELISTED | IP address not allowed | Request from non-whitelisted IP |
API_NOT_AVAILABLE | API not available on your plan | Upgrade to access this API |
QUOTA_EXCEEDED | Monthly quota exceeded | Upgrade or wait for reset |
Validation errors (400)
| Code | Message | Cause |
|---|---|---|
MISSING_PARAMETER | Required parameter missing | A required field wasn't sent |
INVALID_PARAMETER | Invalid parameter format | Wrong type or format |
INVALID_MOBILE | Invalid mobile number | Not a valid 10-digit Indian number |
INVALID_PAN | Invalid PAN format | Doesn't match PAN pattern |
INVALID_AADHAAR | Invalid Aadhaar number | Not a valid 12-digit Aadhaar |
INVALID_IFSC | Invalid IFSC code | Not a valid IFSC format |
INVALID_RC_NUMBER | Invalid RC number | Not a valid Indian RC format |
INVALID_PINCODE | Invalid pin code | Not a valid 6-digit pin code |
INVALID_CITY | Unknown city | City not found in our database |
Not found (404)
| Code | Message | Cause |
|---|---|---|
NOT_FOUND | Resource not found | Requested record doesn't exist |
NO_DATA | No data available | Valid query, but no results (e.g., no fuel data for city) |
TRANSACTION_NOT_FOUND | Transaction not found | Requested transaction ID doesn't exist |
Business logic errors (422)
| Code | Message | Cause |
|---|---|---|
VERIFICATION_FAILED | Verification failed | Document exists but doesn't match |
NAME_MISMATCH | Name doesn't match records | Provided name doesn't match document |
ACCOUNT_INACTIVE | Account is inactive | Bank account is frozen or closed |
RECHARGE_FAILED | Recharge failed | Operator network declined the transaction |
DUPLICATE_REQUEST | Duplicate request | Same reference ID used within 24 hours |
Rate limiting (429)
| Code | Message | Cause |
|---|---|---|
RATE_LIMIT_EXCEEDED | Too many requests | Exceeded requests-per-second limit |
DAILY_LIMIT_EXCEEDED | Daily limit reached | Exceeded daily quota |
BULK_LIMIT_EXCEEDED | Bulk batch too large | More than 10,000 records in a batch |
Server errors (5xx)
| Code | Message | Cause |
|---|---|---|
INTERNAL_ERROR | Internal server error | Unexpected error on our end |
UPSTREAM_ERROR | Upstream provider error | Source database returned an error |
SERVICE_UNAVAILABLE | Service temporarily unavailable | Maintenance or overload |
TIMEOUT | Request timed out | Upstream took too long to respond |
Recommended Handling
Handle errors by category, not by individual error code. This keeps your code clean and future-proof.
Node.js example
const res = await fetch(url, { headers });
const data = await res.json();
if (res.ok) {
// Success — process data
return data;
}
// Handle errors by HTTP status category
switch (res.status) {
case 401:
// Authentication problem — check API key
console.error('Auth error:', data.code);
throw new Error('Invalid API key');
case 400:
case 422:
// Input problem — fix the request, don't retry
console.error('Validation error:', data.field, data.message);
throw new Error('Invalid input');
case 429:
// Rate limit — wait and retry
const retryAfter = res.headers.get('Retry-After') || 60;
await sleep(retryAfter * 1000);
return retryRequest();
case 500:
case 502:
case 503:
case 504:
// Server error — retry with backoff
return retryWithBackoff();
default:
throw new Error(`Unexpected error: ${data.code}`);
}
Python example
import time
import requests
def make_request(url, headers, max_retries=3):
for attempt in range(max_retries):
res = requests.get(url, headers=headers)
data = res.json()
if res.ok:
return data
# Don't retry client errors (except 429)
if 400 <= res.status_code < 500 and res.status_code != 429:
raise Exception(f"Client error: {data['code']}")
# Retry 429 and 5xx with backoff
wait = (2 ** attempt) + (random.random() * 0.5)
time.sleep(wait)
raise Exception("Max retries exceeded")
Retry Logic
Retry logic is essential for production reliability. Use exponential backoff with jitter for all retryable errors.
What to retry
| Status | Action | Max retries |
|---|---|---|
429 | Wait for Retry-After header, then retry | 3 |
500, 502, 503, 504 | Exponential backoff with jitter | 3-5 |
400, 401, 403, 404, 422 | Don't retry — fix the request | 0 |
Exponential backoff formula
Standard backoff with jitter:
delay = min(base_delay * 2^attempt + random_jitter, max_delay)
# Example with base_delay = 1s, max_delay = 30s:
# Attempt 1: ~1-2 seconds
# Attempt 2: ~2-3 seconds
# Attempt 3: ~4-5 seconds
# Attempt 4: ~8-10 seconds
# Attempt 5: ~16-20 seconds
ref_id with every request. If a retry hits our server twice, we'll return the original result instead of processing twice.request_id. Include it when contacting support — it lets us trace the exact request in our logs.Related Documentation
- Authentication — Handle 401 authentication errors
- Rate Limits — Understand 429 rate limiting
- Webhooks — Get notified of async failures
- Sandbox Testing — Test error handling without charges
Stuck on an Error? Our Team Responds in Under 4 Hours
Share your request ID and error code — our engineers will help you debug it. No support queue, no chatbots, real humans.