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.
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
API key ID
Body
Lifetime in days for the new key, up to 3650. Omit to reuse the rotated key's original lifetime, or never-expires if it had none.
1 <= x <= 365030
Grace period in days before the rotated key expires. Use 0 to expire it immediately. Omit for the default grace period of 7 days.
0 <= x <= 36507
Response
New API key created from the rotation
API key returned immediately after creation. Includes the plaintext key once.
Unique API key identifier
"ckv9w8q2f000001l5r3j7k9m4"
API key name
"production"
When the API key was created
When the API key expires
When the API key was deleted (soft-deleted). Null for keys that have not been deleted.
Project identifier for project-scoped API keys. Null means org-wide.
"proj_abc123"
Project name for project-scoped API keys. Null means the key is org-wide or the project name is unavailable.
"Production"
Masked version of the API key
"sk_1234...abcd"
Plaintext API key. Only returned once when the key is created.
"sk_1234abcd"