# Code and Formats
source: https://developer.mastercard.com/bin-lookup/documentation/code-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}

| **Code** |            **Response**             |                        **Description**                         |                                                            **Resolution Steps**                                                            |
|----------|-------------------------------------|----------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------|
| 400      | `"ReasonCode": "BAD_REQUEST"`       | Not all mandatory parameters are supplied or sent incorrectly. | Refer to the structure of the body in your request for missing, mandatory, or misspelled parameters.                                       |
| 401      | `"ReasonCode": "UNAUTHORIZED"`      | Full authentication is required to access this resource.       | Check that your authentication is correctly configured for the environment you are using. Reach out to API Support if you need assistance. |
| 403      | `"ReasonCode": "PERMISSION_DENIED"` | You may not have permission to access this endpoint.           | Check you are using the correct credentials and that you are on the correct tier for the request you are making.                           |
| 404      | `"ReasonCode": "NOT_FOUND"`         | Invalid BIN format, ensure there are no spaces used.           | For the single BIN Lookup endpoint you must supply a complete BIN in String format with numbers only and a length of between 6 and 11.     |

## ISO Country Codes {#iso-country-codes}

The BIN Lookup service includes a country object for each account range. This object provides the country details as per the **ISO 3166** standard in three formats. The code format provides the numeric code as per ISO standards, the alpha3 format is the Alpha-3 code, and the name format provides the human readable country name.

```json
"country": {
  "code": 360,
  "alpha3": "IDN",
  "name": "Indonesia"
}
```

