Click Airtime

Error Codes

Complete reference of V2 API error codes and their meanings.

Error Codes

All V2 API errors follow a consistent format with machine-readable error codes.

Error Response Format

{
  "success": false,
  "error": {
    "code": "ERROR_CODE",
    "message": "Human-readable description of the error.",
    "details": {}
  },
  "meta": {
    "request_id": "req_a1b2c3d4e5f6",
    "timestamp": "2026-10-13T13:20:17.271Z"
  }
}

error.details is included only for some errors (for example WALLET_TYPE_UNAVAILABLE) and may be omitted.

Authentication Errors

CodeHTTP StatusDescription
INVALID_API_KEY401API key is missing, malformed, or not recognized
EXPIRED_API_KEY401API key has passed the expiry date set when it was created in the Enterprise Portal
REVOKED_API_KEY401API key has been revoked from the Enterprise Portal
IP_NOT_ALLOWED403Request originated from an IP not in the key's allowlist
INSUFFICIENT_PERMISSIONS403API key lacks the required permission for this endpoint

Validation Errors

CodeHTTP StatusDescription
INVALID_REQUEST400The request is malformed: a header or query parameter is invalid (e.g. Idempotency-Key is empty or longer than 255 characters; page/per_page is not a positive integer; status is not pending, processing, completed, or failed; from/to is not a valid ISO 8601 date), or a top-up sent both amount and product_id
INVALID_PHONE_NUMBER400Phone number is missing or not in E.164 format (+ followed by digits)
MISSING_REQUIRED_FIELD400A required field is missing — e.g. a top-up sent neither amount nor product_id, or a catalog lookup sent neither phone_number nor network_id
INVALID_AMOUNT400The custom amount cannot be sent: amount.value is not a positive number or is outside the network's custom_airtime.min_amount_local..max_amount_local; amount.currency is not the network's custom_airtime.local_currency; or the network does not offer custom amounts (custom_airtime.available: false — send a product_id instead)
INVALID_PRODUCT400product_id is not an integer id from fixed_bundles for this network — e.g. a string, an unknown or inactive id, a bundle from another network, or an open-range product

Network Errors

CodeHTTP StatusDescription
NETWORK_NOT_FOUND404The specified network ID does not exist
UNSUPPORTED_NETWORK400This network is not currently available for top-ups
HLR_LOOKUP_FAILED400Network auto-detection failed. Try specifying network_id manually

Wallet Errors

CodeHTTP StatusDescription
WALLET_NOT_FOUND404GET /v2/balance/:wallet_id was called with a wallet ID that does not exist or does not belong to your company
WALLET_RESTRICTED400The selected wallet's geography rules forbid this destination (e.g. a ZMW wallet cannot pay for a Malawi top-up). Use your USD global wallet, or a wallet whose currency matches the destination country.
WALLET_TYPE_UNAVAILABLE400You requested wallet_mode: "global" but your company has no USD wallet, or wallet_mode: "local" and your company has no local-currency wallet for the destination country.

Transaction Errors

CodeHTTP StatusDescription
TRANSACTION_NOT_FOUND404No transaction found with the given ID
INSUFFICIENT_BALANCE400Wallet balance is too low for this transaction
DUPLICATE_REQUEST409The same top-up is still being processed — a request with the same Idempotency-Key (or, without a key, the same body within 5 minutes) has not finished yet. Nothing is sent twice. Wait a few seconds and retry with the same key, or check GET /v2/topups?reference=....
DELIVERY_FAILED500The operator did not deliver the top-up. The transaction is recorded with status failed.

Duplicates are not an error. Repeating a POST /v2/topups with the same Idempotency-Key within 24 hours returns the original transaction (same id) instead of creating a new one, and your wallet is not charged again. See Send Airtime.

Rate Limiting

CodeHTTP StatusDescription
RATE_LIMIT_EXCEEDED429Too many requests for this API key. Wait the number of seconds in the Retry-After response header, then retry. See Rate Limits.

System Errors

CodeHTTP StatusDescription
INTERNAL_ERROR500Unexpected server error. Contact support if it persists.

Always check the error.code field programmatically rather than parsing the message string, as messages may change.

Handling Errors

const response = await fetch('https://api.clickairtime.com/v2/topups', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer ce_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ /* ... */ }),
});

const result = await response.json();

if (!result.success) {
  switch (result.error.code) {
    case 'INSUFFICIENT_BALANCE':
      // Prompt user to fund wallet
      break;
    case 'INVALID_PHONE_NUMBER':
      // Ask user to re-enter phone number
      break;
    case 'RATE_LIMIT_EXCEEDED':
      // Wait for the Retry-After header (seconds), then retry
      break;
    default:
      // Log error for debugging
      console.error('API Error:', result.error);
  }
}