Skip to main content
POST
/
v1
/
api-keys
/
{key_id}
/
rotate
curl -X POST "https://api.danubeai.com/v1/api-keys/key_abc123/rotate" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"
{
  "id": "key_abc123",
  "key": "dk_new_rotated_key_value",
  "key_prefix": "dk_new_r",
  "name": "My Production Key",
  "created_at": "2026-01-15T10:00:00Z",
  "last_used": null,
  "permissions": {
    "allowed_services": ["service_uuid_1"],
    "allowed_tools": null
  }
}

Overview

Rotates an existing API key by generating new key material. The old key is immediately invalidated and a new plaintext key is returned. The key’s name and permissions are preserved. Auth: Requires JWT (dashboard operation only). Important: The new plaintext key is shown only once in this response. Store it securely.

Path Parameters

key_id
string
required
The API key UUID to rotate

Response

id
string
API key UUID (unchanged)
key
string
New plaintext API key (shown once only — store it securely)
key_prefix
string
First 8 characters of the new key (for identification)
name
string
Key name (preserved from original)
created_at
string
Original creation timestamp
last_used
string
Last usage timestamp (reset on rotation)
permissions
object
Resource permissions (preserved from original). null means unrestricted.

Example

curl -X POST "https://api.danubeai.com/v1/api-keys/key_abc123/rotate" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"
{
  "id": "key_abc123",
  "key": "dk_new_rotated_key_value",
  "key_prefix": "dk_new_r",
  "name": "My Production Key",
  "created_at": "2026-01-15T10:00:00Z",
  "last_used": null,
  "permissions": {
    "allowed_services": ["service_uuid_1"],
    "allowed_tools": null
  }
}