# API Codes

## API Error Codes

### Categories

We group the error codes into different categories for better understanding.

* `1xx` - Header errors
* `2xx` - Merchant/request validations errors
* `3xx` - User data errors
* `4xx` - Bank errors
* `5xx` - Internal server errors

### Error Codes

| API Code | HTTP Code |              Type              | Message                                                                                                                 |
| :------: | :-------: | :----------------------------: | ----------------------------------------------------------------------------------------------------------------------- |
|    100   |    401    |      `INVALID_CREDENTIALS`     | Invalid credentials                                                                                                     |
|    101   |    400    |    `MISSING_REQUIRED_HEADER`   | Missing or invalid format for required header {0}                                                                       |
|    102   |    401    |       `INVALID_SIGNATURE`      | Invalid signature                                                                                                       |
|    103   |    400    |      `INVALID_DATE_RANGE`      | X-Date header value out of valid range                                                                                  |
|    200   |    405    |      `METHOD_NOT_ALLOWED`      | Request method {0} not supported                                                                                        |
|    201   |    401    |          `INVALID_IP`          | Unregistered IP address                                                                                                 |
|    202   |    400    |     `INVALID_REQUEST_BODY`     | Invalid request body: {0}                                                                                               |
|    203   |    403    |      `FORBIDDEN_MERCHANT`      | Merchant not allowed to use this api                                                                                    |
|    300   |    400    |       `INVALID_DOCUMENT`       | Invalid document number                                                                                                 |
|    301   |    400    |       `INVALID_BANK_CODE`      | Invalid bank code                                                                                                       |
|    302   |    400    |     `INVALID_BANK_ACCOUNT`     | Invalid bank account                                                                                                    |
|    303   |    400    |      `INVALID_BANK_BRANCH`     | Invalid bank branch                                                                                                     |
|    305   |    400    |    `MISSING_REQUIRED_FIELDS`   | Missing required fields                                                                                                 |
|    306   |    400    |        `INVALID_PIX_KEY`       | Invalid Pix Key                                                                                                         |
|    307   |    400    |     `COUNTRY_NOT_AVAILABLE`    | Country not available                                                                                                   |
|    308   |    400    |        `INVALID_AMOUNT`        | Invalid amount. The minimum is {amount} {currency} or equivalent in {currency}                                          |
|    309   |    400    |       `INVALID_CURRENCY`       | Invalid Currency                                                                                                        |
|    310   |    400    |         LIMIT\_EXCEEDED        | Limit exceeded                                                                                                          |
|    311   |    400    |      USER\_LIMIT\_EXCEEDED     | Transaction declined because the limit of cashouts allowed from different users to that Bank Account has been exceeded. |
|    400   |    400    |     `BANK_ACCOUNT_BLOCKED`     | The bank account is blocked                                                                                             |
|    401   |    400    |      `BANK_ACCOUNT_CLOSED`     | The bank account is closed                                                                                              |
|    402   |    400    |   `INVALID_BENEFICIARY_NAME`   | The beneficiary name doesn't match the bank details                                                                     |
|    403   |    400    | `INVALID_BENEFICIARY_DOCUMENT` | The beneficiary document doesn't match the bank details                                                                 |
|    404   |    400    |     `INVALID_ACCOUNT_TYPE`     | Invalid account type                                                                                                    |
|    405   |    400    |  `TRANSFER_TYPE_NOT_SUPPORTED` | The transfer type is not supported on this account                                                                      |
|    406   |    400    |   `BANK_ACCOUNT_UNAVAILABLE`   | The account is unable to receive transfers                                                                              |
|    407   |    400    |             `OTHER`            | Other                                                                                                                   |
|    408   |    400    |       `REJECTED_BY_BANK`       | Rejected by bank                                                                                                        |
|    500   |    500    |     `INTERNAL_SERVER_ERROR`    | Oh no! Something has gone wrong. Please contact a system administrator.                                                 |
