Skip to main content
POST
/
api
/
v0
/
service-accounts
/
{serviceAccountId}
/
api-keys
/
{keyId}
/
rotate
Rotate a service account API key
curl --request POST \
  --url https://api.factory.ai/api/v0/service-accounts/{serviceAccountId}/api-keys/{keyId}/rotate \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "expiresAt": 1,
  "gracePeriodMinutes": 5
}
'
{
  "apiKey": {
    "id": "<string>",
    "value": "<string>",
    "fingerprint": "<string>",
    "name": "<string>",
    "expiresAt": 123
  }
}

Authorizations

Authorization
string
header
required

Factory API key or JWT token for authentication

Path Parameters

serviceAccountId
string
required

Service account ID

Minimum string length: 1
keyId
string
required

API key ID

Minimum string length: 1

Body

application/json
expiresAt
integer
Required range: x > 0
gracePeriodMinutes
integer

How long (0-10 minutes) the rotated-from key stays valid after rotation. Omit or 0 revokes it immediately. Rejected with a 400 if the key would expire before the grace window ends (the grace period never extends a key lifetime).

Required range: 0 <= x <= 10

Response

Response for status 200

apiKey
object
required