Skip to content
HANKAI
DevelopersWhat's new

Developers

API error codes

Every /api/v1 error response carries both a human error string and a stable, machine-readable code. Branch on the code — it never changes when we reword a message. Each code maps to one HTTP status (the failure class).

HANK platform REST API error codes, HTTP status, and meaning
CodeHTTPMeaning
invalid_request400The request body, query, or path parameter failed validation — the catch-all bad-input code.
duplicate_slug400A unique field (a slug, or a topic source key) collides with an existing row.
unknown_parent400A referenced parent (product / manual / chapter) does not exist or was concurrently deleted.
content_rejected400The submitted CONTENT failed the publish pipeline (leak/PHI scan, MDX compile, link/alt gate, or policy gate). Fix the content, not the request shape.
unauthorized401No, malformed, or unrecognized bearer token (unauthenticated).
forbidden403A valid token lacking the required scope / admin / operator privilege (authenticated, denied).
not_found404The addressed resource does not exist.
payload_too_large413The request body exceeds the configured size cap.
rate_limited429The per-identity write rate limit was exceeded — back off and retry after the Retry-After header.
invalid_idempotency_key400The Idempotency-Key header is present but malformed (empty or over the length cap).
idempotency_in_progress409A request with the same Idempotency-Key is still in progress; retry after Retry-After.
idempotency_key_conflict422The Idempotency-Key was already used for a request with a DIFFERENT body (no safe replay).

The same catalog drives the Error.code enum in the OpenAPI spec, so the documented set can never drift from what the API actually emits.