Error Codes

Learn about the different HTTP response codes we send for successful and failed API calls.

To provide you with the best experience, we aim to successfully process all API calls. However, financial transactions involve multiple systems and an API call can fail due to external factors in these systems. API calls can also fail due to other unforeseen circumstances such as human error while providing inputs, network errors, and intermittent connectivity.

We use standard HTTP response codes to indicate a successful or failed API call. All successful API calls return a 2XX response code. You can treat any non 2XX HTTP response as a failed call.

The table below lists the various HTTP response codes we return to indicate successful or failed API calls.

HTTP Response CodeDescriptionNext Step
2XXSuccessful API call.
4XXFailed API call.

There is an error in the information provided by you. For example:
  • Invalid authorization header.
  • Invalid path, body, or query parameters.
Check and correct the information passed in the API call.
5XX (very rare)Failed API call.

Error with ZWITCH servers.

Error Parameters

To make it easier for you to identify where the error occurred and how to rectify the error, we return an error message with all non 2XX HTTP response codes.

Shown below are sample error responses for different non 2XX HTTP response codes.

{
  "error": {
    "type": "authentication_error",
    "message": "Invalid secret key."
  }
}
{
  "error": {
    "type": "invalid_request_error",
    "code": "resource_missing",
    "message": "No such account: va_onMda91dobg5YYX0kH",
    "param": "id"
  }
}
{
  "error": {
    "type": "invalid_request_error",
    "code": "parameter_missing",
    "message": "The type field must be one of vpa, account_number",
    "param": "type"
  }
}
{
  "error": {
    "type": "invalid_request_error",
    "code": "parameter_unknown",
    "message": "received unknown parameter: whitelisted_remitters",
    "param": "whitelisted_remitters"
  }
}
{
  "error": {
    "type": "internal_system_error",
    "message": "something went wrong",
    "trace_id": "bfa30905-e73b-8d86-f656-6c64ac308634"
  }
}

The below table gives a brief description of the different parameters in the error message sent with all non-2XX HTTP response codes.

ParameterTypeDescription
typestringType of the error. Possible values:
  • authentication_error: Returned for 401 errors.
  • invalid_request_error: Returned for 422 errors.
  • internal_system_error: Returned for 500 errors.
codestringThe error short code. Possible values:
  • resource_missing: The resource you are trying to access does not exist in our database.
  • parameter_missing: There is a missing mandatory parameter in the request body.
  • parameter_unknown: An unexpected parameter was sent in the request body.
messagestringError description. This parameter tells you why the error occurred.

For example, The name_of_account_holder field is required.
paramstringThe parameter where the error occurred.

For example, name_of_account_holder.
trace_idstring500 Error Only

This is a unique identifier for the API call in our database.

Share this value with our Integrations Team if you face any issues with our APIs. This helps us identify the API call, debug the call, and provide you with a resolution.

Note: This value is also present in all our responses headers as x-zwitch-trace-id.