Skip to main content
The XUNA AI Conversational AI API uses API keys for server-side requests and short-lived tokens for client-side connections. Choose the right method depending on where your code runs.

API key

Your API key authenticates every direct HTTP request to the API. Pass it in the x-api-key header:
Get your key from Settings → API Keys.
Never expose your API key in client-side code, browser bundles, or mobile apps. Use signed URLs or conversation tokens for any code that runs outside your server.
Store the key as an environment variable:
The SDKs read XUNA_AI_API_KEY automatically:

Signed URLs (WebSocket)

A signed URL is a pre-authenticated wss:// address your server generates on demand. Pass it to a browser or mobile client so it can open a WebSocket connection without needing your API key.

Get a signed URL

GET /v1/convai/conversation/get-signed-url?agent_id={agent_id}
string
required
The ID of the agent you want to start a conversation with.
Response:
string
required
A pre-authenticated WebSocket URL (wss://). Valid for a short window — generate one per session.
Generate a fresh signed URL for every new conversation. Signed URLs are single-use and expire quickly.

Conversation tokens (WebRTC)

A conversation token serves the same purpose as a signed URL but for WebRTC-based connections. Your server exchanges your API key for a short-lived token and hands it to the client.

Get a conversation token

GET /v1/convai/conversation/token?agent_id={agent_id}
string
required
The ID of the agent to start a conversation with.
Response:
string
required
A short-lived token your client passes when initiating a WebRTC connection.

Choosing an auth method