Skip to content

POST /api/v1/admin/orgs/:slug/api-keys

This page is auto-generated from src/admin/routes.ts. Do not edit by hand — see docs/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.

Requires the following capability(ies):

  • members:w

Other middleware observed on this route (heuristic):

  • requireCapability
  • adminBodyLimit

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.

{
"error": "Invalid JSON body"
}
{
"error": "Body must be a JSON object"
}
{
"error": "name is required (1..128 chars)"
}
{
"error": "Org not found"
}
{
"error": "project_id must be a string"
}
{
"error": "project_id not found for this org"
}
{
"error": "actor must be a string"
}
{
"error": "actor must be 1..256 chars matching [A-Za-z0-9._@:+/=-] (no whitespace, no control chars)"
}
{
"id": <member-expr>,
"name": <member-expr>,
"last8": <member-expr>,
"projectId": <member-expr>,
"actorIdentity": <member-expr>,
"createdAt": <member-expr>,
"key": <plaintext>
}
  • File: src/admin/routes.ts
  • Line: 6156