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.

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
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
Host: 
Authorization: Bearer YOUR_OAUTH2_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 27

{
  "retain_period_minutes": 0
}
{
  "body": {
    "created": "2025-12-05T21:44:51.587Z",
    "updated": "2025-12-05T21:44:51.587Z",
    "key": "text",
    "active": true,
    "service_account": {
      "body": {
        "created": "2025-12-05T21:44:51.587Z",
        "updated": "2025-12-05T21:44:51.587Z",
        "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": "2025-12-05T21:44:51.587Z",
    "last_rotated": "2025-12-05T21:44:51.587Z"
  },
  "resources": {
    "ANY_ADDITIONAL_PROPERTY": "anything"
  },
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "permission_denied": false,
  "name": "text"
}

Last updated

Was this helpful?