# Code and Formats
source: https://developer.mastercard.com/benefit-allocation-service-mtls/documentation/code-and-formats/index.md

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

| **HTTP Status Code** |    **Response**    |                              **Description**                              |
|----------------------|--------------------|---------------------------------------------------------------------------|
| 200                  | OK                 | Everything worked as expected.                                            |
| 204                  | NO CONTENT         | The server successfully executed the method but returns no response body. |
| 400                  | BAD REQUEST        | The request was unacceptable, often due to missing a required parameter.  |
| 401                  | UNAUTHORIZED       | A client with with its clientId does not have access.                     |
| 403                  | FORBIDDEN          | The API key doesn't have permissions to perform the request.              |
| 404                  | RESOURCE NOT FOUND | The requested resource doesn't exist.                                     |
| 405                  | METHOD NOT ALLOWED | The server does not implement the requested HTTP method.                  |

## Error Codes {#error-codes}

Mastercard returns errors in the following structure.

```json
{
  "Errors": {
    "Error": [
      {
        "Source": "Benefits Personalization",
        "ReasonCode": "43",
        "Description": "Card has no segment assigned / Card has no available account",
        "Recoverable": false
      }
    ]
  }
}
```

### Service Error Codes {#service-error-codes}

Error codes specific to Benefit Allocation Service API are listed below.

| **Error or Reason Code** |                                                 **Description**                                                 |                                                        **How to Resolve**                                                        |
|--------------------------|-----------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------|
| 7                        | The account range associated to the PAN is invalid for the ICA.                                                 | Provide a valid PAN associated to ICA                                                                                            |
| 8                        | Segment is not eligible for ICA listed                                                                          | Provide Valid segment associated to ICA                                                                                          |
| 9                        | The effective date of set assignment for the PAN is outside the valid date range of the segment effective date. | Provide valid effective date                                                                                                     |
| 12                       | Cardholder can only have one active segment.                                                                    | PAN has an active segment, to change segment please cancel the active segment and assign a new one or replace the active segment |
| 37                       | Required field missing, Card Number.                                                                            | Provide a card number                                                                                                            |
| 39                       | Required field missing, Segment Code.                                                                           | Provide Segment Code                                                                                                             |
| 40                       | Required field missing, Effective Date.                                                                         | Provide Effective Date                                                                                                           |
| 43                       | Card has no segment assigned / Card has no available account                                                    | Enter a valid Card Number and segment                                                                                            |
| 45                       | No fixed bundle found for ICA and segment code                                                                  | Enter a valid Segment Code associated to the ICA                                                                                 |
| 46                       | New PAN is already in use.                                                                                      | Enter a valid destination PAN on replace                                                                                         |
| 47                       | Required field missing, New Pan.                                                                                | Enter a valid destination PAN for replace                                                                                        |
| 48                       | Expiry date can not be before effective date.                                                                   | Enter a valid expiry date which is after the effective date                                                                      |
| 49                       | Required field missing, Expiry Date.                                                                            | Provide a Expiry Date                                                                                                            |
| 50                       | Required field missing, Api key.                                                                                | Provide API Key                                                                                                                  |
| 51                       | Not authorized to allocate benefits for given card number                                                       | Provide Valid API Key which is authorized for the card                                                                           |
| 52                       | Only one segment is allowed                                                                                     | Enter only one segment in the input request                                                                                      |
| 54                       | Invalid format on field:                                                                                        | Fix the format of the mentioned field                                                                                            |
| 55                       | Required field missing, Is Frozen                                                                               | Provide the boolean for Is Frozen                                                                                                |
| 57                       | Invalid encryption key used. Please re-try with the correct key                                                 | Provide a valid encryption key                                                                                                   |
| 58                       | Signature verification failed                                                                                   |                                                                                                                                  |
| 59                       | Invalid signing key used. Please re-try with the correct key                                                    | Provide a valid signing key                                                                                                      |

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

In addition to service error codes, error codes can also be returned by Mastercard's gateway, which is used to verify your request's signature, and route it to the correct location.

You can find a list of the errors returned by our Gateway, as well as resolutions to each errors, on [Gateway Error Codes](https://developer.mastercard.com/platform/documentation/security-and-authentication/gateway-error-codes/).
