Rotate Issued API Key
POST/v2alpha1/admin/issuedApiKeys/:key_id:rotate
Generates a new secret for an issued API key. Creates a new API key with a new key_id and secret, and immediately revokes the old key. This is the recommended way to update scopes, metadata, or rotate credentials.
For zero-downtime rotation, use this workflow instead:
- IssueApiKey with new credentials
- Deploy new secret to all services
- Verify new secret works everywhere
- AdminRevokeIssuedApiKey to remove the old key
POST /v2alpha1/admin/issuedApiKeys/01HQZX9VYQKJB8XQZQXQZQXQXQ:rotate
{
"scopes": ["read"]
}
SDK ReferenceTypeScript
adminRotateIssuedApiKey(adminRotateIssuedApiKeyBody)| Parameters | Type | Required | Description |
|---|---|---|---|
| adminRotateIssuedApiKeyBody | AdminRotateIssuedApiKeyBody | required | |
| keyId | string | required | key_id is the ID of the existing API key to rotate |
| Variable | Type |
|---|---|
| data | RotateIssuedApiKeyResponse |