Error Response Structure

In case of an error, the response may consist of following:

FieldsPresent in Error Response [Required/Optional]DescriptionExample
statusRequiredStatus of the request.BAD_REQUEST
messageRequiredHuman readable message describing the error.Similar identification type and value found
codeOptionalError Code.400 BAD_REQUEST
errorsOptionalArray with error details.[ "Customer has already been assigned with same email id" ]

Some examples are as follows:

{
    "status": "BAD_REQUEST",
    "message": "Unable to read request body or no request body provided",
    "errors": [
        "JSON parse error: Illegal unquoted character ((CTRL-CHAR, code 13)): has to be escaped using backslash to be included in string value; nested exception is com.fasterxml.jackson.databind.JsonMappingException: Illegal unquoted character ((CTRL-CHAR, code 13)): has to be escaped using backslash to be included in string value
 at [Source: (PushbackInputStream); line: 28, column: 27] \(through reference chain: com.nium.spend.cards.customer.dto.request.CustomerDataRequestDTO[\"correspondenceCity\"])"
    ]
}
{
    "status": "BAD_REQUEST",
    "message": "Customer has already been assigned with same email id",
    "errors": [
        "Customer has already been assigned with same email id"
    ]
}

Error Codes

In case of successful API call, HTTP Status Code 200 is to be expected.

In case of an error, HTTP Status Code 4xx or 5xx range is to be expected.

Following table contains the most common error codes you may encounter:

Error CodeMeaning
400 Bad RequestThe request could not be understood by the server due to malformed syntax
401 UnauthorizedThe request requires user authentication.
403 ForbiddenThe server understood the request, but is refusing to fulfill it.
405 Method Not AllowedThe method specified in the Request-Line is not allowed for the resource identified by the Request-URI.
429 Too Many RequestsRequest counts exceed our limit. Slow down!
500 Internal Server ErrorWe had a problem with our server. Try again later.
503 Service UnavailableWe're temporarily offline for maintenance. Please try again later.