Skip to main content
Protected API requests require authentication using an API key. The health and model-catalog endpoints are public; synthesis, voice, and dictionary endpoints authenticate the caller. This page explains how to obtain and use your API key.

Getting Your API Key

  1. Sign up at kugelaudio.com
  2. Go to your Dashboard
  3. Navigate to SettingsAPI Keys
  4. Click Create API Key
  5. Copy and securely store your key
API keys are shown only once when created. Store them securely! If you lose a key, you’ll need to create a new one.

Using Your API Key

HTTP Requests

Include your API key in the Authorization header using Bearer token format:
The native API also accepts the equivalent X-API-Key header:
The api_key query parameter is accepted for protocol compatibility, but use a header for HTTP requests so the secret is less likely to appear in URLs and access logs. WebSocket clients commonly need the query form because browser WebSocket APIs cannot set arbitrary handshake headers.

WebSocket Connections

For WebSocket connections, pass the API key as a query parameter:
Or with Authorization: Bearer or X-API-Key in the handshake headers (where the client library supports custom headers):

Browser Realtime connections

Never place an API key in browser code. A server can exchange a project-scoped API key for a five-minute Realtime client secret:
Pass the returned value as the client_secret query parameter when opening the Realtime WebSocket. The short-lived secret retains the originating project identity and is accepted only by that endpoint. See Realtime voice agent for the complete connection sequence.

SDK Usage

Environment Variables

For security, we recommend using environment variables instead of hardcoding API keys:
The Python and JavaScript clients require the key in their constructors; read KUGELAUDIO_API_KEY from your process environment as shown above. The Java client also provides KugelAudio.fromEnv(). Traffic goes to the canonical geo-routed endpoint by default. Prefix your key with eu- to use the direct EU endpoint. See Regions.

API Key Security

API keys should only be used in server-side code. Never include them in:
  • Frontend JavaScript
  • Mobile app source code
  • Public repositories
  • Client-side environment variables
Store API keys in environment variables, not in code:
Create new API keys periodically and delete old ones. This limits the impact of any potential key exposure.
Create separate API keys for development, staging, and production. This makes it easier to rotate keys and track usage.

Managing API Keys

Creating Keys

  1. Go to DashboardSettingsAPI Keys
  2. Click Create API Key
  3. Give it a descriptive name (e.g., “Production Server”)
  4. Copy the key immediately (it won’t be shown again)

Revoking Keys

If a key is compromised:
  1. Go to DashboardSettingsAPI Keys
  2. Find the compromised key
  3. Click Revoke
  4. Create a new key
  5. Update your applications
API-key lookups are cached briefly. A revocation can take roughly 30 seconds to propagate to an ingress process, so rotate applications before revoking the old key and do not rely on revocation as an instantaneous session kill.

Key Scope

Dashboard API keys are scoped to a project. Resource APIs such as dictionaries enforce that project scope.

Authentication Errors

401 Unauthorized

Causes:
  • Missing Authorization header
  • Invalid API key
  • Revoked API key
  • Malformed header format
Solutions:
  • Check that you’re including the Authorization header
  • Verify the API key is correct
  • Check if the key has been revoked
  • Ensure format is Bearer YOUR_API_KEY

403 Forbidden

Causes:
  • Trying to access resources from another account
  • Using a key whose project does not own the requested resource
  • Calling voice-management operations with a credential that has no organization/user identity
Solutions:
  • Verify you’re using the correct API key
  • Verify the key belongs to the resource’s project or organization

Testing Authentication

Verify your API key is working:
A valid key receives a 200 voice-page response. A missing, invalid, or revoked key receives the standard 401 UNAUTHORIZED error envelope. Do not use /v1/models for this check: the model catalog is public and cannot verify a key.