Rotate Api Key
POST
/api/api-keys/{key_id}/rotate
const url = 'https://example.com/api/api-keys/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/rotate?organization_id=2489E9AD-2EE2-8E00-8EC9-32D5F69181C0';const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
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://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)
Authorizations
Section titled “ Authorizations ”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “ Path Parameters ” key_id
required
Key Id
string format: uuid
Query Parameters
Section titled “ Query Parameters ” organization_id
required
Organization Id
string format: uuid
Responses
Section titled “ Responses ”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
id
required
Id
string format: uuid
is_active
required
Is Active
boolean
key
required
Key
string
key_prefix
required
Key Prefix
string
name
required
Name
string
organization_id
required
Organization Id
string format: uuid
scopes
required
Scopes
Array<string>
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" } ]}