Skip to main content

Error Codes

Overview

When an API request cannot be processed successfully, the response will contain an error code that identifies the reason for the failure.

Error codes provide a stable and machine-readable way to determine the cause of an error and implement appropriate error handling within your application.

The API provides endpoints that allow you to:

  • Retrieve information about a specific error code.
  • Retrieve the complete catalog of supported error codes.
  • Synchronize error code definitions for local caching.

Error Response Example

The following example shows a typical error response returned by the API:

{
"code": 5000001
}

The code value uniquely identifies the error that occurred.

Common Error Handling Workflow

We recommend the following workflow when handling API errors:

  1. Submit a request to the API.
  2. Check whether the response contains an error code.
  3. Look up the error code in your locally cached error code catalog.
  4. Display a user-friendly message.
  5. If the error code is not found locally, retrieve its details from the Error Codes endpoint.

Example Workflow

API Response

{
"code": 5000001
}

Error Code Details

{
"code": 5000001,
"detail": "The server was unable to complete the request.",
"status_code": InternalServerError
}

Error Code Reference

The table below contains all error codes currently supported by the API.

CodeDescriptionHTTP Status Code
4000001The request payload that has have provided is incorrect.BadRequest
4000002The header X-Unique-Id is required and must match the regular expression ^[A-Za-z0-9-._]{10,36}$.BadRequest
4000003A username must be provided and must match the regular expression ^[a-zA-Z0-9_.]{8,30}$.BadRequest
4000004The client_key property must match the regular expression ^[A-Za-z0-9_]{3,35}$.BadRequest
4000005The client_id property must match the regular expression ^[A-Za-z0-9]{32}$.BadRequest
4009900The request body that has been submitted is incorrect.BadRequest
4009901The request parameters that has been submitted is incorrect.BadRequest
4009999A 4XX error occurred on the gateway while attempted to communicate with the intended resources.BadRequest
4010001Username and/or password provided are not correct or token is invalid.Unauthorized
4010002Unauthorized Api key.Unauthorized
4019900Not authorized to submit request.Unauthorized
4030001Forbidden to access requested resource.Forbidden
4030002Forbidden to complete request due to invalid/missing configuration.Forbidden
4030003Forbidden to complete request due to violation of operation rules.Forbidden
4039900Access is denied to submit request.Forbidden
4039901Bearer authentication token provided is expired.Forbidden
4039902The header X-Api-Key is required.Forbidden
4039903Signiture provided is invalid.Forbidden
4039904Bearer authentication token is required.Forbidden
4039905Request has been filtered by WAF.Forbidden
4040001Data attempted to be retrieved does not exist.NotFound
4049900The attempted requested resource does not exist.NotFound
4090001The header X-Unique-Id provided is not unique.Conflict
4090002The request with the same data has already been processed.Conflict
4139900Requested entity is too large.RequestEntityTooLarge
4159900Media type provided is not supported.UnsupportedMediaType
4299900The quota has been exceeded.TooManyRequests
4299901Too many requests have been submitted concurrently.TooManyRequests
4220001The given data is invalid.UnprocessableEntity
4220002Customer status must be in an active state for the request to complete.UnprocessableEntity
4220003Account status must be in an active state for the request to complete.UnprocessableEntity
4220004Card status must be in an active state for the request to complete.UnprocessableEntity
4220005Request could not be processed due to missing mandatory information.UnprocessableEntity
4220006Card provided is unassigned from a customer and cannot complete the requested request.UnprocessableEntity
4220007The request could not be processed due to server being unable to match the request signature against the request body.UnprocessableEntity
4220008Cards cannot be activated until they reach status 03 (Printing).UnprocessableEntity
4224001Customer details submitted have already been submitted for another customer.UnprocessableEntity
4224002The customer has already reached the maximum number of accounts that can be correlated to it.UnprocessableEntity
4224003The customer has already reached the maximum number of cards that can be correlated to it.UnprocessableEntity
4224004The customer does not have an active account available or an active account with sufficient funds to charge a fee.UnprocessableEntity
4224005The customer is on hold due to AML checks.UnprocessableEntity
4224006The customer is rejected due to AML checks.UnprocessableEntity
4225024The yearly maximum amount of transactions will exceed the limit configured.UnprocessableEntity
4225025The monthly maximum amount of transactions will exceed the limit configured.UnprocessableEntity
4225026The weekly maximum amount of transactions will exceed the limit configured.UnprocessableEntity
4225027The daily maximum amount of transactions will exceed the limit configured.UnprocessableEntity
4225028The hourly maximum amount of transactions will exceed the limit configured.UnprocessableEntity
4225029The yearly maximum number of transactions will exceed the limit configured.UnprocessableEntity
4225031The account balance will exceed the limit configured.UnprocessableEntity
4225032The sum of the customer accounts balance will exceed the limit configured.UnprocessableEntity
4225033The lifetime maximum number of transactions will exceed the limit configured.UnprocessableEntity
4225035The monthly maximum number of transactions will exceed the limit configured.UnprocessableEntity
4225036The weekly maximum number of transactions will exceed the limit configured.UnprocessableEntity
4225037The daily maximum number of transactions will exceed the limit configured.UnprocessableEntity
4225038The hourly maximum number of transactions will exceed the limits configured.UnprocessableEntity
4225053The yearly maximum amount of transactions will exceed the limit configured.UnprocessableEntity
4225054The monthly maximum amount of transactions will exceed the limit configured.UnprocessableEntity
4225055The weekly maximum amount of transactions will exceed the limit configured.UnprocessableEntity
4225056The daily maximum amount of transactions will exceed the limit configured.UnprocessableEntity
4225057The hourly maximum amount of transactions will exceed the limit configured.UnprocessableEntity
4225058The yearly maximum number of transactions will exceed the limit configured.UnprocessableEntity
4225059The monthly maximum number of transactions will exceed the limit configured.UnprocessableEntity
4225060The weekly maximum number of transactions will exceed the limit configured.UnprocessableEntity
4225061The daily maximum number of transactions will exceed the limit configured.UnprocessableEntity
4225062The hourly maximum number of transactions will exceed the limits configured.UnprocessableEntity
4225064Account balance does not have sufficient funds to complete the request.UnprocessableEntity
4225074The transaction maximum amount will exceed the limit configured.UnprocessableEntity
4225073The transaction minimum amount has not reached the limit configured.UnprocessableEntity
4245001Request was not completed successfully due to a dependant component returned an unsuccessful response.FailedDependency
4245002Request was not completed successfully due to a dependant component returned an unsuccessful response.FailedDependency
4245003Request was not completed successfully due to a dependant component returned an unsuccessful response.FailedDependency
4245004Request was not completed successfully due to a dependant component returned an unsuccessful response.FailedDependency
4245005Request was not completed successfully due to a dependant component returned an unsuccessful response.FailedDependency
4245006Request was not completed successfully due to a dependant component returned an unsuccessful response.FailedDependency
4245007Request was not completed successfully due to a dependant component returned an unsuccessful response.FailedDependency
4245008Request was not completed successfully due to a dependant component returned an unsuccessful response.FailedDependency
4245009Request was not completed successfully due to a dependant component returned an unsuccessful response.FailedDependency
4245010Request was not completed successfully due to a dependant component returned an unsuccessful response.FailedDependency
4245011Request was not completed successfully due to a dependant component returned an unsuccessful response.FailedDependency
5000001The server was unable to complete the request.InternalServerError
5009900The server was unable to complete the request due to incorrect Api configurations.InternalServerError
5009901The server was unable to complete the request due to authorizer configuration error.InternalServerError
5009902The server was unable to complete the request due to authorizer failure.InternalServerError
5009999A 5XX error occurred on the gateway while attempted to communicate with the intended resources.InternalServerError
5030001Service is unavailable due to undergoing maintenance.ServiceUnavailable
5049900The gateway timed out while attempted to communicate with the intended resources.GatewayTimeout
5049901The gateway timed out while waiting for a response from the intended resources.GatewayTimeout

