# Code and Formats
source: https://developer.mastercard.com/mdes-digital-card-art-service/documentation/code-and-formats/index.md

## Return Codes {#return-codes}

All APIs return an HTTP response code of 200 if the call was successfully received and accepted for processing by the service.

Any errors that subsequently occur during processing are returned in the response payload. The error message format returned will depend on which API generated the error and at what point the request failed. Error messages will be in one of two formats, depending on the type of error.

* [Application Error Messages](https://developer.mastercard.com/mdes-digital-card-art-service/documentation/code-and-formats/index.md#application-error-messages) - returned from the service application and typically occur for incorrect input or cryptography errors.
* [Gateway Error Codes](https://developer.mastercard.com/mdes-digital-card-art-service/documentation/code-and-formats/index.md#gateway-errors) - returned from the gateway and typically occur when OAUTH authentication fails.

Alert: To ensure forward compatibility, client implementations must be resilient to new elements being added to the API responses in the future.

## Application Error Messages {#application-error-messages}

|                                                                             Reason Code                                                                             |                                            Description                                             | HTTP Code |                                                         Resolution Tips                                                         |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------|-----------|---------------------------------------------------------------------------------------------------------------------------------|
| [INVALID_CARD_ART_ID](https://developer.mastercard.com/mdes-digital-card-art-service/documentation/code-and-formats/index.md#invalid_card_art_id)                   | The provided card art identifier is invalid or not recognized by the system.                       | 400       | Verify that the card art identifier provided in the request is valid.                                                           |
| [INVALID_JSON](https://developer.mastercard.com/mdes-digital-card-art-service/documentation/code-and-formats/index.md#invalid_json)                                 | The JSON could not be parsed.                                                                      | 400       | Check the message is a correctly formatted JSON and resubmit.                                                                   |
| [INVALID_FIELD_FORMAT](https://developer.mastercard.com/mdes-digital-card-art-service/documentation/code-and-formats/index.md#invalid_field_format)                 | The field is not in the correct format. For instance, it should be a number but is a string.       | 400       | Ensure the field value follows the correct format.                                                                              |
| [INVALID_FIELD_VALUE](https://developer.mastercard.com/mdes-digital-card-art-service/documentation/code-and-formats/index.md#invalid_field_value)                   | The value is not allowed for the field.                                                            | 400       | Provide the field value in allowed options.                                                                                     |
| [INVALID_FIELD_LENGTH](https://developer.mastercard.com/mdes-digital-card-art-service/documentation/code-and-formats/index.md#invalid_field_length)                 | The value does not fall between the minimum and maximum length for the field.                      | 400       | Ensure the field value meets the required minimum and maximum length constraints.                                               |
| [INVALID_ARRAY_SIZE](https://developer.mastercard.com/mdes-digital-card-art-service/documentation/code-and-formats/index.md#invalid_array_size)                     | The array in the request does not meet the expected size constraints.                              | 400       | Ensure the array in the request meets the required size constraints.                                                            |
| [MISSING_REQUIRED_FIELD](https://developer.mastercard.com/mdes-digital-card-art-service/documentation/code-and-formats/index.md#missing_required_field)             | A required field is missing.                                                                       | 400       | Include all mandatory fields in the request as specified.                                                                       |
| [AUTHORIZATION_FAILED](https://developer.mastercard.com/mdes-digital-card-art-service/documentation/code-and-formats/index.md#authorization_failed)                 | The request failed to present a valid cert to access the API.                                      | 403       | Ensure the request includes a valid certificate or authentication credentials.                                                  |
| [REQUEST_ACTION_NOT_PERFORMED](https://developer.mastercard.com/mdes-digital-card-art-service/documentation/code-and-formats/index.md#request_action_not_performed) | The requested operation could not be completed.                                                    | 403       | Unrecoverable error. Contact support team for additional details.                                                               |
| [TOKEN_REQUESTOR_NOT_ELIGIBLE](https://developer.mastercard.com/mdes-digital-card-art-service/documentation/code-and-formats/index.md#token_requestor_not_eligible) | The token requestor is not authorized or eligible to perform this operation.                       | 403       | Verify that the token requestor Id is valid and eligible for the range.                                                         |
| [CRYPTOGRAPHY_ERROR](https://developer.mastercard.com/mdes-digital-card-art-service/documentation/code-and-formats/index.md#cryptography_error)                     | A cryptographic operation failed due to invalid keys, signatures, or encryption/decryption issues. | 403       | Verify cryptographic keys, signatures, and encryption/decryption parameters to ensure they are valid and correctly implemented. |
| [DUPLICATE_REQUEST](https://developer.mastercard.com/mdes-digital-card-art-service/documentation/code-and-formats/index.md#duplicate_request)                       | The request could not be processed because it is a duplicate of a previously submitted request.    | 409       | Avoid resubmitting the same request; ensure each request is unique before sending.                                              |
| [VELOCITY_COUNT_EXCEEDED](https://developer.mastercard.com/mdes-digital-card-art-service/documentation/code-and-formats/index.md#velocity_count_exceeded)           | The request was rejected because the allowed request rate limit has been exceeded.                 | 429       | Validate if cardholder is facing issue or retry after appropriate time.                                                         |

### General Application Error format {#general-application-error-format}

All the errors that the application returns follow the same data format.

#### INVALID_CARD_ART_ID {#invalid_card_art_id}

```json
{
  "Errors": {
    "Error": [
      {
        "Source": "MASTERCARD_DIGITAL_PERSONALIZATION_SERVICE",
        "ReasonCode": "INVALID_CARD_ART_ID",
        "Description": "Invalid card art ID",
        "Recoverable": false,
        "Details": "The provided card art ID is not valid."
      }
    ]
  }
}
```

#### INVALID_JSON {#invalid_json}

```json
{
  "Errors": {
    "Error": [
      {
        "Source": "MASTERCARD_DIGITAL_PERSONALIZATION_SERVICE",
        "ReasonCode": "INVALID_JSON",
        "Description": "Invalid JSON",
        "Recoverable": false,
        "Details": "The JSON could not be parsed."
      }
    ]
  }
}
```

#### INVALID_FIELD_FORMAT {#invalid_field_format}

```json
{
  "Errors": {
    "Error": [
      {
        "Source": "MASTERCARD_DIGITAL_PERSONALIZATION_SERVICE",
        "ReasonCode": "INVALID_FIELD_FORMAT",
        "Description": "Invalid Field Format",
        "Recoverable": false,
        "Details": "The field is not in the correct format. For instance, it should be a number but is a string."
      }
    ]
  }
}
```

#### INVALID_FIELD_VALUE {#invalid_field_value}

```json
{
  "Errors": {
    "Error": [
      {
        "Source": "MASTERCARD_DIGITAL_PERSONALIZATION_SERVICE",
        "ReasonCode": "INVALID_FIELD_VALUE",
        "Description": "Invalid Field Value",
        "Recoverable": false,
        "Details": "The value is not allowed for the field."
      }
    ]
  }
}
```

#### INVALID_FIELD_LENGTH {#invalid_field_length}

```json
{
  "Errors": {
    "Error": [
      {
        "Source": "MASTERCARD_DIGITAL_PERSONALIZATION_SERVICE",
        "ReasonCode": "INVALID_FIELD_LENGTH",
        "Description": "Invalid Field Length",
        "Recoverable": false,
        "Details": "The value does not fall between the minimum and maximum length for the field."
      }
    ]
  }
}
```

#### INVALID_ARRAY_SIZE {#invalid_array_size}

```json
{
  "Errors": {
    "Error": [
      {
        "Source": "MASTERCARD_DIGITAL_PERSONALIZATION_SERVICE",
        "ReasonCode": "INVALID_ARRAY_SIZE",
        "Description": "Invalid Array Size",
        "Recoverable": false,
        "Details": "The array in the request does not meet the expected size constraints."
      }
    ]
  }
}
```

#### MISSING_REQUIRED_FIELD {#missing_required_field}

```json
{
  "Errors": {
    "Error": [
      {
        "Source": "MASTERCARD_DIGITAL_PERSONALIZATION_SERVICE",
        "ReasonCode": "MISSING_REQUIRED_FIELD",
        "Description": "Missing Required Field",
        "Recoverable": false,
        "Details": "A required field is missing."
      }
    ]
  }
}
```

#### AUTHORIZATION_FAILED {#authorization_failed}

```json
{
  "Errors": {
    "Error": [
      {
        "Source": "MASTERCARD_DIGITAL_PERSONALIZATION_SERVICE",
        "ReasonCode": "AUTHORIZATION_FAILED",
        "Description": "Authorization failed.",
        "Recoverable": false,
        "Details": "The client could not be authorized to perform the requested action."
      }
    ]
  }
}
```

#### REQUEST_ACTION_NOT_PERFORMED {#request_action_not_performed}

```json
{
  "Errors": {
    "Error": [
      {
        "Source": "MASTERCARD_DIGITAL_PERSONALIZATION_SERVICE",
        "ReasonCode": "REQUEST_ACTION_NOT_PERFORMED",
        "Description": "Could not perform action",
        "Recoverable": false,
        "Details": "Requested action can not be performed."
      }
    ]
  }
}
```

#### TOKEN_REQUESTOR_NOT_ELIGIBLE {#token_requestor_not_eligible}

```json
{
  "Errors": {
    "Error": [
      {
        "Source": "MASTERCARD_DIGITAL_PERSONALIZATION_SERVICE",
        "ReasonCode": "REQUEST_ACTION_NOT_PERFORMED",
        "Description": "Could not perform action",
        "Recoverable": false,
        "Details": "Requested action can not be performed."
      }
    ]
  }
}
```

#### CRYPTOGRAPHY_ERROR {#cryptography_error}

```json
{
  "Errors": {
    "Error": [
      {
        "Source": "MASTERCARD_DIGITAL_PERSONALIZATION_SERVICE",
        "ReasonCode": "TOKEN_REQUESTOR_NOT_ELIGIBLE",
        "Description": "Token Requestor Not Eligible",
        "Recoverable": false,
        "Details": "Request can not be performed on the provided Token Requestor"
      }
    ]
  }
}
```

#### DUPLICATE_REQUEST {#duplicate_request}

```json
{
  "Errors": {
    "Error": [
      {
        "Source": "MASTERCARD_DIGITAL_PERSONALIZATION_SERVICE",
        "ReasonCode": "DUPLICATE_REQUEST",
        "Description": "Duplicate Request",
        "Recoverable": false,
        "Details": "This operation has already been submitted and is being processed"
      }
    ]
  }
}
```

#### VELOCITY_COUNT_EXCEEDED {#velocity_count_exceeded}

```json
{
  "Errors": {
    "Error": [
      {
        "Source": "MASTERCARD_DIGITAL_PERSONALIZATION_SERVICE",
        "ReasonCode": "VELOCITY_COUNT_EXCEEDED",
        "Description": "Velocity count has been exceeded.",
        "Recoverable": false,
        "Details": "The number of card art requests for the provided PAN has exceeded the allowed limit within the defined time window"
      }
    ]
  }
}
```

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

Refer to [Gateway Error Codes](https://developer.mastercard.com/platform/documentation/security-and-authentication/gateway-error-codes/)
