docs(openapi): add API key rotate endpoint and document reset_usage update flow#134
Conversation
There was a problem hiding this comment.
Pull request overview
Adds OpenAPI documentation so API key rotation is discoverable in the API reference, while improving/validating the existing reset_usage update flow documentation.
Changes:
- Adds
POST /api-keys/{id}/rotatewith request/response schemas and code samples (default + self-hosted). - Adds explicit request examples for
PUT /api-keys/{id}, including a minimal{"reset_usage": true}example. - Extends
UpdateApiKeyObjectto includereset_usageand fixes the curl method for the update endpoint samples (GET → PUT).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| /api-keys/{id}/rotate: | ||
| servers: *ControlPlaneServers | ||
| post: | ||
| tags: | ||
| - Api-Keys | ||
| summary: Rotate API Key | ||
| description: | | ||
| Rotates an existing API key and returns a newly generated key value. | ||
| The previous key remains valid during the transition period and expires at `key_transition_expires_at`. |
There was a problem hiding this comment.
The new POST /api-keys/{id}/rotate operation does not define an operationId and is not added to the x-code-samples.groups navigation list. Since this spec’s header note says new endpoints must also be added to the groups section (see openapi.yaml:139-141), this endpoint may not show up in the rendered API reference navigation.
Suggestion: add a stable operationId (e.g., rotateApiKey) and include it under the appropriate group/section in x-code-samples.groups so it becomes discoverable in the docs UI.
Summary
POST /api-keys/{id}/rotate.RotateApiKeyRequest(key_transition_period_ms)RotateApiKeyResponse(id,key,key_transition_expires_at)reset_usagedocumentation onPUT /api-keys/{id}(schema + request examples), including minimal{"reset_usage": true}usage.Why
API key rotation is implemented in backend routes but was not available in OpenAPI docs. This PR makes the rotate endpoint discoverable and testable in the API reference, while preserving the already-documented
reset_usageupdate flow.Scope
Portkey-AI/openapiopenapi-spec/4432-admin-api-upgradeopenapi.yamlTest Plan
POST /api-keys/{id}/rotateis present.key_transition_period_mswith minimum1800000.id,key, andkey_transition_expires_at.PUT /api-keys/{id}still includesreset_usagein schema/examples.Merge Timing
Keep this PR open and merge after the rotate endpoint is Generally Available.
Related
docs-update/4432-admin-api-upgrade