Getting Your API Key
- Sign up at kugelaudio.com
- Go to your Dashboard
- Navigate to Settings → API Keys
- Click Create API Key
- Copy and securely store your key
Using Your API Key
HTTP Requests
Include your API key in theAuthorization header using Bearer token format:
X-API-Key header:
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: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: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
- Python
- JavaScript
- cURL
Environment Variables
For security, we recommend using environment variables instead of hardcoding API keys: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
Never expose keys in client-side code
Never expose keys in client-side code
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
Use environment variables
Use environment variables
Store API keys in environment variables, not in code:
Rotate keys regularly
Rotate keys regularly
Create new API keys periodically and delete old ones. This limits the impact of any potential key exposure.
Use separate keys for environments
Use separate keys for environments
Create separate API keys for development, staging, and production. This makes it easier to rotate keys and track usage.
Managing API Keys
Creating Keys
- Go to Dashboard → Settings → API Keys
- Click Create API Key
- Give it a descriptive name (e.g., “Production Server”)
- Copy the key immediately (it won’t be shown again)
Revoking Keys
If a key is compromised:- Go to Dashboard → Settings → API Keys
- Find the compromised key
- Click Revoke
- Create a new key
- 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
- Missing
Authorizationheader - Invalid API key
- Revoked API key
- Malformed header format
- Check that you’re including the
Authorizationheader - Verify the API key is correct
- Check if the key has been revoked
- Ensure format is
Bearer YOUR_API_KEY
403 Forbidden
- 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
- 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: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.