Error codes
When the Clavian API refuses a request, it answers with a problem document (RFC 9457), and the document’s type is the address of one of these pages. Each page says what the failure means and what a client should do about it.
Branch on code: it names the failure and never changes. There are 47 codes, grouped here by the HTTP status each is sent with.
Codes by status
400 Bad Request
The request could not be understood as written, and has to change before it is sent again.
- Validation failed
validation_failed - Incorrect code
otp_invalid - Code expired; ask for a new one
otp_expired - This phone number cannot be used
phone_number_refused - Accept the terms and the privacy policy
consent_required - Incorrect PIN
staff_pin_incorrect
401 Unauthorized
The request came with no session, token or API key the API accepts.
- Not signed in
unauthenticated - Incorrect email or password
invalid_credentials
402 Payment Required
Something has to be paid for first: a session’s funding, or a capability the organisation’s plan does not include.
- Nothing to fund the session
no_funding - Not included in the plan
entitlement_required
403 Forbidden
The caller is known, and may not do this: its role, a rule of the venue or a ban stops it.
- Not allowed
forbidden - Player is banned
player_banned - ID check required
id_check_required - Age restricted
age_restricted - Email address not verified
email_not_verified - Sign in again to do this
reauthentication_required - Second factor required
second_factor_required - Invitation is for someone else
invitation_contact_mismatch - This counter device is locked
device_locked - PIN locked; a manager must reset it
staff_pin_locked - Not on a shared counter device
shared_device - Setting locked
setting_locked
404 Not Found
Nothing the caller may see is there. It is also the answer wherever saying that something exists would reveal it.
- Not found
not_found
409 Conflict
The request conflicts with the current state: something changed first, or is already so.
- Conflict
conflict - Session already ended
session_already_ended - Station not available
station_unavailable - Station reserved
station_reserved - Already in a session
already_in_session - The terms or privacy policy have changed
consent_version_outdated - That email address or phone number is on another account
contact_in_use - Price changed
price_changed - Discount limit reached
discount_limit_reached - Invitation used, revoked or expired
invitation_unavailable - Already a member
already_a_member - An organisation needs an owner
last_owner - That role name is taken
role_name_taken - This organisation has as many custom roles as it may
custom_role_limit_reached - Role still in use
role_in_use - That slug is taken
slug_taken
412 Precondition Failed
The update was based on a version of the resource that is no longer current.
- Stale write
stale_write
422 Unprocessable Content
The request is well formed, and cannot be carried out as asked.
- Cannot be processed
unprocessable - Profile incomplete
profile_incomplete - Idempotency key used for a different request
idempotency_key_reused - Currency differs from the organisation's
currency_mismatch
429 Too Many Requests
Too many requests in the current window. Retry-After says how long to wait.
- Too many requests
rate_limited
500 Internal Server Error
The API failed, and nothing the request would have changed was kept.
- Something went wrong
internal_error
503 Service Unavailable
A service the API depends on cannot do its part right now.
- Codes cannot be sent right now
otp_delivery_unavailable
The problem document
Every error response of the API has this shape, as application/problem+json. Its schema is Problem in the OpenAPI document, which also says which codes each endpoint can answer with.
type- The address of the failure’s page here, which says what it means and what to do.
title- A short summary of the failure. The same for every occurrence of a
type, and not translated. status- The HTTP status of the response, repeated.
detail- What went wrong this time, for people to read. It changes from one occurrence to the next, and never says whether an account exists. Optional.
code- The failure in snake case: the member a client branches on. It never changes for a failure.
requestId- The request’s id: also its
X-Request-Idheader and its trace id. Quote it to support. errors- For a validation failure, one entry for each field that failed: its
field, acodeand amessage. Optional. instance- A reference to this occurrence, where the API gives one. Optional.
Answers from /v1/auth/
The sign-in endpoints under /v1/auth/ answer in a shape of their own instead, { "code", "message" }, with the code in upper snake case. The OpenAPI document calls it AuthError; its codes have no pages here.