Docs
API 1.39
Status
API keys

Rotate an API key with an optional grace period

POST /v1/api-keys/{id}/rotate: Rotate an API key with an optional grace period

POST /v1/api-keys/{id}/rotate
Operation idrotateApiKey
Key scopeadmin: admin keys only
SectionAPI keys

#Parameters

NameInTypeRequiredDescription
idpathstringyespattern ^key_[0-9a-hjkmnp-tv-z]{26}$

#Request body

FieldTypeRequiredDescription
grace_secondsinteger≥ 0 · ≤ 86400 · default 0

#Example request

curl -X POST "https://api.kaab.ist/v1/api-keys/{id}/rotate" \
  -H "Authorization: Bearer $KAAB_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"grace_seconds":3600}'

#Responses

#200

Key

FieldTypeRequiredDescription
idstringyespattern ^key_[0-9a-hjkmnp-tv-z]{26}$
object"api_key"yes
namestringyes
prefixstringyes
scopes"run", "read", "admin"yesmin items 1
mode"live", "test"yes
last_used_atstring or null (date-time)yes
expires_atstring or null (date-time)yes
created_atstring (date-time)yes
keystringyespattern ^sk_(live|test)_[A-Za-z0-9]{32,}$

#Errors

Every error answers with the error envelope; its code is one of the error codes.

StatusWhen
400request_invalid: request validation failed
401Missing or invalid API key
402insufficient_credits: top up to continue
403The key's scope does not cover this operation
404Resource not found
409Conflicting state (see error.code)
422Semantically invalid request (see error.code)
429Rate limited; see Retry-After
500internal: unexpected server error

Was this page helpful?