Skip to content
Last updated

Rotate an API key by deleting the old key and creating a new one with the same settings. The new key will have a different ID.

POSThttps://api.aitronos.com/v1/organizations/{org_id}/api-keys/{key_id}/rotate

Path Parameters

org_id string required

The organization ID.

key_id string required

The API key ID.

Returns

A rotation response with the old key ID and the new API key object. Important: The raw API key is shown ONCE only and must be stored securely.

Bash
curl "https://api.aitronos.com/v1/organizations/org_123abc/api-keys/ak_123abc456def789/rotate" \
  -X POST \
  -H "X-API-Key: $FREDDY_API_KEY"

Response:

{
  "id": "ak_123abc456def789",
  "key": "oak_live_e5f678901234567890123456789012345678901234567890123456789012",
  "key_prefix": "oak_live_e5f6",
  "organization_id": "org_123abc",
  "key_name": "Production API Key",
  "is_active": true,
  "usage_limit_chf": 500.0,
  "scopes": ["read:usage", "write:projects"],
  "created_by": "usr_456def",
  "created_at": "2025-11-05T10:00:00Z",
  "expires_at": "2026-01-01T00:00:00Z",
  "rotated_at": "2025-11-13T14:30:00Z"
}