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
}
FieldTypeDescription
error.CODEstringMachine-readable error code. Branch your logic on this.
error.MESSAGEstringHuman-readable description. Copy may change — do not match on it.
error.DETAILSarray or objectOptional. Present on validation failures (an array of messages) and on some business errors.
requestIdintegerUnique request identifier. Include it when contacting support.
🚧

There is no top-level statusCode or message

The HTTP status is on the response itself, not in the body. Read error.CODE for the machine-readable code and error.DETAILS for validation failures.

HTTP Status Codes

Status CodeMeaningDescription
200OKRequest succeeded
201CreatedResource created successfully
400Bad RequestInvalid request body or parameters, or a business rule rejected the request. Read error.CODE.
401UnauthorizedMissing or invalid API key/secret
403ForbiddenYour API key lacks the permission for this operation
404Not FoundRoute or resource not found
409ConflictThe request conflicts with the current state of the resource — for example, reusing an Idempotency-Key for a different payload
410GoneThe endpoint has been removed. error.MESSAGE names its replacement.
429Too Many RequestsRate limit exceeded. See Rate Limiting.
500Internal Server ErrorUnexpected server error
📘

Conflicts and oversized payloads return 400, not 409/413

A uniqueness violation returns 400 with CODE: ENTITY_ALREADY_EXISTS, and an oversized body returns 400 with CODE: REQUEST_PAYLOAD_SIZE_EXCEEDED. 409 is 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.CODEStatusDescription
VALIDATION_FAILED400Request failed validation. See DETAILS.
ENTITY_ALREADY_EXISTS400A record with these unique values already exists
REQUEST_PAYLOAD_SIZE_EXCEEDED400Request body is too large
UNAUTHENTICATED401Credentials are missing or invalid
INVALID_API_KEY401The API key/secret pair is not valid
FORBIDDEN403The API key lacks the required permission
NOT_FOUND404The requested route does not exist
ENTITY_NOT_FOUND404The requested resource does not exist
CONFLICT409The request conflicts with the resource's current state
ENDPOINT_DEPRECATED410The endpoint has been removed; use the successor named in MESSAGE
REQUEST_THROTTLED429Rate limit exceeded. DETAILS.retryAfterMs gives the wait.
INTERNAL_SERVER_ERROR500Unexpected server error
EXTERNAL_API_ERROR500An upstream provider returned an error

Business Logic Errors

These occur when the request is well-formed but cannot be processed. All return 400.

error.CODEDescription
QUOTE_EXPIREDThe quote has expired. Create a new quote.
QUOTE_ALREADY_USEDAn order has already been created using this quote.
SENDER_NOT_VERIFIEDThe sender must be verified before creating orders.
SENDER_INACTIVEThe sender is not active.
BENEFICIARY_NOT_VERIFIEDThe beneficiary must be verified before creating orders.
PAYMENT_METHOD_NOT_FOUNDNo payment method exists for the given id.
PAYMENT_METHOD_NOT_APPROVEDThe payment method must be in approved status.
INVALID_PAYMENT_METHOD_FOR_TARGET_CURRENCYThe payment method does not support the quote's target currency.
INSUFFICIENT_BALANCE_IN_SOURCE_ACCOUNTInsufficient funds in the source account.
ORDER_STATUS_NOT_VALID_FOR_CANCELLATIONThe order is in a state that does not allow cancellation.
UNSUPPORTED_PAYMENT_TYPEThe type on the payment method is not supported.

Tips for Error Handling

  1. Branch on error.CODE, never on error.MESSAGE — message copy can change without notice.
  2. Read error.DETAILS for the specific field failures behind a VALIDATION_FAILED.
  3. Log requestId on every failure and include it in support requests.
  4. Implement retry logic with exponential backoff for 429 and 500 responses. Honour the Retry-After header on 429s.
  5. Do not retry 400, 401, 403, or 410 — these require fixing the request.
  6. Use the validation rules endpoints before creating senders and beneficiaries so your payload meets the country-specific requirements.

Did this page help you?