API Keys
Rotate an API key
Rotate an API key. Issues a new key that copies the name and project of the rotated key, and schedules the rotated key to expire after a grace period so in-flight callers can swap over. The new plaintext key is returned once.
post/org/api_keys/{id}/rotate
Path parameters
idstring required
API key ID
Request body
Example request
{
"days_to_expire": 30,
"expire_in_days": 7
}Response
New API key created from the rotation
Example response
{
"id": "ckv9w8q2f000001l5r3j7k9m4",
"name": "production",
"created_by": {
"id": "user-abc123",
"email": "user@example.com",
"name": "Jane Doe"
},
"project_id": "proj_abc123",
"project_name": "Production",
"masked_key": "sk_1234...abcd",
"key": "sk_1234abcd"
}