Give an API key a new secret
POST
/api-keys/{key_id}/rotate
const url = 'https://api.global.stillbox.example/v1/api-keys/example/rotate';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"keep_old_minutes":1}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.global.stillbox.example/v1/api-keys/example/rotate \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "keep_old_minutes": 1 }'The key keeps its ID, name, access and limits. The old secret stops at once, or keeps working for
keep_old_minutes so callers can switch over. Owners can rotate any key; members only the keys they created.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”key_id
required
string
Request Body
Section titled “Request Body”Media typeapplication/json
object
keep_old_minutes
How long the old secret keeps working; 0 (the default) stops it at once.
integer
Example generated
{ "keep_old_minutes": 1}Responses
Section titled “Responses”The key with its new secret, shown only now
Media typeapplication/json
object
id
required
string
name
required
string
key
required
The whole key. Store it now; it is never shown again.
string
Example generated
{ "id": "example", "name": "example", "key": "example"}The request is invalid
Media typeapplication/json
object
code
required
string
message
required
string
Example
{ "code": "not_found"}The API key is missing or invalid
Media typeapplication/json
object
code
required
string
message
required
string
Example
{ "code": "not_found"}Only an owner can do this (owner_only), or the invitation is for another address (not_invited)
Media typeapplication/json
object
code
required
string
message
required
string
Example
{ "code": "not_found"}No such sandbox in your organization (or no such file)
Media typeapplication/json
object
code
required
string
message
required
string
Example
{ "code": "not_found"}