Skip to content

Rotate Api Key

POST
/api/api-keys/{key_id}/rotate
curl --request POST \
--url 'https://example.com/api/api-keys/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/rotate?organization_id=2489E9AD-2EE2-8E00-8EC9-32D5F69181C0' \
--header 'Authorization: Bearer <token>'

Rotate an API key (revoke old, create new with same settings)

key_id
required
Key Id
string format: uuid
organization_id
required
Organization Id
string format: uuid

Successful Response

Media type application/json
APIKeyCreatedResponse

Response when API key is created (includes full key)

object
created_at
required
Created At
string format: date-time
description
required
Any of:
string
expires_at
required
Any of:
string format: date-time
id
required
Id
string format: uuid
is_active
required
Is Active
boolean
key
required
Key
string
key_prefix
required
Key Prefix
string
last_used_at
required
Any of:
string format: date-time
name
required
Name
string
organization_id
required
Organization Id
string format: uuid
scopes
required
Scopes
Array<string>
user_id
required
Any of:
string format: uuid
Example generated
{
"created_at": "2026-04-15T12:00:00Z",
"description": "example",
"expires_at": "2026-04-15T12:00:00Z",
"id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0",
"is_active": true,
"key": "example",
"key_prefix": "example",
"last_used_at": "2026-04-15T12:00:00Z",
"name": "example",
"organization_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0",
"scopes": [
"example"
],
"user_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"
}

Validation Error

Media type application/json
HTTPValidationError
object
detail
Detail
Array<object>
ValidationError
object
ctx
Context
object
input
Input
loc
required
Location
Array
msg
required
Message
string
type
required
Error Type
string
Example generated
{
"detail": [
{
"ctx": {},
"input": "example",
"loc": [
"example"
],
"msg": "example",
"type": "example"
}
]
}