Rotate API Key
API Keys
Rotate API Key
Rotate an existing API key, generating a new secret
POST
Rotate API Key
Overview
Rotates an existing API key by creating a new key with a new ID and the same name, scopes, and configuration. The old key remains valid for a fixed 24-hour grace period to allow for zero-downtime credential rotation in distributed systems. The new key (including its new ID and secret) is returned only once in the response. Store it securely immediately.The grace period is fixed at 24 hours and is not configurable. The old key will automatically stop working 24 hours after rotation.
Path Parameters
API key ID to rotate (e.g.,
key_Mc2eF6gH)Response
Code Examples
Errors
| Status | Type | Description |
|---|---|---|
| 401 | unauthorized | Missing or invalid API key |
| 403 | forbidden | Insufficient permissions to rotate keys |
| 404 | not_found | Key ID does not exist |
| 409 | conflict | Key was already rotated and is still within its grace period |
| 429 | rate_limited | Too many requests |
Related Endpoints
- List API Keys — view all keys
- Create API Key — generate a new key
- Get Current Organization — organization profile