# Code and Formats
source: https://developer.mastercard.com/mdes-token-connect/documentation/code-and-formats/index.md

## Error Codes {#error-codes}

All APIs return an HTTP response code of 200 if the call was successfully received and accepted for processing by MDES.
For [Get Eligible Token Requestors](https://developer.mastercard.com/mdes-token-connect/documentation/api-reference/index.md) and [Push Multiple Accounts](https://developer.mastercard.com/mdes-token-connect/documentation/api-reference/index.md) APIs, any errors that subsequently occur during processing are returned in the response payload as below:

|        Reason Code         |               Reason Description               |                                           Reason Circumstances                                           |                                                                                       Resolution Step                                                                                       |
|----------------------------|------------------------------------------------|----------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `ACCOUNT_INELIGIBLE`       | The card or financial account is not eligible. | The card or financial account does not have an associated account range in MDES.                         | Please enable associated account range in MDES and then retry                                                                                                                               |
| `AUTHORIZATION_FAILED`     | Authorization failed.                          | The client could not be authorized to perform the requested action.                                      | Please use correct keys and complete onboarding on MDES (if not) for respective environment                                                                                                 |
| `CRYPTOGRAPHY_ERROR`       | Cryptography Error                             | There was an error decrypting the encrypted payload.                                                     | Please make sure you are using correct keys and passing correct fingerprint                                                                                                                 |
| `INTERNAL_SERVICE_FAILURE` | The system had an internal exception           | System had an internal exception.                                                                        | Please retry after some time, if error persists please contact MDES support team                                                                                                            |
| `INVALID_ARRAY_SIZE`       | Invalid Array Size - {fieldName}               | The number of items does not fall between the minimum and maximum size for the array.                    | Please limit the passing data as per field description in the [specification](https://developer.mastercard.com/mdes-token-connect/documentation/api-reference/index.md)                     |
| `INVALID_FIELD_FORMAT`     | Invalid Field Format - {fieldName}             | The field is not in the correct format. For instance, it should be a number but is a string.             | Please pass field in correct format as per field description in the [specification](https://developer.mastercard.com/mdes-token-connect/documentation/api-reference/index.md)               |
| `INVALID_FIELD_LENGTH`     | Invalid Field Length - {fieldName}             | The value does not fall between the minimum and maximum length for the field.                            | Please pass field value that has valid length as per the field description in the [specification](https://developer.mastercard.com/mdes-token-connect/documentation/api-reference/index.md) |
| `INVALID_FIELD_VALUE`      | Invalid Field Value - {fieldName}              | The value is not allowed for the field.                                                                  | Please pass the correct field value as per the field description in the [specification](https://developer.mastercard.com/mdes-token-connect/documentation/api-reference/index.md)           |
| `INVALID_JSON`             | Invalid JSON                                   | The JSON could not be parsed.                                                                            | Please correct JSON structure and retry                                                                                                                                                     |
| `INVALID_PAN`              | Invalid PAN                                    | The PAN format is not valid, or other data associated with the PAN was incorrect or entered incorrectly. | Please use correct PAN value and other associated data with it.                                                                                                                             |
| `MISSING_EXPIRY_DATE`      | Missing Expiry Date                            | The expiry date is required for this product but was missing.                                            | Retry the request supplying the expiry date for this card.                                                                                                                                  |
| `MISSING_REQUIRED_FIELD`   | Missing Required Field - {fieldName}           | A required field is missing.                                                                             | Retry the request supplying the required field.                                                                                                                                             |

## HTTP Statuses {#http-statuses}

The client must handle any standard HTTP response code that could result from a web service call. The common HTTP status codes are used in the response header to indicate success or failure, including, but not limited to the following:

|         HTTP Status         |                                                           Detail                                                            |
|-----------------------------|-----------------------------------------------------------------------------------------------------------------------------|
| 200 - OK                    | Request succeeded and processed OK                                                                                          |
| 401 - Unauthorized          | Authentication is required and has failed or has not yet been provided                                                      |
| 403 - Forbidden             | The request was valid, but the server is refusing action. The user might not have the necessary permissions for a resource. |
| 404 - Not Found             | The requested resource could not be found                                                                                   |
| 500 - Internal Server Error | An unexpected condition has occurred on the Mastercard server                                                               |
| 503 - Service Unavailable   | The server is currently unavailable                                                                                         |

## Gateway Error Codes {#gateway-error-codes}

Under certain conditions, you may receive errors from our API gateway. See: [Gateway Error Codes](https://developer.mastercard.com/platform/documentation/security-and-authentication/gateway-error-codes/).
