ConfigurationRotate a key

POST /v1/projects/{project}/scoring/rotate

Rotate a project's site key or private key. The old key is invalidated immediately and a new one is returned.

curl -X POST https://api.botect.ai/v1/projects/123/scoring/rotate \
  -H "Authorization: Bearer YOUR_ACCOUNT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "type": "private" }'
{
  "type": "private",
  "key": "sk_7dN…"
}

Issues a fresh site key or private key for a project and invalidates the previous one immediately — use it after a suspected leak, or to retrieve a private key you didn't store. Scoring must already be enabled.

POST https://api.botect.ai/v1/projects/{project}/scoring/rotate

Authentication

Account API token via Authorization: Bearer <token>. The project must belong to the token's account. See Authentication.

Path parameters

Body

body
typestring
Required

Which key to rotate: site or private.

Example

Response fields

typestring
Required

The key type that was rotated (site or private).

keystring
Required

The new key. For private, this is your only chance to capture it.

Rotation is immediate: in-flight requests using the old key start failing with 401 as soon as the new key is issued. Deploy the new key before (or as) you rotate.

Errors

StatuscodeWhen
401UNAUTHENTICATEDMissing / bad account token
403Project does not belong to the token's account
409Scoring is not enabled — enable it first
422INVALID_PAYLOADtype missing or not site/private