Error Codes
HTTP status codes, validation error formats, and business logic error codes returned by the Mesta API.
Error Codes
The Mesta API uses standard HTTP status codes to indicate the success or failure of requests. All error responses share one envelope.
Error Response Format
Every error response has this shape:
{
"error": {
"CODE": "VALIDATION_FAILED",
"MESSAGE": "Failed to validate given entity",
"DETAILS": [
"senderId must be a UUID",
"acceptedQuoteId should not be empty"
]
},
"requestId": 177021679
}| Field | Type | Description |
|---|---|---|
error.CODE | string | Machine-readable error code. Branch your logic on this. |
error.MESSAGE | string | Human-readable description. Copy may change — do not match on it. |
error.DETAILS | array or object | Optional. Present on validation failures (an array of messages) and on some business errors. |
requestId | integer | Unique request identifier. Include it when contacting support. |
There is no top-levelstatusCodeormessageThe HTTP status is on the response itself, not in the body. Read
error.CODEfor the machine-readable code anderror.DETAILSfor validation failures.
HTTP Status Codes
| Status Code | Meaning | Description |
|---|---|---|
200 | OK | Request succeeded |
201 | Created | Resource created successfully |
400 | Bad Request | Invalid request body or parameters, or a business rule rejected the request. Read error.CODE. |
401 | Unauthorized | Missing or invalid API key/secret |
403 | Forbidden | Your API key lacks the permission for this operation |
404 | Not Found | Route or resource not found |
409 | Conflict | The request conflicts with the current state of the resource — for example, reusing an Idempotency-Key for a different payload |
410 | Gone | The endpoint has been removed. error.MESSAGE names its replacement. |
429 | Too Many Requests | Rate limit exceeded. See Rate Limiting. |
500 | Internal Server Error | Unexpected server error |
Conflicts and oversized payloads return400, not409/413A uniqueness violation returns
400withCODE: ENTITY_ALREADY_EXISTS, and an oversized body returns400withCODE: REQUEST_PAYLOAD_SIZE_EXCEEDED.409is reserved for state conflicts such as idempotency-key reuse.
Validation Errors
When request validation fails, the response is 400 with CODE: VALIDATION_FAILED and one message per failed constraint in DETAILS. Nested fields are dot-prefixed with their parent property, and array items include their index:
{
"error": {
"CODE": "VALIDATION_FAILED",
"MESSAGE": "Failed to validate given entity",
"DETAILS": [
"senderId must be a UUID",
"acceptedQuoteId should not be empty",
"purpose must be one of the following values: payroll, operational_expense, vendor_payment, ...",
"addresses.0.country must be one of the following values: US, GB, DE, ..."
]
},
"requestId": 177021679
}Common Error Codes
Platform-wide codes you can expect on any endpoint:
error.CODE | Status | Description |
|---|---|---|
VALIDATION_FAILED | 400 | Request failed validation. See DETAILS. |
ENTITY_ALREADY_EXISTS | 400 | A record with these unique values already exists |
REQUEST_PAYLOAD_SIZE_EXCEEDED | 400 | Request body is too large |
UNAUTHENTICATED | 401 | Credentials are missing or invalid |
INVALID_API_KEY | 401 | The API key/secret pair is not valid |
FORBIDDEN | 403 | The API key lacks the required permission |
NOT_FOUND | 404 | The requested route does not exist |
ENTITY_NOT_FOUND | 404 | The requested resource does not exist |
CONFLICT | 409 | The request conflicts with the resource's current state |
ENDPOINT_DEPRECATED | 410 | The endpoint has been removed; use the successor named in MESSAGE |
REQUEST_THROTTLED | 429 | Rate limit exceeded. DETAILS.retryAfterMs gives the wait. |
INTERNAL_SERVER_ERROR | 500 | Unexpected server error |
EXTERNAL_API_ERROR | 500 | An upstream provider returned an error |
Business Logic Errors
These occur when the request is well-formed but cannot be processed. All return 400.
error.CODE | Description |
|---|---|
QUOTE_EXPIRED | The quote has expired. Create a new quote. |
QUOTE_ALREADY_USED | An order has already been created using this quote. |
SENDER_NOT_VERIFIED | The sender must be verified before creating orders. |
SENDER_INACTIVE | The sender is not active. |
BENEFICIARY_NOT_VERIFIED | The beneficiary must be verified before creating orders. |
PAYMENT_METHOD_NOT_FOUND | No payment method exists for the given id. |
PAYMENT_METHOD_NOT_APPROVED | The payment method must be in approved status. |
INVALID_PAYMENT_METHOD_FOR_TARGET_CURRENCY | The payment method does not support the quote's target currency. |
INSUFFICIENT_BALANCE_IN_SOURCE_ACCOUNT | Insufficient funds in the source account. |
ORDER_STATUS_NOT_VALID_FOR_CANCELLATION | The order is in a state that does not allow cancellation. |
UNSUPPORTED_PAYMENT_TYPE | The type on the payment method is not supported. |
Tips for Error Handling
- Branch on
error.CODE, never onerror.MESSAGE— message copy can change without notice. - Read
error.DETAILSfor the specific field failures behind aVALIDATION_FAILED. - Log
requestIdon every failure and include it in support requests. - Implement retry logic with exponential backoff for 429 and 500 responses. Honour the
Retry-Afterheader on 429s. - Do not retry 400, 401, 403, or 410 — these require fixing the request.
- Use the validation rules endpoints before creating senders and beneficiaries so your payload meets the country-specific requirements.
Updated 20 days ago

