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 follow a consistent format.

HTTP Status Codes

Status CodeMeaningDescription
200OKRequest succeeded
201CreatedResource created successfully
400Bad RequestInvalid request body or parameters. Check the message field for details.
401UnauthorizedMissing or invalid API key
403ForbiddenInsufficient permissions for the requested operation
404Not FoundResource not found
409ConflictResource already exists or state conflict
429Too Many RequestsRate limit exceeded
500Internal Server ErrorUnexpected server error

Error Response Format

All error responses follow this structure:

{
  "statusCode": 400,
  "message": [
    "firstName must be a string",
    "email must be a valid email address"
  ],
  "error": "Bad Request"
}
FieldTypeDescription
statusCodenumberHTTP status code
messagestring or string[]Error description. Validation errors return an array of messages.
errorstringHuman-readable error category

Validation Errors

When request validation fails (400 Bad Request), the message field contains an array of specific validation failures:

{
  "statusCode": 400,
  "message": [
    "senderId must be a UUID",
    "acceptedQuoteId should not be empty",
    "purpose must be one of the following values: PAYROLL, VENDOR_PAYMENT, ..."
  ],
  "error": "Bad Request"
}

Business Logic Errors

These errors occur when the request is valid but cannot be processed due to business rules:

ErrorStatusDescription
Quote expired400The quote has expired. Create a new quote.
Sender not verified400The sender must be verified before creating orders.
Beneficiary not verified400The beneficiary must be verified before creating orders.
Payment method not approved400The payment method must be in approved status.
Insufficient balance400Insufficient funds in the merchant account.
Duplicate order409An order with this quote ID already exists.
Order cannot be cancelled400The order is in a state that does not allow cancellation.

Tips for Error Handling

  1. Always check the message array for specific validation failures when receiving a 400 error.
  2. Implement retry logic with exponential backoff for 429 and 500 errors.
  3. Do not retry 400, 401, or 403 errors — these require fixing the request.
  4. Use validation rules endpoints before creating entities to ensure your data meets requirements.