# Code and Formats
source: https://developer.mastercard.com/priceless-specials/documentation/code-and-formats/index.md

This resource is provided to you in the event the API calls cannot be completed. The error can be for a specific service format issue, network connection, or overall message-format issue.

## Error Structure {#error-structure}

To provide a consistent experience across all Mastercard APIs, the Priceless Specials APIs follow the standard structure for each scenario that can occur.  

Mastercard returns errors in the following structure:

```json
{
   "Errors":{
      "Error":[
         {
            "Source":"<Source of the issue>",
            "ReasonCode":"<Unique code>",
            "Description":"<Description of the error>",
            "Recoverable": true/false
         }
      ]
   }
}
```

|  **Field**  |                                                                                                                                                                 **Description**                                                                                                                                                                  |
|-------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Source      | The application that generated the given error. Every error message generated and returned by the gateway will have this field equal to `Gateway`. If the field value is `priceless/specials/platform/offers`, it means that an error was generated by the Priceless Specials platform.                                                          |
| ReasonCode  | Identifies the error case encountered when any Priceless Specials API is called.                                                                                                                                                                                                                                                                 |
| Description | Description of the `ReasonCode` field with additional details.                                                                                                                                                                                                                                                                                   |
| Recoverable | Indicates whether this error will always be returned for this request or retrying can change the outcome. For example, if the request contains an invalid request parameter, retrying will never succeed. However, if the error is related to some unexpected timeout with the service, retrying the call could result in a successful response. |

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

Apart from the error codes returned by the Priceless Specials API, error codes can be returned by the Mastercard gateway, which verifies your request's signature and routes to the correct location.

For further information about 4xx/5xx response codes returned by the gateway and their possible resolutions, see [Gateway Error Codes](https://developer.mastercard.com/platform/documentation/security-and-authentication/gateway-error-codes/)

## Priceless Specials Error Codes {#priceless-specials-error-codes}

|           Reason Code           |                                                            Description                                                             | Recoverable |                                                                                                                             Tips to Resolve                                                                                                                              |
|---------------------------------|------------------------------------------------------------------------------------------------------------------------------------|-------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| INVALID_CARDCATEGORY_VALUES     | You have provided an invalid card category value.                                                                                  | False       | Check and ensure that the card category value you have provided is supported by Priceless Specials.                                                                                                                                                                      |
| INVALID_CATEGORY                | You have provided an invalid category.                                                                                             | False       | Ensure that the provided category ID is in the category list supported by Priceless Specials. Multiple category IDs may be appended together by adding a comma between them. For example, 100834, 100384, 100483.                                                        |
| INVALID_CATEGORY                | You have provided an invalid category ID.                                                                                          | False       | Ensure that the provided category ID is in the category list supported by Priceless Specials. Multiple category IDs may be appended together by adding a comma between them. For example, 201811010003, 201811010002, 201811010004.                                      |
| INVALID_COORDINATES_VALUE       | You provided an invalid coordinate format.                                                                                         | False       | Accepts a pair of longitude and latitude values and an optional radius value in meters, separated by comma. Returns offers within 500 meters radius if coordinates are provided but radius is omitted.                                                                   |
| INVALID_DATE_FORMAT             | You have provided a value that does not correspond to ISO_8601 Format.                                                             | False       | The date format must comply with ISO_8601 Format. For example, yyyyMMdd'T'HHmmssz                                                                                                                                                                                        |
| INVALID_INPUT_PARAMETER         | You provided an invalid sort of value.                                                                                             | False       | Sort Enum: alphabetical, latest, expiring soon.                                                                                                                                                                                                                          |
| INVALID_LANGUAGE                | You have provided a value that does not correspond to the BCP 47 language codes.                                                   | False       | Provide a BCP 47 language code that is in the list of language codes supported by Priceless Specials.                                                                                                                                                                    |
| INVALID_MARKET_VALUES           | You have provided a value for filtering by country, eligible, or destination markets that are not supported by Priceless Specials. | False       | Provide a country code that is in the list of country codes supported by Priceless Specials. It is recommended to provide more than one country code where possible. Multiple country codes may be appended together by adding a comma between them. For example, SG, MY |
| INVALID_MASTERCARD_PRODUCT_CODE | You have provided an invalid Mastercard product code.                                                                              | False       | Ensure that you provide only valid Mastercard product codes in the list supported by Priceless Specials. Multiple product codes may be appended together by adding a comma between them. For example, MCE, MCW                                                           |
| INVALID_MERCHANTTYPE            | You provided an invalid Merchant Type value.                                                                                       | False       | Merchant Type Enum: Single Address Merchant, Multiple Addresses Merchant Online Merchant                                                                                                                                                                                 |
| INVALID_PROGRAM                 | You have provided a value for filtering by program ID that is not supported by Priceless Specials.                                 | False       | Ensure that the provided program ID is in the program list supported by Priceless Specials. For example, 201811030002                                                                                                                                                    |
| MISSING_CLIENT_ID               | Missing value for X-OpenApi `ClientId` or X-OpenApi `transient` parameter in header.                                               | False       | Add X-OpenAPI `ClientId` or x-openAPI `transient` parameter to the header of the interface.                                                                                                                                                                              |
| PERMISSION_DENIED               | You have provided an invalid `X-OpenApi-ClientId` or `x-openapi-transid` parameter in header.                                      | False       | Check and ensure that `X-OpenApi-ClientId` or `x-openapi-transid` value you have provided is supported by Priceless Specials.                                                                                                                                            |

### Error Response Example {#error-response-example}

```json
{
    "errors": [
        {
            "source": "priceless/specials/platform/offers",
            "reasonCode": "INVALID_LANGUAGE",
            "description": "Language value is invalid, please refer to languages resources for valid values.",
            "recoverable": "false"
        }
    ]
}
```

