Skip to content

API Keys

POST /v1/api-keys · scope apikeys:write · reversible · idempotent

Returns the plaintext token exactly once. Store it immediately: only its SHA-256 hash is kept and there is no way to recover it later.

Terminal window
curl https://api.truo.cloud/v1/api-keys \
-X POST \
-H "Authorization: Bearer $TRUO_TOKEN"

operationId: apiKeys.create

GET /v1/api-keys/{id} · scope apikeys:read

Terminal window
curl https://api.truo.cloud/v1/api-keys/key_42 \
-H "Authorization: Bearer $TRUO_TOKEN"

operationId: apiKeys.get

GET /v1/api-keys · scope apikeys:read

Session only. Never returns tokens: only the prefix and last 4 characters.

Terminal window
curl https://api.truo.cloud/v1/api-keys \
-H "Authorization: Bearer $TRUO_TOKEN"

operationId: apiKeys.list

POST /v1/api-keys/{id}/revoke · scope apikeys:write · destructive — cannot be undone · idempotent

Irreversible. Revocation propagates to all replicas over pub/sub in under a second; the worst case, with Redis down, is 60 seconds (the in-process cache TTL).

Terminal window
curl https://api.truo.cloud/v1/api-keys/key_42/revoke \
-X POST \
-H "Authorization: Bearer $TRUO_TOKEN"

operationId: apiKeys.revoke

PATCH /v1/api-keys/{id} · scope apikeys:write · reversible · idempotent

Scopes and the allowlist can only be narrowed. Widening returns 403: without that rule, a key with vps:read could promote itself to vps:write with a PATCH and scopes would stop meaning anything.

Terminal window
curl https://api.truo.cloud/v1/api-keys/key_42 \
-X PATCH \
-H "Authorization: Bearer $TRUO_TOKEN"

operationId: apiKeys.update