# Code and Formats
source: https://developer.mastercard.com/mastercard-benefits-and-experiences-portal/documentation/code-and-formats/index.md

## HTTP Response codes/Reason codes {#http-response-codesreason-codes}

Resource requests use HTTP response codes to provide a coarse grain indication of the result of each request. The most common expected response codes for the supported HTTP methods are as follows:

|     HTTP Response Code      |                                                                                                        Response Description                                                                                                        |
|-----------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 200 (OK)                    | The request was completed successfully.                                                                                                                                                                                            |
| 201 (CREATED)               | Successful creation occurred using a POST request. The Location header will contain a link to the newly-created resource.                                                                                                          |
| 400 (BAD REQUEST)           | General error when the request could not be fulfilled due to errors such as validation errors or missing required data.                                                                                                            |
| 401 (UNAUTHORIZED)          | Missing or invalid authentication token.                                                                                                                                                                                           |
| 403 (FORBIDDEN)             | The user is not authorized to perform the operation                                                                                                                                                                                |
| 404 (NOT FOUND)             | The requested resource was not found                                                                                                                                                                                               |
| 405 (METHOD NOT ALLOWED)    | The requested URL exists, but the requested HTTP method is not applicable.                                                                                                                                                         |
| 500 (INTERNAL SERVER ERROR) | The Priceless server encountered an unexpected condition which prevented it from fulfilling the request. Requests resulting in a 500 response code will generally include the Priceless Errors structure in the response.          |
| 5XX (SERVER ERROR)          | Errors that occur in the network infrastructure between the client and Priceless server will typically result in a response code in the 500 range. These errors will never contain the Priceless Errors structure in the response. |

## Application Error Codes {#application-error-codes}

