Skip to main content
POST
/
v3beta1
/
enterprise
/
service-users
/
{service_user_id}
/
api-keys
/
{api_key_id}
/
rotate
Rotate API key for service user
curl --request POST \
  --url https://api.devin.ai/v3beta1/enterprise/service-users/{service_user_id}/api-keys/{api_key_id}/rotate \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "new_key_expires_at": 123,
  "revoke_current": true
}
'
{
  "api_key_id": "<string>",
  "api_key_name": "<string>",
  "token": "<string>"
}

Permissions

Requires a service user with the ManageServiceUsers 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.