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

## Error Codes {#error-codes}

The error messages returned will depend at what point the request failed. Error messages will be in one of two formats:

* [Gateway Error Codes](https://developer.mastercard.com/mastercard-developers-api/documentation/code-and-formats/index.md#gateway-errors)
* [API Error Codes](https://developer.mastercard.com/mastercard-developers-api/documentation/code-and-formats/index.md#api-error-codes)

## Gateway Errors {#gateway-errors}

When a client makes an API request, it first reaches Mastercard's API Gateway. The errors returned from the gateway typically occur when OAuth authentication fails.

For the list of errors returned by Mastercard's API Gateway, along with resolutions for each of the errors, refer to [Gateway Error Codes](https://developer.mastercard.com/platform/documentation/security-and-authentication/gateway-error-codes/).

## API Error Codes {#api-error-codes}

Assuming the client's request passes through the API gateway successfully, it then reaches the Developers API. These errors are returned from the Developers API.

### Error Structure {#error-structure}

The Developers API 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>"
      }
    ]
  }
}
```

Field explanations:

* **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 the error was generated elsewhere.
* **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.
* **Description** - Description of the `ReasonCode` field with additional details.
* **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.
* **Details** - Describes the error with additional information.

## List of Common API Errors {#list-of-common-api-errors}

Following is a list of some errors you might encounter along with tips to troubleshoot.

* [PROJECTS_MAX_EXCEEDED](https://developer.mastercard.com/mastercard-developers-api/documentation/errors/projects-max-exceeded/index.md)
* [SERVICE_NOT_FOUND](https://developer.mastercard.com/mastercard-developers-api/documentation/errors/service-not-found/index.md)
* [PROJECT_TYPE_NOT_SUPPORTED](https://developer.mastercard.com/mastercard-developers-api/documentation/errors/project-type-not-supported/index.md)
* [PROJECT_NAME_ALREADY_EXISTS](https://developer.mastercard.com/mastercard-developers-api/documentation/errors/project-name-exists/index.md)
* [PROJECT_ENVIRONMENT_EXISTS](https://developer.mastercard.com/mastercard-developers-api/documentation/errors/project-env-exists/index.md)
* [NO_ACCESS_TO_CREDENTIAL](https://developer.mastercard.com/mastercard-developers-api/documentation/errors/no-access-creds/index.md)
* [PROJECT_NOT_FOUND](https://developer.mastercard.com/mastercard-developers-api/documentation/errors/project-not-found/index.md)
* [REVOKE_ACTIVE_MASTERCARD_ENCRYPTION_CREDENTIAL_ERROR](https://developer.mastercard.com/mastercard-developers-api/documentation/errors/revoke-active-key/index.md)
* [REVOKE_LAST_CLIENT_ENCRYPTION_CREDENTIAL_ERROR](https://developer.mastercard.com/mastercard-developers-api/documentation/errors/revoke-last-encryption-key/index.md)
* [INVALID_KEY_TYPE](https://developer.mastercard.com/mastercard-developers-api/documentation/errors/invalid-key/index.md)
* [INVALID_CSR](https://developer.mastercard.com/mastercard-developers-api/documentation/errors/invalid-csr/index.md)
* [NOT_FOUND](https://developer.mastercard.com/mastercard-developers-api/documentation/errors/resource-not-found/index.md)
* [BAD_REQUEST](https://developer.mastercard.com/mastercard-developers-api/documentation/errors/bad-request/index.md)
* [INVALID_COUNTRY_CODE](https://developer.mastercard.com/mastercard-developers-api/documentation/errors/invalid-country-code/index.md)
* [INVALID_COMMERCIAL_COUNTRIES](https://developer.mastercard.com/mastercard-developers-api/documentation/errors/invalid-commercial-countries/index.md)
* [MISSING_COMMERCIAL_COUNTRIES](https://developer.mastercard.com/mastercard-developers-api/documentation/errors/missing-commercial-countries/index.md)
* [PROJECT_SERVICE_ALREADY_EXISTS](https://developer.mastercard.com/mastercard-developers-api/documentation/errors/service-already-exists/index.md)
* [NO_ACCESS_TO_PROJECT](https://developer.mastercard.com/mastercard-developers-api/documentation/errors/no-access-project/index.md)
* [MULTIPLE_SERVICES_NOT_SUPPORTED](https://developer.mastercard.com/mastercard-developers-api/documentation/errors/multiple-services-not-supported/index.md)
* [INVALID_PROJECT_STATUS](https://developer.mastercard.com/mastercard-developers-api/documentation/errors/invalid-project-status/index.md)
* [CREDENTIAL_NOT_FOUND](https://developer.mastercard.com/mastercard-developers-api/documentation/errors/cred-not-found/index.md)
* [INVALID_PROJECT_CONFIG](https://developer.mastercard.com/mastercard-developers-api/documentation/errors/invalid-project-config/index.md)
* [INVALID_CREDENTIAL_STATUS](https://developer.mastercard.com/mastercard-developers-api/documentation/errors/invalid-credential-status/index.md)
* [ACTIVATING_EXPIRED_KEY](https://developer.mastercard.com/mastercard-developers-api/documentation/errors/activating-expired-key/index.md)
