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

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

### HTTP status codes {#http-status-codes}

| HTTP Status code |    Description     |
|------------------|--------------------|
| 200              | OK                 |
| 400              | BAD REQUEST        |
| 401              | UNAUTHORIZED       |
| 403              | FORBIDDEN          |
| 429              | RESOURCE EXHAUSTED |
| 404              | NOT FOUND          |

### API gateway errors (API access errors) {#api-gateway-errors-api-access-errors}

Each API request goes through the API gateway to communicate with any API. Here are the [error codes](https://developer.mastercard.com/platform/documentation/gateway-error-codes/) that the API gateway could return.

### Application level / business logic errors {#application-level--business-logic-errors}

If the API is successfully accessed via the API Gateway, the service itself may generate errors
if something is wrong with the information presented in the request.

In this situation an error response body will be returned by the service as the response to the
API call, giving more detail about what caused the problem.

The errors object contains a list of error objects which has a description, details, a reason code, a source and the recoverable attribute.

```json
{
   "Errors":{
      "Error":[
         {
            "Description":"Missing Required Field(s)",
            "Details":"Detailed error description",
            "ReasonCode":"REASON_CODE",
            "Source":"Error source",
            "Recoverable":true
         }
      ]
   }
}
```

* Source: The application that generated this error.
* ReasonCode: a unique constant identifying the error case encountered during transaction processing. For example, `INVALID_FIELD` is used when the a field has a invalid value in the request
* Description: Description of the `ReasonCode` field with additional details
* Details: : Details of where the error happened. For Example, UserId field is not valid
* Recoverable: Indicates whether this error will always be returned for this request, or 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.

The following table shows the Reason code, description and corresponding HTTP Status.

|       Reason Code        | HTTP Status |                    Description                    |                                                                              Resolution                                                                               |
|--------------------------|-------------|---------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| NOT_FOUND                | 400         | Not found                                         | Request was sent to an invalid resource                                                                                                                               |
| MISSING_REQ_FIELD_GW     | 400         | Missing Required Field(s )- {field name}.         | One or more attribute values in the request did not conform to the required pattern. Make sure all attributes match the pattern defined in the API Reference section. |
| INVALID_FIELD            | 400         | The field specified is invalid                    | One or more attribute values in the request did not conform to the required pattern. Make sure all attributes match the pattern defined in the API Reference section. |
| UNSUPPORTED_CONTENT_TYPE | 415         | The request Content-Type {type} is not supported. | request content type conform to the required pattern. Make sure all attributes match the pattern defined in the API Reference section.                                |
| CLAIM_NOT_FOUND          | 400         | Invalid claim number or Claim not found           | Make sure the request has valid claim number                                                                                                                          |
| CLAIM_STATUS_CHK_ERR     | 400         | Error while checking claim status                 | Make sure the request has valid claim number                                                                                                                          |
| UNAUTHORIZED             | 401         | Missing or invalid authentication token.          | Make sure the request has valid authentication token                                                                                                                  |
| FORBIDDEN                | 403         | This operation is not authorized                  | Make sure the operation that you are trying to perform is defined in the API reference section.                                                                       |
| NOT FOUND                | 404         | Resource not found                                | Request was sent to an invalid resource                                                                                                                               |

