Skip to content

Give an API key a new secret

POST
/api-keys/{key_id}/rotate
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.

key_id
required
string
Media typeapplication/json
object
keep_old_minutes

How long the old secret keeps working; 0 (the default) stops it at once.

integer
<= 1440

Example generated

{
"keep_old_minutes": 1
}

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"
}