Skip to main content

Error Response and Handling

Error Response and Handling

Whenever any APIs give a non-successful status code (non-2xx), we can consider these cases failures. The status code responses will have the meaning as per HTTP standards. There will be error codes and error messages that will give more insights of what is the major reason for failure. This error response is common and applicable to all APIs.

Status Codes

The Success status code is given in the sample response section of each api

Status CodeMeaning
400Bad request - the request made may contain some unexpected or incorrect information
401Unauthorized - Exception during decryption or wrong API-Key in headers
403Forbidden - mainly comes if the IP is not whitelisted
404Not Found - given endpoint not available or item in the request not found
429Too many requests within a given time
5xxInternal server errors - due to some exceptions while performing relevant operations

Sample Error Response

{
"errorCode": 700,
"errorMessage": "error while decryption"
}

Error Codes

Each of the error codes will have its own meaning. This will help us to give more insights into why errors occurred.
In general,

    7xx - signifies errors related to encryption/decryption and authorization.
    8xx - signifies errors related to incorrect request
    9xx - signifies errors occurred in the recharge service

Error CodeReason
700Error while decryption
701Error while encryption of response
702Invalid API key in the header
802Invalid JSON provided
803Constraint violation - either required field empty, not found or incorrect
804Given operator/circle code is invalid
805Duplicate referenceId
806No matching records for given referenceId
807Order not created for given referenceId
900Error while connecting with the recharge server
901Exception in the recharge server
EmptyAn unknown error occurred