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

## Errors overview {#errors-overview}

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:

| Status 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.                                                |

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

For further information about the error message fields, 4xx/5xx response codes and possible resolutions, see [Gateway Error Codes](https://developer.mastercard.com/platform/documentation/errors-and-troubleshooting/gateway-error-codes/).

## Error structure {#error-structure}

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

Single Error :

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

Multiple Errors :

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

|      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. |

## Offers for Publishers API-specific errors {#offers-for-publishers-api-specific-errors}

Sample of Offers for Publishers API error object :

```json
{
    "Errors": {
        "Error": [
            {
                "ReasonCode": "400",
                "Source": "PCLO API",
                "Description": "FId is not provided or Value provided is invalid",
                "Details": "Bad Request",
                "Recoverable": true
            }
        ]
    }
}
```

The Offers for Publishers API-specific error codes are as follows:

|      Reason Code      |                             Description                              |                                                                Tip to resolve                                                                |
|-----------------------|----------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------|
| INVALID_USER_TOKEN    | Invalid User Token                                                   | The provided User Token is invalid. Please provide a valid User Token.                                                                       |
| INVALID_FID           | Invalid FID                                                          | The provided FID is invalid. Please provide a valid Financial Institution Identifier (FID).                                                  |
| INVALID_OFFER_ID      | Invalid offer ID                                                     | The provided offer ID is invalid. Please provide a valid offer ID.                                                                           |
| INVALID_ACTIVATION_ID | Invalid offer activation ID                                          | The provided offer activation ID is invalid. Please provide a valid offer activation ID.                                                     |
| SC_ACTIVATION_FAILED  | Offer activation failed. For example, the offer is already activated | Activation attempt for the offer failed. For example, if the offer is already activated, please activate an offer that is not yet activated. |
| INVALID_FEEDBACK      | Invalid feedback                                                     | The feedback provided is invalid. Please provide valid feedback.                                                                             |
| OFFER_UNAVAILABLE     | Offer no longer available                                            | The provided offer is no longer available or is invalid. Please request an available and valid offer.                                        |
| USERTOKEN_UNAVAILABLE | User Token is not available for the provided user.                   | Please make sure that the User Token is created and available for the user.                                                                  |

## Activation response status codes {#activation-response-status-codes}

The activation response status codes indicate that the activation request is either QUEUED, IN_PROGRESS, COMPLETED, or FAILED.

## Next steps {#next-steps}

Proceed to the [Support](https://developer.mastercard.com/presentment/documentation/support/index.md) section to access frequently asked questions and access technical support.
