# Codes and Formats
source: https://developer.mastercard.com/consent-management/documentation/codes-and-formats/index.md

## Error Codes {#error-codes}

### Error Structure {#error-structure}

Mastercard returns errors in the following structure:

```json
{
  "Errors": {
    "Error": [
      {
        "Source": "<source>",
        "ReasonCode": "<unique code>",
        "Description": "<short description of the error>",
        "Recoverable": true/false,
        "Details": "<Optional detailed description of the issue>"
      }
    ]
  }
}
```

### 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, on the following page [Gateway Error Codes](https://developer.mastercard.com/platform/documentation/security-and-authentication/gateway-error-codes/).

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

### Create Consents {#create-consents}

| Code |                  Reason Code                  |                                         Description/Resolution                                         |
|------|-----------------------------------------------|--------------------------------------------------------------------------------------------------------|
| 400  | **decrypt.error**                             | Could not find private key for given fingerprint (Public key fingerprint is missing or incorrect)      |
| 400  | **missing.param**                             | Missing required parameter `paramName`                                                                 |
| 400  | **null.value**                                | Pan must not be null                                                                                   |
| 400  | **value.non.numeric**                         | Pan must be numeric                                                                                    |
| 400  | **value.less.than.minlength**                 | Pan too short (Minimum length of pan should be 16 digits)                                              |
| 400  | **value.greater.than.maxlength**              | Pan too long (Maximum length of pan should be 19 digits)                                               |
| 400  | **invalid.card.expiry.month**                 | Invalid card expiry month                                                                              |
| 400  | **invalid.card.expiry.year**                  | Invalid card expiry year                                                                               |
| 400  | **invalid.card.expiry**                       | Invalid card expiry (For current year month should be greater than or equal to current month)          |
| 400  | **invalid.consent**                           | Unknown/Invalid consent name provided in the request.                                                  |
| 400  | **invalid.card.details**                      | Need expiry, PAN, CVC and cardholder name to perform requested authentication                          |
| 400  | **card.not.supported**                        | Card is not supported(3DS). (The card issuer does not support 3D Secure authentication for this card.) |
| 400  | **asi.failed**                                | ASI check failed with response code `ResponseCode`.                                                    |
| 400  | **card.blocked**                              | Issuer has blocked this card                                                                           |
| 400  | **invalid.consent.details**                   | * Consent details must be a map of string-\>string * Could not convert details to json string          |
| 400  | **missing.required.parameters**               | Missing required parameter /parameters `required details`                                              |
| 400  | **invalid.required.parameters.value**         | Missing/blank required detail parameter `requiredParam`                                                |
| 400  | **invalid.consent.detail.value**              | `Detail Name` invalid value                                                                            |
| 400  | **blocked.card**                              | Blocked card                                                                                           |
| 400  | **card.in.blocked.ica**                       | Issuer not supported                                                                                   |
| 400  | **card.consumer.type.funding.source.blocked** | Card Type not supported                                                                                |
| 400  | **missing.account.range.configs**             | There is no account range configurations                                                               |
| 400  | **pan.not.within.any.account.range**          | PAN is not within any account range                                                                    |
| 400  | **duration.too.short**                        | Consent Duration Days must be \> 0                                                                     |
| 400  | **duration.too.long**                         | Consent Duration Days too big                                                                          |
| 400  | **card.smart.data.enabled**                   | Cannot enrol smart data enabled card                                                                   |
| 400  | **card.country.blocked**                      | Country not supported                                                                                  |
| 403  | **not.enabled**                               | Client is not enabled                                                                                  |
| 403  | **invalid.merchant**                          | Consent for this merchant is not allowed                                                               |
| 403  | **card.disabled**                             | Card is disabled                                                                                       |
| 404  | **unknown.legal.doc**                         | Unknown legal document name                                                                            |

| Code |      Reason Code       |          Description/Resolution          |
|------|------------------------|------------------------------------------|
| 400  | **no.auth.session**    | No auth session found for card Reference |
| 400  | **invalid.auth.state** | Authentication state error               |
| 400  | **invalid.status**     | Invalid 3DS fingerprint status           |

| Code |      Reason Code       |          Description/Resolution          |
|------|------------------------|------------------------------------------|
| 400  | **no.auth.session**    | No auth session found for card Reference |
| 400  | **invalid.auth.state** | Authentication state error               |

### Manage Consents {#manage-consents}

| Code |   Reason Code    |                Description/Resolution                 |
|------|------------------|-------------------------------------------------------|
| 404  | **unknown.card** | Unknown card (Caller does not own this cardReference) |

| Code |   Reason Code    |                Description/Resolution                 |
|------|------------------|-------------------------------------------------------|
| 404  | **unknown.card** | Unknown card (Caller does not own this cardReference) |

| Code |     Reason Code     |        Description/Resolution         |
|------|---------------------|---------------------------------------|
| 404  | **unknown.consent** | Unknown consent OR Invalid consent id |

### Bulk Consents {#bulk-consents}

| Code |              Reason Code              |                                                               Description/Resolution                                                                |
|------|---------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------|
| 400  | **pan.not.in.permitted.ranges**       | One or more cards are not in permitted ranges for bulk add                                                                                          |
| 400  | **invalid.cards.value**               | Cards should not be null                                                                                                                            |
| 400  | **unknown.consent.name**              | Unknown consent `consentName`                                                                                                                       |
| 400  | **invalid.consent.details**           | * Consent details must be a map of string-\>string * Could not convert details to json string                                                       |
| 400  | **missing.required.parameters**       | Missing required parameter /parameters `required details`                                                                                           |
| 400  | **invalid.required.parameters.value** | Missing/blank required detail parameter `requiredParam`                                                                                             |
| 400  | **invalid.consent.detail.value**      | `Detail Name` invalid value                                                                                                                         |
| 400  | **blocked.card**                      | Blocked card                                                                                                                                        |
| 400  | **pan.non.numeric**                   | Invalid PAN (not numeric)                                                                                                                           |
| 400  | **invalid.pan**                       | PAN should not be null                                                                                                                              |
| 400  | **missing.account.range.configs**     | There is no account range configurations                                                                                                            |
| 400  | **pan.not.within.any.account.range**  | PAN is not within any account range                                                                                                                 |
| 400  | **duration.too.short**                | Consent Duration Days must be \> 0                                                                                                                  |
| 400  | **duration.too.long**                 | Consent Duration Days too big                                                                                                                       |
| 400  | **invalid.consents.value**            | Consents should not be null or empty                                                                                                                |
| 403  | **not.allowed**                       | Not set up for bulk add API (contact [transaction.notifications@mastercard.com](mailto:transaction.notifications@mastercard.com) to request access) |
| 403  | **invalid.merchant**                  | Consent for this merchant is not allowed                                                                                                            |
| 403  | **card.disabled**                     | Card is disabled                                                                                                                                    |

| Code |     Reason Code     | Description/Resolution |
|------|---------------------|------------------------|
| 404  | **unknown.consent** | Consent not found      |

