Vatly
Guides

Errors

This guide covers API error handling, including status codes and error types.

You can tell if your request was successful by checking the status code in the API response. If a response is unsuccessful, use the HTTP status code and error message to understand what went wrong.


Status codes

Here is a list of the different categories of status codes returned by the Vatly API. Use these to understand if a request was successful.

StatusDescription
2xxA 2xx status code indicates a successful response.
4xxA 4xx status code indicates a client error. This means there's an issue with the request.
5xxA 5xx status code indicates a server error. This means the issue is on Vatly's end and we are automatically notified of the problem.

Common status codes

CodeMeaning
200OK - Request succeeded.
201Created - Resource was successfully created.
204No Content - Request succeeded with no response body (e.g., deletes).
400Bad Request - The request was malformed.
401Unauthorized - Invalid or missing API key.
403Forbidden - The API key doesn't have permission for this action.
404Not Found - The requested resource doesn't exist.
409Conflict - Idempotency mismatch, request still in progress, outcome unknown, or a concurrent write.
422Unprocessable Entity - Validation failed. Check the errors field for details.
429Too Many Requests - Rate limit exceeded. Slow down your requests.
500Internal Server Error - Something went wrong on Vatly's end.

Error responses

Whenever a request is unsuccessful, the Vatly API will return an error response with a human-readable message. Combine it with the HTTP status code to understand what has gone wrong and how to fix it. Most of the error messages are pretty helpful and actionable.

Error response
{
  "message": "Resource not found."
}

Some errors also include an optional details object with structured context about the failure. Treat unknown keys as forward-compatible additions and branch on the HTTP status code rather than the shape of details.

Error response with details
{
  "message": "The requested resource was not found.",
  "details": {
    "resource_type": "checkout",
    "resource_id": "checkout_abc123"
  }
}

Validation errors

When a 422 status code is returned, the response includes field-specific error details:

Validation error response
{
  "message": "The given data was invalid.",
  "errors": {
    "email": [
      "The email field is required."
    ],
    "products.0.id": [
      "The selected products.0.id is invalid."
    ]
  }
}

The errors object uses dot notation for nested fields. Each key maps to an array of error messages for that field.

Copyright © 2026