# Errors When an error occurs, the xMoney API will return an error response in JSON format. The response will include a status code, a message, and an array of errors. ## Error response format The error response will be in the following format: ```json { "code": 400, "message": "Bad Request", "errors": [ { "code": 1651, "message": "Invalid email address provided", "type": "Validation", "field": "email" } ] } ``` The `errors` array will contain a list of errors that occurred. Each error will have the following fields: | Field | Description | | --- | --- | | `code` | The error code. | | `message` | A human-readable message describing the error. | | `type` | The type of error `Exception` or `Validation`. | | `field` | The field that the error occurred in (if applicable). | ## Error codes The following table lists the most common error codes that the xMoney API might return: | Code | Message | Description | | --- | --- | --- | | 400 | Bad Request | The request was invalid or could not be understood by the server. | | 401 | Unauthorized | The request was not authenticated. | | 404 | Not Found | The requested resource was not found. | | 409 | Conflict | The request could not be completed due to a conflict with the current state of the server. | ## Example error responses Here are some example error responses: ### 409 Conflict ```json { "code": 409, "message": "Conflict", "errors": [ { "code": 1627, "message": "Customer already exists", "type": "Exception" } ] } ``` ### 404 Not Found ```json { "code": 404, "message": "Not Found", "errors": [ { "code": 902, "message": "Card not found", "type": "Exception" } ] } ```