/v1/keys is excluded from the standard /v1/* authentication
(ApiKeyAuthMiddleware): it has its own logic, described here. See also
Security for the full model.Access rules (V1, deliberately simple)
- HAKI_ADMIN_KEY set — admin mode
- HAKI_ADMIN_KEY unset — bootstrap
All key management requires
Authorization: Bearer <HAKI_ADMIN_KEY>. The admin freely chooses
org_id/project_id at creation and sees every key in the listing.Creating a key
Response — 201 Created
The clear key (
hk_...) — returned only once, here. Only its
sha256 hash is stored afterwards; it can never be retrieved again.Listing keys (masked)
HAKI_ADMIN_KEY, the listing is scoped to the calling key’s
project.
Revoking a key
revoked_at — immediate effect: the key returns
401 unauthorized on the very next call.
Possible errors
unauthorized (401), forbidden_scope (403 — a key tries to create a
key for an org_id/project_id other than its own), key_not_found
(404).
Organization provisioning (console-only)
{owner_ref, name}; generates a server-side org_id (never
supplied by the caller, unlike the /v1/keys bootstrap), creates a
prj_<org_id>_default project and a key. A repeat call for an already
known owner_ref does not recreate the organization: it mints a new
key on the same project instead (org_created: false).
