Skip to main content
POST
/
v1
/
voice
/
sessions
Create voice session
curl --request POST \
  --url https://api.agntix.ai/v1/voice/sessions \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '
{
  "agentId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "metadata": {
    "callerId": "+1-555-000-0001"
  }
}
'
{
  "id": "<string>",
  "agentId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "token": "<string>",
  "serverUrl": "<string>",
  "createdAt": "2023-11-07T05:31:56Z"
}
Every endpoint on this page requires either a Clerk-issued JWT (Authorization: Bearer <token>) or an organization API key (x-api-key: pk_…). Anonymous calls return 401 Unauthorized. See Authentication for the full setup.
The agent must have voiceEnabled: true and a voicePipelineMode set. See Create Agent for voice configuration details.

Code examples

curl -X POST https://api.agntix.ai/v1/voice/sessions \
  -H "x-api-key: pk_live_••••" \
  -H "Content-Type: application/json" \
  -d '{
    "agentId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "metadata": { "callerId": "+15550001234" }
  }'

Connecting via LiveKit

Use the token and serverUrl from the response to connect with the LiveKit client SDK:
Node.js
import { Room, RoomEvent, Track } from 'livekit-client';

const room = new Room({
  adaptiveStream: true,
  dynacast: true,
});

room.on(RoomEvent.TrackSubscribed, (track) => {
  if (track.kind === Track.Kind.Audio) {
    track.attach(); // plays agent audio in the browser
  }
});

await room.connect(serverUrl, token);
await room.localParticipant.setMicrophoneEnabled(true);

Sample response

{
  "id": "vs_01j3m...",
  "agentId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "serverUrl": "wss://agntix-voice.livekit.cloud",
  "createdAt": "2026-04-29T10:00:00Z"
}

Authorizations

x-api-key
string
header
required

Organization API key. Obtain from the dashboard. Format: pk_live_…

Body

application/json
agentId
string<uuid>
required
metadata
object

Response

Voice session created with LiveKit token.

id
string
agentId
string<uuid>
token
string

LiveKit access token.

serverUrl
string

LiveKit server WebSocket URL.

createdAt
string<date-time>