For the complete documentation index, see llms.txt. This page is also available as Markdown.

Rotate

Rotate Api Key

put

Rotate an API key.

Args: service_account_id: ID of the service account to which the API key belongs. api_key_name_or_id: Name or ID of the API key to rotate. rotate_request: API key rotation request. auth_context: The authentication context.

Returns: The updated API key.

Raises: IllegalOperationError: If the service account was created via external authentication.

Authorizations
OAuth2passwordRequired
Token URL:
Path parameters
service_account_idstring · uuidRequired
api_key_name_or_idany ofRequired
stringOptional
or
string · uuidOptional
Body

Request model for API key rotation.

retain_period_minutesintegerOptionalDefault: 0
Responses
200

Successful Response

application/json

Response model for API keys.

idstring · uuidRequired
permission_deniedbooleanOptionalDefault: false
namestring · max: 255Required
put/api/v1/service_accounts/{service_account_id}/api_keys/{api_key_name_or_id}/rotate
PUT /api/v1/service_accounts/{service_account_id}/api_keys/{api_key_name_or_id}/rotate HTTP/1.1
Authorization: Bearer YOUR_OAUTH2_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 27

{
  "retain_period_minutes": 0
}
{
  "body": {
    "created": "2026-01-01T00:00:00.000Z",
    "updated": "2026-01-01T00:00:00.000Z",
    "key": "text",
    "active": true,
    "service_account": {
      "body": {
        "created": "2026-01-01T00:00:00.000Z",
        "updated": "2026-01-01T00:00:00.000Z",
        "full_name": "",
        "active": false,
        "avatar_url": "text"
      },
      "metadata": {
        "description": "",
        "external_user_id": "123e4567-e89b-12d3-a456-426614174000"
      },
      "resources": {
        "ANY_ADDITIONAL_PROPERTY": "anything"
      },
      "id": "123e4567-e89b-12d3-a456-426614174000",
      "permission_denied": false,
      "name": "text"
    }
  },
  "metadata": {
    "description": "",
    "retain_period_minutes": 1,
    "last_login": "2026-01-01T00:00:00.000Z",
    "last_rotated": "2026-01-01T00:00:00.000Z"
  },
  "resources": {
    "ANY_ADDITIONAL_PROPERTY": "anything"
  },
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "permission_denied": false,
  "name": "text"
}
ZenML Scarf

Last updated

Was this helpful?