| Code |                 Message                 |                                                                                         Description                                                                                          |
|------|-----------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 402  | API_MISSING_PARTNER_ID                  | Returned for invalid request. Ex: PartnerId missing from GET or POST Request                                                                                                                 |
| 403  | API_MISSING_PRODUCT_ID                  | Returned for invalid request. Ex: ProductId missing from GET or POST Request                                                                                                                 |
| 406  | API_MISSING_ITEMS                       | Returned for invalid request. Ex: Items object missing from estimates or orders request                                                                                                      |
| 407  | API_MISSING_CARD_HOLDER_NAME            | Returned for invalid order request. Ex: Credit card name is missing from POST Request                                                                                                        |
| 408  | API_MISSING_CARD_NUMBER                 | Returned for invalid order request. Ex: Credit card number is missing from POST Request                                                                                                      |
| 409  | API_MISSING_EXPIRATION_YEAR             | Returned for invalid order request. Ex: Credit card expiration date is missing from POST Request                                                                                             |
| 410  | API_MISSING_CARD_CCV                    | Returned for invalid order request. Ex: Credit card CCV is missing from POST Request                                                                                                         |
| 411  | API_MISSING_ORDERID                     | Returned for invalid order request. Ex: OrderId returned from estimates resource was not passed with order request                                                                           |
| 412  | API_MISSING_PAYMENT_OPTION              | Returned for invalid order request. Ex: No payment type was provided with POST Request                                                                                                       |
| 413  | API_MISSING_PAYMENT                     | Returned for invalid order request. Ex: No payment type was provided with POST Request                                                                                                       |
| 414  | API_MISSING_SHIPPING_ADDRESS            | Returned for invalid orders or estimates request. Ex: Shipping Address is missing from POST Request                                                                                          |
| 415  | API_MISSING_SHIPPING_FIRST_NAME         | Returned for invalid orders or estimates request. Ex: First Name is missing from POST Request                                                                                                |
| 416  | API_MISSING_SHIPPING_LAST_NAME          | Returned for invalid orders or estimates request. Ex: Last Name is missing from POST Request                                                                                                 |
| 417  | API_MISSING_SHIPPING_LINE1              | Returned for invalid orders or estimates request. Ex: Shipping Address Line1 is missing from POST Request                                                                                    |
| 418  | API_MISSING_SHIPPING_CITY               | Returned for invalid orders or estimates request. Ex: City is missing from POST Request                                                                                                      |
| 419  | API_MISSING_SHIPPING_STATE              | Returned for invalid orders or estimates request. Ex: Shipping Address is missing from POST Request                                                                                          |
| 420  | API_MISSING_SHIPPING_COUNTRY            | Returned for invalid orders or estimates request. Ex: Country is missing from POST Request                                                                                                   |
| 421  | API_MISSING_SHIPPING_PHONE              | Returned for invalid orders or estimates request. Ex: Phone number is missing from POST Request                                                                                              |
| 422  | API_MISSING_SHIPPING_POSTAL_CODE        | Returned for invalid orders or estimates request. Ex: Postal Code is missing from POST Request                                                                                               |
| 423  | API_MISSING_BILLING_ADDRESS             | Returned for invalid orders or estimates request. Ex: Shipping Address is missing from POST Request                                                                                          |
| 424  | API_MISSING_BILLING_FIRST_NAME          | Returned for invalid orders or estimates request. Ex: First Name is missing from POST Request                                                                                                |
| 425  | API_MISSING_BILLING_LAST_NAME           | Returned for invalid orders or estimates request. Ex: Last Name is missing from POST Request                                                                                                 |
| 426  | API_MISSING_BILLING_LINE1               | Returned for invalid orders or estimates request. Ex: Shipping Address Line1 is missing from POST Request                                                                                    |
| 427  | API_MISSING_BILLING_CITY                | Returned for invalid orders or estimates request. Ex: City is missing from POST Request                                                                                                      |
| 428  | API_MISSING_BILLING_STATE               | Returned for invalid orders or estimates request. Ex: Shipping Address is missing from POST Request                                                                                          |
| 429  | API_MISSING_BILLING_COUNTRY             | Returned for invalid orders or estimates request. Ex: Country is missing from POST Request                                                                                                   |
| 430  | API_MISSING_BILLING_PHONE               | Returned for invalid orders or estimates request. Ex: Phone number is missing from POST Request                                                                                              |
| 431  | API_MISSING_BILLING_POSTAL_CODE         | Returned for invalid orders or estimates request. Ex: Postal Code is missing from POST Request                                                                                               |
| 432  | API_MISSING_EMAIL                       | Returned for invalid request. Ex: Email parameter is missing from POST Request                                                                                                               |
| 446  | API_FAILED_ESTIMATE_SHIPPING            | Shipping estimation failed. Please check shipping address and confirm it is correct                                                                                                          |
| 446  | API_MAX_QUANTITY_EXCEEDED               | Max quantity exceeded. Lower the quantity in estimates and orders requests                                                                                                                   |
| 448  | API_MISMATCH_BILLING_ADD                | Billing address provided in estimates and orders request do not match                                                                                                                        |
| 449  | API_MISMATCH_SHIPPING_ADD               | Shipping address provided in estimates and orders request do not match                                                                                                                       |
| 450  | API_SHIPPING_BILLING_RESTRICTED_PRODUCT | Cannot ship product type to shipping address provided                                                                                                                                        |
| 451  | API_UNAUTHORIZED                        | Problems with API access permissions.                                                                                                                                                        |
| 453  | API_INVALID_OR_INACIVE_PRODUCT_ID       | Invalid product requested                                                                                                                                                                    |
| 458  | API_BAD_ITEM_FORMAT                     | Returned for invalid request. Ex: Items data structure that are passed with estimates and orders requests is incorrect                                                                       |
| 459  | API_UNAUTHORIZED_SRC                    | Invalid permissions.                                                                                                                                                                         |
| 461  | API_NO_TRANSLATION_FOUND_FOR_PRODUCT_ID | Product info requested in a translation that does not exist                                                                                                                                  |
| 462  | API_REQUEST_MADE_TO_WRONG_SERVER        | Returned for api call that is sent to the wrong server. Ex: Request containing credit card info not sent to PCI compliant server                                                             |
| 463  | API_INVALID_LANGUAGE_CODE               | Language code passed with the request is invalid.                                                                                                                                            |
| 464  | API_ORDER_WITH_MIXED_LOCALES            | Order requests for items sold in different currencies must be passes as separate order requests                                                                                              |
| 465  | API_UNAUTHORIZED_WEBVIEW_CHECKOUT_ONLY  | Invalid permissions.                                                                                                                                                                         |
| 466  | API_INVALID_EMAIL                       | An invalid email address was provided in one of the fields/parameters of the request                                                                                                         |
| 467  | API_INVALID_ACCESS_CODE                 | Returned for invalid request. Ex: Access code that was provided is not valid                                                                                                                 |
| 470  | API_INVALID_SESSION_COOKIE              | Session Cookie is invalid or expired. Must request new cookie via the sessions resource                                                                                                      |
| 471  | API_MISSING_USER_LATITUDE               | Latitude information is missing in the request                                                                                                                                               |
| 472  | API_MISSING_USER_LONGITUDE              | Longitude information is missing in the request                                                                                                                                              |
| 473  | API_INVALID_USER_LATITUDE               | An invalid latitude data was provided in the request                                                                                                                                         |
| 474  | API_INVALID_USER_LONGITUDE              | An invalid longitude data was provided in the request                                                                                                                                        |
| 475  | API_INVALID_RADIUS                      | Invalid radius data provided in the request. Radius must be 0 to 999.                                                                                                                        |
| 480  | API_FAILED_SAVE_USER                    | Issue creating new user account                                                                                                                                                              |
| 481  | API_OUT_OF_INVENTORY_PROCESS            | Requested item is out of stock                                                                                                                                                               |
| 488  | API_FAILED_PERSIST_API_ORDER            | Order placement failed. Please try again later                                                                                                                                               |
| 489  | API_NO_PRODUCT_FOUND                    | Invalid productId provided                                                                                                                                                                   |
| 491  | API_FAILED_PROCESS_ESTIMATE             | Estimate request failed. Check post request and try again later                                                                                                                              |
| 492  | API_EXPIRED_ESTIMATION                  | OrderId from estimates request has expired. Please call estimates endpoint to refresh orderId.                                                                                               |
| 493  | API_ORDER_NOT_FOUND                     | Invalid orderId provided                                                                                                                                                                     |
| 497  | API_FAILED_TO_GENERATE_ORDER            | Order placement failed. Please try again later                                                                                                                                               |
| 500  | API_SERVER_ERROR                        | General server error. Please try again later                                                                                                                                                 |
| 503  | API_MISSING_EXPIRATION_MONTH            | Returned for invalid order request. Ex: Credit card expiration month is missing from POST Request                                                                                            |
| 552  | API_MISSING_OR_INVALID_REQUIRED_FIELDS  | Some or all of the required fields, such as a credit card number or an email, are missing from the POST request                                                                              |
| 568  | API_FAILED_GENERATE_SSO_TOKEN           | Unsuccessful attempt at creating an SSO access token. It can provide more clarity in the details, for example "Invalid or missing access code external identifier passed - access_code_name" |
| 570  | API_FAILED_TO_SEARCH_BENEFITS           | The request for a benefit search could not be completed. Look in the details for the exact reason, e.g. "Unsupported language - enUS"                                                        |
| 571  | API_FAILED_TO_SELECT_BENEFITS           | The request for a benefit selection could not be completed. Look in the details for the exact reason, e.g. "Invalid productIds provided"                                                     |
| 581  | API_INVALID_LANGUAGE_CODE               | The language code passed in the request is either invalid or not supported.                                                                                                                  |
| 604  | API_MISSING_PARTNER_UUID                | Partner UUID is a required field and is missing in the request.                                                                                                                              |
| 605  | API_INVALID_BIN_LENGTH                  | BIN passed in the request is not valid and it must be between 6 and 11 digits.                                                                                                               |
| 606  | API_INVALID_BIN_FORMAT                  | BIN passed in the request is not valid and it must be numeric only.                                                                                                                          |

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

