Skip to main content
POST
/
v1
/
api-keys
curl -X POST "https://api.danubeai.com/v1/api-keys" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Production Key",
    "permissions": {
      "allowed_services": ["service_uuid_1"],
      "allowed_tools": null
    }
  }'
{
  "id": "abc123",
  "key": "dk_new_generated_key_value",
  "key_prefix": "dk_new_g",
  "name": "Production Key",
  "created_at": "2026-02-28T10:00:00Z",
  "last_used": null,
  "permissions": {
    "allowed_services": ["service_uuid_1"],
    "allowed_tools": null
  }
}

Overview

Creates a new API key for the authenticated user. The plaintext key is returned only once in this response — store it securely. Optionally restrict the key to specific services, tools, or spending limits using the permissions field. Auth: Requires JWT token (Authorization: Bearer <token>).

Body Parameters

name
string
required
Display name for the API key (e.g., “Production”, “Agent Key”)
permissions
object
Optional resource-based permissions. If omitted or null, the key has unrestricted access.

Response

id
string
API key UUID
key
string
The plaintext API key (shown once only — store securely)
key_prefix
string
First 8 characters of the key (for identification)
name
string
Display name
created_at
string
ISO 8601 creation timestamp
last_used
string
Last usage timestamp (null on creation)
permissions
object
Resource permissions (null = unrestricted)

Example

curl -X POST "https://api.danubeai.com/v1/api-keys" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Production Key",
    "permissions": {
      "allowed_services": ["service_uuid_1"],
      "allowed_tools": null
    }
  }'
{
  "id": "abc123",
  "key": "dk_new_generated_key_value",
  "key_prefix": "dk_new_g",
  "name": "Production Key",
  "created_at": "2026-02-28T10:00:00Z",
  "last_used": null,
  "permissions": {
    "allowed_services": ["service_uuid_1"],
    "allowed_tools": null
  }
}