1.4 KiB
API keys
Developers can authenticate against /v1 with a named API key sent as Authorization: Bearer rcms_... instead of the jwt cookie. A key acts with exactly the rights of the user who created it.
Managing keys
Key management needs a real session (the jwt cookie from a verified user).
POST /v1/api-keywith{"name": "ci", "expires_at": "<RFC3339, optional>"}answers201withid,name,prefix,key,created_at,expires_at. The fullkeyis shown once and never again.GET /v1/api-keylists the caller's keys (all keys for the owner), newest first, with astatusofactive,expiredorrevoked.DELETE /v1/api-key/{id}revokes a key and answers204. Revoking twice keeps the firstrevoked_at.
Only the SHA-256 hash and a 12 character prefix are stored.
Where a key is accepted
/v1/article (public and protected routes), /v1/user, /v1/media, /v1/settings and GET /v1/auth/me. An invalid, expired or revoked rcms_ key answers 401 and is never treated as anonymous. Each key is limited to 120 requests per minute (429 with Retry-After). last_used_at is updated at most once per minute.
Session-only routes
/v1/api-key, POST /v1/auth/verify, DELETE /v1/auth/register and every /v1/system route answer 403 This action needs a real session. to any rcms_ Bearer header. The public auth routes ignore the header.
A successful password reset revokes every key of that user.