For further information about the error message fields, 4xx/5xx response codes, and possible resolutions, refer to:

[OAuth 1.0a Error Codes](https://developer.mastercard.com/platform/documentation/errors-and-troubleshooting/oauth1-and-mtls-error-codes/)

[OAuth 2.0 Error Codes](https://developer.mastercard.com/platform/documentation/errors-and-troubleshooting/oauth2-error-codes/)

## Error objects in OAuth 1.0a and OAuth 2.0 {#error-objects-in-oauth-10a-and-oauth-20}

[OAuth 1.0](https://developer.mastercard.com/drafts/mastercard-benefits-and-experiences-portal/oauth2.0/documentation/code-and-formats/#oauth-10) [OAuth 2.0](https://developer.mastercard.com/drafts/mastercard-benefits-and-experiences-portal/oauth2.0/documentation/code-and-formats/#oauth-20)

#### OAuth 1.0 {#oauth-10}

Application error message

```json
{
  "Errors": {
    "Error": [
      {
        "Source": "Priceless API",
        "ReasonCode": "402",
        "Description": "API MISSING PARTNER ID",
        "Recoverable": false,
        "Details": "partnerId is a required field"
      }
    ]
  }
}
```

Error with API Gateway only, before reaching application

```json
{
  "Errors": {
    "Error": [
      {
        "Source": "Gateway",
        "ReasonCode": "DECLINED",
        "Description": "Unauthorized - Access Not Granted",
        "Recoverable": false,
        "Details": null
      }
    ]
  }
}
```

#### OAuth 2.0 {#oauth-20}

Application error message

```json
{
  "recoverable": false,
  "source": "Priceless API",
  "error_description": "API MISSING PARTNER ID",
  "details": "partnerId is a required field",
  "error": "402"
}
```

Error with API Gateway only, before reaching application

```json
{
  "error": "insufficient_scope",
  "error_description": "requested scope is not permitted"
}
```

```json
{
  "error": "access_denied",
  "error_description": "access denied"
}
```

## Error Structure {#error-structure}

4xx/5xx error response messages have one of the following formats (the `Error` array may contain multiple error items):

```json
{
   "Errors": {
     "Error": [
       {
         "Source": "<Source of the issue, e.g. Priceless API>",
         "ReasonCode": "<Unique code, e.g. 411 >",
         "Description": "<Unique code, e.g. API_MISSING_ORDERID>",
         "Recoverable": "true/false",
         "Details": "Additional details for the error message e.g. orderId missing; get orderId from /estimates"
       }
     ]
   }
 }
```

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

|      Field      |                                                                                                                                                                        Description                                                                                                                                                                         |
|-----------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **ReasonCode**  | A unique constant identifying the error case encountered during transaction processing. For example, `INVALID_SIGNATURE` is used when the request signature does not match the expected one.                                                                                                                                                               |
| **Source**      | The application that generated this error. Every error message that is generated and returned by the gateway will have this field equal to `Gateway`. When the value of the source field is something else, it means that the error was generated elsewhere.                                                                                               |
| **Description** | Short description of the `ReasonCode` field.                                                                                                                                                                                                                                                                                                               |
| **Details**     | Where appropriate, indicates detailed information about data received and calculated during request processing, to help the user with diagnosing errors.                                                                                                                                                                                                   |
| **Recoverable** | Indicates whether this error will always be returned for this request, or if retrying could change the outcome. For example, if the request contains an invalid signature, retrying will never result in a success. However, if the error is related to some unexpected timeout with the service, retrying the call could result in a successful response. |

