Atomically revokes a child API key and mints a replacement that inherits its configuration (name, agent_label, line_id, permissions, monthly_cap_cents). The new key’s rotated_from field references the OLD key’s id. Old and new rotation happen inside one SQL transaction — partial rotations are impossible.
The plaintext of the new key is returned in plaintext_key EXACTLY ONCE. Idempotency replays within 12 hours return the redacted row (no plaintext_key). Reusing the same Idempotency-Key for a rotation on a DIFFERENT child key returns 409 idempotency_key_reused.
Rate-limited to 30 requests per hour per service key. 429 responses carry Retry-After: 120.
Service keys (sk_svc_*) authenticate the /v1/keys/* management plane. Send as Authorization: Bearer <service-key>. Service keys are minted only from the portal (Settings → Service Keys); there is no API path to mint another service key.
Required. Sticky-cached for 12 hours per (service key, Idempotency-Key) pair.
Returned by POST /v1/keys and POST /v1/keys/{id}/rotate on the FIRST call only. Idempotency replays within the 12-hour TTL return the same row WITHOUT the plaintext_key field — the plaintext is never re-disclosable.