What do API error codes mean and how should I handle them?

When an API request cannot be completed, our API returns an error response. Handling errors well is what separates a reliable integration from one that confuses customers and creates support tickets. This article explains how errors are structured, the main groups of errors and how your code should respond to each.

How an error response looks

HTTP/1.1 422 Unprocessable Entity
{
  "status": "error",
  "error": {
    "code": "INVALID_AMOUNT",
    "message": "The amount is not valid for this operator.",
    "field": "amount"
  },
  "request_id": "rq_8d21f0"
}

Your code should rely on the HTTP status and the error code, not on the wording of the message, which may be improved over time. Always log the request_id; it lets our support team find the exact request.

Groups of errors by HTTP status

StatusMeaningRetry?
400 / 422Request is invalid: missing field, wrong format, value not allowedNo. Fix the input first.
401API key missing, wrong or revokedNo. Fix the key.
403Not allowed: IP not whitelisted, service not enabled, account restrictedNo. Fix the setting.
404Endpoint or record not foundNo. Check the path or ID.
409Conflict, such as a reference ID that has already been usedNo. Check the existing transaction.
429Too many requests in a short timeYes, after waiting.
500 / 502 / 503 / 504Temporary problem on our side or with a providerCheck status first, then retry carefully.

Common error codes

The full list is in the documentation. Codes you are likely to meet include:

  • INSUFFICIENT_BALANCE: your wallet cannot cover the transaction. Top up and alert your team.
  • DUPLICATE_REFERENCE: the reference ID was already used. Check that transaction's status instead of sending a new one.
  • INVALID_OPERATOR or INVALID_BILLER: the code is wrong or no longer supported. Refresh your lists.
  • SERVICE_UNAVAILABLE: an operator, biller or bank is temporarily down. Show a friendly message and suggest trying later.
  • IP_NOT_WHITELISTED: the request came from an address not on your list.
  • VALIDATION_ERROR: one or more fields are invalid. The field value tells you which.

The golden rule for money-moving requests

For recharges, bill payments and payouts, a network timeout or a 5xx error does not prove the transaction failed. The request may have reached us and be processing. Before retrying:

  1. Check the transaction status using your reference ID.
  2. If it is not found, send a new request with a new reference ID.
  3. If it exists, follow its status. Never send a second payment for the same order while the first is pending.

Showing errors to customers

Translate error codes into short, helpful messages. For example, instead of "VALIDATION_ERROR: number", show "Please enter a valid 10-digit mobile number". For errors the customer cannot fix, such as insufficient balance on your platform's wallet, show a general message like "This service is temporarily unavailable" and alert your own team instead.

Logging and monitoring

  • Log the endpoint, your reference ID, the HTTP status, the error code and the request ID.
  • Mask sensitive values, such as full account numbers.
  • Alert your team when errors of one type suddenly increase.
The examples in this article are simplified to show the flow. Field names, endpoint paths, error codes and response formats can differ by service, so always follow the current reference in our API documentation.

Still stuck?

If an error does not make sense, open a ticket with the request ID, time and endpoint. For authentication errors in particular, see our troubleshooting article on 401 and 403 responses.

Was this article helpful?

Still stuck? Open a support ticket and our team will help.


Related articles

← Back

Chat with us
Hi! Send us a message and we will reply here as soon as we can.
Security check image
Chat with us