Skip to main content
POST
Rotate API key for service user

Permissions

Requires a service user with the ManageAccountServiceUsers permission at the enterprise level.

Authorizations

Authorization
string
header
required

Service User credential (prefix: cog_)

Path Parameters

service_user_id
string
required

Service user ID (prefix: service-user-)

Example:

"service-user-abc123def456"

api_key_id
string
required

Body

application/json
new_key_expires_at
integer | null

Optional expiration for the new key as a UNIX timestamp in seconds. Null for no expiration.

revoke_current
boolean
default:true

Whether to revoke the current key. Set to False for graceful rollover.

Response

Successful Response

Shared response model for API key creation/rotation (includes one-time token).

api_key_id
string
required
api_key_name
string
required
token
string
required

The raw API token. This is only shown once at creation/rotation time.