Retrieve a Specific Error Code

Use the following endpoint to retrieve detailed information about a specific error code.

Endpoint

GET /errorcodes/{code}

Documentation

https://api-docs.msledge.tech/#tag/ErrorCodes/paths/~1errorcodes~1%7Bcode%7D/get

Example Request

curl -X GET \
'https://api.msledge.tech/errorcodes/5000001' \
-H 'accept: application/json' \
-H 'X-Unique-Id: a..z' \
-H 'X-Api-Key: a..z' \
-H 'Authorization: Bearer a..z'

Example Response

{
"code": 5000001,
"detail": "The server was unable to complete the request.",
"status_code": InternalServerError
}

Retrieve All Error Codes

Use the following endpoint to retrieve the complete catalog of supported error codes.

Endpoint

GET /errorcodes

Documentation

https://api-docs.msledge.tech/#tag/ErrorCodes/paths/~1errorcodes/get

Example Request

curl -X GET \
'https://api.msledge.tech/errorcodes' \
-H 'accept: application/json' \
-H 'X-Unique-Id: a..z' \
-H 'X-Api-Key: a..z' \
-H 'Authorization: Bearer a..z'

Example Response

[
{
"code": 4000001,
"detail": "The request payload that has have provided is incorrect.",
"status_code": "BadRequest"
},
.
.
.
{
"code": 5000001,
"detail": "The server was unable to complete the request.",
"status_code": InternalServerError
}
]

The response contains a collection of all supported error codes and their associated descriptions.

Best Practices

Cache Error Codes Locally

To improve performance and reduce unnecessary API requests, applications should maintain a local cache of the error code catalog.

Recommended approach:

  1. Retrieve the complete error code catalog from the /errorcodes endpoint.
  2. Store the catalog in memory or a local database.
  3. Refresh the catalog periodically.
  4. Resolve error codes locally whenever possible.

Refresh Frequency

Error code definitions are updated infrequently, typically only a few times per month.

For most integrations, refreshing the error code catalog once every 24 hours is sufficient.

Fallback Strategy

If an error code is not found in the local cache:

  1. Retrieve the error details using the /errorcodes/{code} endpoint.
  2. Update the local cache.
  3. Continue processing using the retrieved information.

This strategy minimizes network overhead while ensuring your application remains synchronized with the latest error code definitions.