POST /api/v1/admin/orgs/:slug/api-keys
This page is auto-generated from
src/admin/routes.ts. Do not edit by hand — seedocs/dev/docs-auto-sync.md.
:warning: Heuristic extraction — not a contract. Response shapes below are mined from
c.json(...)literals in the handler via an AST walker. Computed fields, ternaries, and non-literal returns are shown as placeholders. Refer to the linked source file for the authoritative behaviour.
POST /api/v1/admin/orgs/:slug/api-keys
Section titled “POST /api/v1/admin/orgs/:slug/api-keys”Authentication
Section titled “Authentication”Requires the following capability(ies):
members:w
Middleware
Section titled “Middleware”Other middleware observed on this route (heuristic):
requireCapabilityadminBodyLimit
Description
Section titled “Description”POST /api/v1/admin/orgs/:slug/api-keys — mint a new key. The plaintext is
returned in this response ONLY; storage is the SHA-256 hash plus the last
8 chars for UI identification.
Body: { “name”: “ci-prod”, “project_id”?: ”…”, “actor”?: “alice@…” }.
#336 — gated on members:w (matches GET for symmetry; key mint is an
access-granting operation).
#569 Phase A1 — the optional actor field captures the accountable
party at mint time and binds it to the key’s row. Every request the
key authenticates inherits the actor automatically (per-key bound
actor, third trust source). Same sanitiser as the header path; rejects
charset/length violations with 400 rather than silently dropping so
the operator sees the typo at mint time, not at audit-read time.
Responses
Section titled “Responses”HTTP 400
Section titled “HTTP 400”{ "error": "Invalid JSON body"}HTTP 400
Section titled “HTTP 400”{ "error": "Body must be a JSON object"}HTTP 400
Section titled “HTTP 400”{ "error": "name is required (1..128 chars)"}HTTP 404
Section titled “HTTP 404”{ "error": "Org not found"}HTTP 400
Section titled “HTTP 400”{ "error": "project_id must be a string"}HTTP 400
Section titled “HTTP 400”{ "error": "project_id not found for this org"}HTTP 400
Section titled “HTTP 400”{ "error": "actor must be a string"}HTTP 400
Section titled “HTTP 400”{ "error": "actor must be 1..256 chars matching [A-Za-z0-9._@:+/=-] (no whitespace, no control chars)"}HTTP 201
Section titled “HTTP 201”{ "id": <member-expr>, "name": <member-expr>, "last8": <member-expr>, "projectId": <member-expr>, "actorIdentity": <member-expr>, "createdAt": <member-expr>, "key": <plaintext>}Source
Section titled “Source”- File:
src/admin/routes.ts - Line: 6156