Error handling

When a request fails, the API returns an appropriate HTTP status code along with a JSON response describing the error. The structure of the error response depends on the type of error.

HTTP Status Codes

CodeMeaning
400Bad Request – Invalid parameters, malformed request, or validation errors
401Unauthorized – Invalid or missing credentials
403Forbidden – Valid credentials but insufficient permissions
404Not Found – The requested resource doesn't exist
500Internal Server Error – Something went wrong on our end

Error Response Formats

The API uses two different error response formats depending on the type of error.

General Errors

For most HTTP errors (authentication failures, access denied, resource not found), the response follows this structure:

{  
  "status": 404,  
  "description": "Reservation not found",  
  "errors": [
    "Reservation not found",
  ]
}
FieldTypeDescription
statusintegerThe HTTP status code
descriptionstringA human-readable description of the error
errorsarrayA list of error messages

Validation Errors

When a request fails due to validation errors (invalid field values, missing required fields), the response includes additional detail about which fields failed validation:

{
  "status": 400,
  "description": "The request is invalid and cannot be processed. Update your request and try again.",
  "errors": [
    "dateFrom: This value is required",
    "dateTo: This value must be after dateFrom"
  ],
  "details": {
    "dateFrom": [
      { 
        "message": "This value is required" 
			}
    ],
    "dateTo": [
      { 
        "message": "This value must be after dateFrom" 
			}
    ]
  },
  "violations": [
    {
      "propertyPath": "dateFrom",
      "title": "This value is required",
      "template": "This value is required",
      "parameters": {}
    },
    {
      "propertyPath": "dateTo",
      "title": "This value must be after dateFrom",
      "template": "This value must be after {{ compared_value }}",
      "parameters": {
        "{{ compared_value }}": "dateFrom"
      }
    }
  ]
}
FieldTypeDescription
statusintegerThe HTTP status code (always 400 for validation errors)
descriptionstringA human-readable description
errorsarrayA flat list of error messages with field names prefixed
detailsobjectErrors grouped by field name
violationsarrayDetailed violation information including the message template and parameters

Handling Errors

When integrating with the API, we recommend:

Check the status code first – Use the HTTP status code to determine the category of error and whether a retry might succeed.

Use the errors array for simple handling – The errors array provides a quick list of what went wrong, suitable for logging or simple error display.

Use details for field-level feedback – When building forms or user interfaces, use the details object to display errors next to the relevant fields.

Use violations for advanced handling – The violations array provides the full context including message templates and parameters, useful if you need to customize error messages or perform additional logic based on the constraint type.