Headless Voice Sessions: embed AI voice in your own app
Open an AI voice session with a Call2Me agent from your own frontend using an API key — get a LiveKit token and connect. No widget required.
Updated July 2, 2026
Headless voice sessions
Embed a Call2Me AI voice agent directly in your own app — no widget, no phone number. You request a session token, then connect your own LiveKit client. The agent joins the room automatically and speaks with its configured voice and prompt.
1. Open a session
curl -X POST https://api.call2me.app/v1/voice/sessions \
-H "Authorization: Bearer sk_call2me_..." \
-H "Content-Type: application/json" \
-d '{"agent_id": "agent_abc123"}'
Response:
{
"token": "<livekit-jwt>",
"url": "wss://livekit.call2me.app",
"room_name": "agent_abc123_9f2c1a0b",
"session_limit_sec": 3600
}
2. Connect from the browser
import { Room } from 'livekit-client'
// Proxy the call above from your own backend so the API key stays server-side.
const { token, url } = await (await fetch('/api/voice-session')).json()
const room = new Room()
await room.connect(url, token)
await room.localParticipant.setMicrophoneEnabled(true)
// The agent joins automatically and starts talking.
Keep the API key server-side — proxy the /v1/voice/sessions call from your backend, never ship sk_... to the browser.
Guards & billing
- 404 — agent not found or not yours.
- 402 — the agent owner is out of credit.
- 429 — daily session limit reached.
- 403 — the API key is read-only (read-only keys cannot open sessions).
- Billing — per minute of conversation, from the agent owner's wallet. No talk, no charge.
Frequently asked
Q.Can I add Call2Me's AI voice to my own web app?
Yes. POST /v1/voice/sessions with an agent_id and your API key returns a LiveKit token + url. Connect any LiveKit client and the agent auto-joins and talks.
Q.Who pays for a headless voice session?
The agent owner's wallet, billed per minute of conversation. Nothing is charged if no one talks.