ClavianAPI errors

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.

401 Unauthorized

The request came with no session, token or API key the API accepts.

402 Payment Required

Something has to be paid for first: a session’s funding, or a capability the organisation’s plan does not include.

403 Forbidden

The caller is known, and may not do this: its role, a rule of the venue or a ban stops it.

404 Not Found

Nothing the caller may see is there. It is also the answer wherever saying that something exists would reveal it.

409 Conflict

The request conflicts with the current state: something changed first, or is already so.

412 Precondition Failed

The update was based on a version of the resource that is no longer current.

422 Unprocessable Content

The request is well formed, and cannot be carried out as asked.

429 Too Many Requests

Too many requests in the current window. Retry-After says how long to wait.

500 Internal Server Error

The API failed, and nothing the request would have changed was kept.

503 Service Unavailable

A service the API depends on cannot do its part right now.

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-Id header and its trace id. Quote it to support.
errors
For a validation failure, one entry for each field that failed: its field, a code and a message. 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.