Skip to main content
POST
/
service-accounts
/
{org}
/
{name}
/
api-keys
/
{key_id}
/
rotate
Rotate an API key for a service account
curl --request POST \
  --url https://app.kosli.com/api/v2/service-accounts/{org}/{name}/api-keys/{key_id}/rotate \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "grace_period_hours": 24,
  "expires_at": 123
}
'
{
  "id": "<string>",
  "key": "<string>",
  "description": "<string>",
  "created_at": 123,
  "expires_at": 123,
  "grace_period_expires_at": 123
}

Documentation Index

Fetch the complete documentation index at: https://docs.kosli.com/llms.txt

Use this file to discover all available pages before exploring further.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

name
string
required
key_id
string
required
org
string
required

Body

application/json
grace_period_hours
integer
default:24

Number of hours the old key remains valid after rotation. Defaults to 24.

Required range: 1 <= x <= 720
expires_at
integer | null

Unix timestamp for the new key's expiry. Use 0 or omit for no expiry. Must not be in the past.

Required range: x <= 4102444800

Response

Successful Response

id
string
required
key
string
required
description
string
required
created_at
number
required
expires_at
integer
required
grace_period_expires_at
integer
required
Last modified on May 12, 2026