> ## Documentation Index
> Fetch the complete documentation index at: https://docs.spaportal.cz/llms.txt
> Use this file to discover all available pages before exploring further.

# Errors

SpaPortal API uses a single `error` object:

```json theme={null}
{
  "error": {
    "code": "invalid_request",
    "message": "Invalid request.",
    "requestId": "req_6b4c6b6f-0d34-47f1-bf3b-8a3f9d8d2e1f",
    "details": [
      {
        "field": "hotelId",
        "code": "invalid_string",
        "message": "Must be a 24-character hex id."
      }
    ]
  }
}
```

Public endpoints currently return `invalid_request`, `missing_authentication`,
`invalid_authentication`, `not_found`, and `internal_error`. Each endpoint lists
the HTTP statuses it can return.

API error responses also include `X-Request-Id`. If you send `X-Request-Id` with the request, SpaPortal echoes that value. Otherwise, SpaPortal generates a new one.

## Handling errors

Read both the HTTP status and the JSON error code or message.

Treat `400`, `401`, and `404` as client-correctable errors. Retry only after you change the request.

Treat `500` as a temporary server error. Retry with backoff if the operation is safe to repeat.
