Skip to content
Design preview: examples use a local mock server.

Errors

Every problem type the API can respond with, with its status code, its cause, and whether a retry can help.

Errors are problem objects as defined in RFC 9457, sent with the content type application/problem+json.

The problem object

{
  "type": "https://watership.ca/api/problems/text-too-long",
  "title": "The text is too long",
  "status": 400,
  "detail": "\"text\" is 131,072 characters; the limit is 100,000. Split the text and check each part.",
  "instance": "req_3Kd9pX7vB2",
  "limit": 100000,
  "errors": [{ "pointer": "/text", "detail": "Longer than 100,000 characters." }]
}
FieldTypeAlways presentDescription
typestring (URI)yesIdentifies the kind of problem. Branch on this.
titlestringyesA short summary, the same for every problem of one type.
statusintegeryesThe HTTP status code.
detailstringyesWhat went wrong with this request, and what to do.
instancestringnoAn id for this occurrence. Quote it when you report a problem.
errorsarraynoFor invalid-request and text-too-long: one item per field, each with a pointer and a detail.
limitintegernoFor text-too-long and payload-too-large: the limit the request exceeded.

A pointer is a JSON Pointer (RFC 6901) into the request body, such as /min_level. For a query parameter, it’s the parameter name after #/query/, such as #/query/limit.

The type URIs are stable identifiers. They don’t resolve to a page yet.

Problem types

All types start with https://watership.ca/api/problems/.

TypeStatusCauseRetry?Mock example
invalid-request400Malformed JSON, a missing or unknown field, or a value outside the allowed setNo. Fix the request.invalidRequest
text-too-long400text is over 100,000 charactersNo. Split the text.textTooLong
unauthorized401No Authorization header, or the key isn’t validNo. Fix the key.missingKey
not-found404No rule, term, or voice has that idNounknownRule
payload-too-large413The request body is over 1 MiB (1,048,576 bytes)No. Split the text.bodyTooLarge
unsupported-media-type415The body isn’t sent as application/jsonNo. Fix the header.notJson
rate-limited429The key sent more than 120 requests this minuteYes, after Retry-After secondsrateLimited
internal500A fault on the serverYes, with backoffinternal
check-timeout503The check took longer than 5 seconds and was stoppedNot with the same text. Split it.timeout

To get one of these from the mock server, send a Prefer header with the status code and the example name, such as Prefer: code=400, example=textTooLong.

Endpoints and their errors

EndpointCan return
POST /v1/checks400, 401, 413, 415, 429, 500, 503
GET /v1/rules, GET /v1/terms, GET /v1/voices400, 401, 429, 500
GET /v1/rules/{rule_id}, GET /v1/terms/{term_id}, GET /v1/voices/{voice_id}400, 401, 404, 429, 500

Handle errors and rate limits shows how to act on each type.

On this page