Start an embedded web call
Mints a short-lived token your browser front-end uses to talk to an agent over WebRTC, so you can embed a Kejue Voice agent in your own web app.
How it fits together
Call this from your backend with your API key, then hand the returned token and ws_url to the browser. Media flows directly between the browser and Kejue Voice, and never traverses your servers.
The token only gets you into the room
It is valid just long enough to join — see expires_at_ms — and does not bound the call itself.
call_id is the same id the call appears under in GET /v1/calls, available immediately, so you can correlate before the call connects.
variables are rendered into the agent's prompt exactly like outbound call variables. That is how you pass your own end-user's identity or context into the conversation.
bearerAuthAuthorizationBearer <token>Use a Voice API key or connected-app OAuth access token. Authentication.
Idempotency-Key*stringRequired. Reuse the same key to retry this write safely. Retries and idempotency.
^[A-Za-z0-9!#$%&'*+.^_`|~-]+$1 <= length <= 255application/json- body
agent_id*stringThe agent to talk to. Its production version is used unless version_id is given.
uuidversion_id?stringRun a specific agent version instead of the production one. The version must belong to agent_id.
uuidvariables?Per-call prompt variables, referenced as {{name}} or {{vars.name}}. Names must match [A-Za-z_][A-Za-z0-9_]{0,63}. Supply your own end-user's identity or context here — these values are trusted because they arrive over an authenticated server-side request, never from the browser.
properties <= 50metadata?Opaque object stored on the call for your own bookkeeping and returned by GET /v1/calls/{id}. Max 8 KiB encoded. Never shown to the agent or the caller.
modality?stringThe conversation surface. audio (the default) streams speech both ways over WebRTC. text runs the same agent as a typed conversation over the room's data channel, with no microphone, no speech recognition and no synthesis. Text calls are billed as minutes for their full duration and share the same concurrency limit as audio web calls.
"audio""audio""text"Token minted and the call row created. The call remains in ringing until the browser joins and the agent is dispatched.
application/json- response
call_id*stringThe call's id, usable immediately against GET /v1/calls/{id}.
uuidtoken*stringShort-lived join credential for the browser. Treat it as a secret in transit; it authorizes exactly one room.
ws_url*stringThe WebRTC signalling endpoint the browser connects to.
uriroom_name*stringThe room the browser joins. Diagnostic — the SDK takes it from the token.
agent_name*stringThe dispatched worker identity. Diagnostic only.
agent_version_id?stringThe agent version actually resolved for this call.
uuidexpires_at_ms*integerUnix ms after which the token can no longer be used to JOIN. It does not bound an already-connected call.
int64modality*stringThe surface this call was opened on, echoed back so a client that omitted the field still knows which transport to run.
"audio""text"curl -X POST 'https://api.kejue.co/v1/web-calls' \ -H 'Idempotency-Key: string' \ -H 'Content-Type: application/json' \ -d '{ "agent_id": "2b1e3b65-2c04-4fa2-a2d7-467901e98978"}'{ "call_id": "33333333-3333-4333-8333-333333333333", "token": "eyJhbGciOiJIUzI1NiJ9.eyJ2aWRlbyI6e319.signature", "ws_url": "wss://agent.kejue.co", "room_name": "call-billing_assistant-a1b2c3d4e5f6", "agent_name": "sonus-prompt", "agent_version_id": "22222222-2222-4222-8222-222222222222", "expires_at_ms": 1786101420000, "modality": "audio"}