API keysRotate a key

Rotate a key

Rotate a key — creates a replacement with the same scope and expiry, and revokes the original.

curl -X POST "https://api.autopil.ai/v1/keys/example_string/rotate" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: YOUR_API_KEY"
{
  "key_id": "example_string",
  "name": "John Doe",
  "key": "example_string",
  "scope": "admin",
  "expires_at": "2024-12-25T10:00:00Z",
  "created_at": "2024-12-25T10:00:00Z"
}
POST
/v1/keys/{key_id}/rotate
POST
Base URLstring

Target server for requests. Edit to use your own host.

API Key (header: X-API-Key)
X-API-Keystring
Required

API key with admin, read, or evaluate scope. Missing key → 401; invalid or revoked key → 403.

API key with admin, read, or evaluate scope. Missing key → 401; invalid or revoked key → 403.
Request Preview
Response

Response will appear here after sending the request

Authentication

header
X-API-Keystring
Required

API Key for authentication. API key with admin, read, or evaluate scope. Missing key → 401; invalid or revoked key → 403.

Path Parameters

Responses

key_idstring
namestring
keystring

Plaintext key — shown only once.

scopestring
Allowed values:adminreadevaluate
expires_atstring
created_atstring