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.

💡
Success responses return HTTP 2xx codes with a "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

FieldTypeDescription
statusstringAlways "error" for error responses
codestringMachine-readable error code (see reference below)
messagestringHuman-readable description of the error
http_statusintegerHTTP status code (matches response header)
request_idstringUnique ID for this request — quote it when contacting support
timestampstringISO 8601 timestamp of when the error occurred
fieldstring(Optional) The specific input field that caused the error
detailsobject(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.

StatusCategoryMeaningRetry?
200SuccessRequest completed successfullyNo
201SuccessResource created (e.g., async job queued)No
400Client errorBad request — invalid parametersNo (fix input)
401Client errorUnauthorized — invalid or missing API keyNo (fix auth)
403Client errorForbidden — valid key, insufficient permissionNo
404Client errorNot found — resource doesn't existNo
422Client errorUnprocessable — input valid but semantically wrongNo (fix input)
429Client errorRate limit exceededYes (after delay)
500Server errorInternal error on our sideYes
502Server errorUpstream provider errorYes
503Server errorService temporarily unavailableYes (with backoff)
504Server errorGateway timeoutYes (with backoff)
⚠️
Don't retry 4xx errors (except 429). They indicate a problem with your request that won't fix itself. Always retry 5xx errors with exponential backoff.

Error Code Reference

Below is the complete list of error codes returned by API Express, grouped by HTTP status.

Authentication errors (401)

CodeMessageCause
MISSING_API_KEYNo API key providedAuthorization header missing
INVALID_API_KEYAPI key is invalidKey doesn't exist or malformed
REVOKED_API_KEYAPI key has been revokedKey was deleted in dashboard
EXPIRED_API_KEYAPI key has expiredKey past its expiration date

Authorization errors (403)

CodeMessageCause
IP_NOT_WHITELISTEDIP address not allowedRequest from non-whitelisted IP
API_NOT_AVAILABLEAPI not available on your planUpgrade to access this API
QUOTA_EXCEEDEDMonthly quota exceededUpgrade or wait for reset

Validation errors (400)

CodeMessageCause
MISSING_PARAMETERRequired parameter missingA required field wasn't sent
INVALID_PARAMETERInvalid parameter formatWrong type or format
INVALID_MOBILEInvalid mobile numberNot a valid 10-digit Indian number
INVALID_PANInvalid PAN formatDoesn't match PAN pattern
INVALID_AADHAARInvalid Aadhaar numberNot a valid 12-digit Aadhaar
INVALID_IFSCInvalid IFSC codeNot a valid IFSC format
INVALID_RC_NUMBERInvalid RC numberNot a valid Indian RC format
INVALID_PINCODEInvalid pin codeNot a valid 6-digit pin code
INVALID_CITYUnknown cityCity not found in our database

Not found (404)

CodeMessageCause
NOT_FOUNDResource not foundRequested record doesn't exist
NO_DATANo data availableValid query, but no results (e.g., no fuel data for city)
TRANSACTION_NOT_FOUNDTransaction not foundRequested transaction ID doesn't exist

Business logic errors (422)

CodeMessageCause
VERIFICATION_FAILEDVerification failedDocument exists but doesn't match
NAME_MISMATCHName doesn't match recordsProvided name doesn't match document
ACCOUNT_INACTIVEAccount is inactiveBank account is frozen or closed
RECHARGE_FAILEDRecharge failedOperator network declined the transaction
DUPLICATE_REQUESTDuplicate requestSame reference ID used within 24 hours

Rate limiting (429)

CodeMessageCause
RATE_LIMIT_EXCEEDEDToo many requestsExceeded requests-per-second limit
DAILY_LIMIT_EXCEEDEDDaily limit reachedExceeded daily quota
BULK_LIMIT_EXCEEDEDBulk batch too largeMore than 10,000 records in a batch

Server errors (5xx)

CodeMessageCause
INTERNAL_ERRORInternal server errorUnexpected error on our end
UPSTREAM_ERRORUpstream provider errorSource database returned an error
SERVICE_UNAVAILABLEService temporarily unavailableMaintenance or overload
TIMEOUTRequest timed outUpstream 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

StatusActionMax retries
429Wait for Retry-After header, then retry3
500, 502, 503, 504Exponential backoff with jitter3-5
400, 401, 403, 404, 422Don't retry — fix the request0

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
✅
Use idempotency keys for retryable write operations (like recharges). Pass a unique ref_id with every request. If a retry hits our server twice, we'll return the original result instead of processing twice.
💡
Need help debugging a specific error? Every error response includes a request_id. Include it when contacting support — it lets us trace the exact request in our logs.

Related Documentation

Need help?

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.

Real engineers Under 4 hours response Free for all plans Included with every tier