Sessions API
Your server's calls to the engine: starting a session, reading it afterwards, and managing it. For the walkthrough, see the tutorial.
- Base URL:
https://engine.cullman.ai - Authentication:
Authorization: Bearer <API key>on every call, a key made in Cullman's Settings › API keys. Call it server to server only: an API key never goes to a browser. A key belongs to the workspace it was made in and starts sessions with any of that workspace's agents, on any version;agentis a slug, unique within the workspace. - Format: JSON with snake_case fields. Timestamps are ISO 8601 strings.
- Errors:
{ "error": { "code", "message", "details"? } }, with the HTTP status. - Unknown fields in a request body are ignored.
The client (the participant's browser or app) never calls these routes: it connects with the session's client token, as in Connecting the client.
Start a session
POST /v1/sessions. Do it when the participant is about to talk: the client token in the answer works for 5 minutes.
curl -X POST https://engine.cullman.ai/v1/sessions \
-H "Authorization: Bearer $VOICE_ENGINE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"agent": "ai-interviewer",
"variables": { "participant_name": "Sam", "topic": "Checkout flow" },
"client_ref": { "user_id": "u_123", "study_id": "s_456" }
}'
| Field | Required | Meaning |
|---|---|---|
agent | yes | The agent's slug. |
version | no | One version's ID, as Cullman shows it (ver_7k2p9x4m). Any version of the agent, drafts included: a draft runs as it is when the session starts. |
versions | no | Several versions, each { "id": "ver_…", "weight": 70 }, at most 10. Each session runs one of them, picked at random by weight. Weights are relative shares, whole numbers from 1 to 100: 70 and 30 split 70/30, 2 and 1 two-thirds and one-third. Give them for every version or for none; with none, the versions are picked equally often. Send version or versions, not both. |
variables | no | Values for the version's variables. Missing ones take their default; a missing required one, or a wrong type, is refused. If the version lets each session pick its voice, send voice (one of its model's voices, e.g. ash); without it, the version's default voice. A voice or language that differs from one the version fixed is refused rather than ignored. If the version lets each session say its language, send a code its transcription model takes (e.g. ko); without one, it's detected from speech. A variable a model setting reads (temperature, turn detection, a provider's setting) must be a value that setting takes; the version's Variables tab in Cullman says what each takes, e.g. "Eagerness takes one of auto, low, medium, high". |
client_ref | no | A flat object of your ids (string, number, boolean or null values). |
options.vision | no | true: the agent may ask the page for camera or screen frames. Default false. The frames are read and not kept, and nothing is recorded. A Vision that runs by a session variable asks only when that variable is true too. |
Name no version and the session runs the agent's production: its one version, or one of the versions in its A/B test, each as likely. If the versions it may run read different variables, send what all of them need.
A session on a version that was in production when it started is a production session; any other is a development session. The agent's judge reviews both kinds as they end, and webhooks can take one kind or both.
201 Created:
{
"session_id": "6f1c…",
"client_token": "…",
"client_token_expires_at": "2026-10-14T09:05:00.000Z",
"engine_url": "https://engine.cullman.ai",
"ice_servers": [{ "urls": "stun:…" }],
"agent": {
"slug": "ai-interviewer",
"version_id": "…",
"version_public_id": "ver_7k2p9x4m",
"version": 7,
"production": true,
"model": "…"
}
}
| Field | Meaning |
|---|---|
session_id | The session's ID (a UUID). |
client_token | What the client connects with. Works until the session first connects, and until client_token_expires_at. |
client_token_expires_at | When the token stops working: 5 minutes after the session started. |
engine_url | Where the client connects. Use this, not a URL of your own: it may differ from the base URL. |
ice_servers | STUN and TURN servers for WebRTC, each { urls, username?, credential? }. Hand them to the client as they are. |
agent.slug | The agent. |
agent.version_id / agent.version_public_id / agent.version | The version that runs: its internal ID, its public ID (ver_…) and its number. |
agent.production | Whether it is a production session. |
agent.model | The version's main model. |
Store session_id against your own record, and pass session_id, client_token, engine_url and ice_servers to
the browser.
Errors
| Status | code | Why |
|---|---|---|
| 400 | bad_request | The body is not valid JSON or doesn't match the request above. |
| 400 | invalid_variables | The variables don't fit the version: a required one is missing or one has the wrong type, voice isn't one of its model's voices, language isn't a code its transcription model takes, a voice or language differs from the one the version picked, or a setting that reads a variable doesn't take its value. details lists each one: [{ name, message }], e.g. { "name": "topic", "message": "required" } or { "name": "eager", "message": "Eagerness must be one of auto, low, medium, high" }. |
| 400 | template_error / invalid_pipeline | The version's prompts or models can't be built. Fix the version in Cullman. |
| 401 | unauthorized | Missing, unknown or revoked API key. |
| 400 | unknown_version | The agent has no version with an ID you sent. details.versions lists them. |
| 404 | not_found | There is no such agent in the key's workspace, or it was archived or deleted. |
| 409 | nothing_promoted | You named no version and the agent has nothing in production. Promote a version in Cullman, or name one. |
| 409 | version_archived | A version you named is archived. Restore it in Cullman, or name another. |
| 429 | rate_limited | Too many sessions started; wait for Retry-After seconds. |
| 503 | provider_unavailable | The version's model provider is unavailable right now. |
Read a session
GET /v1/sessions/{session_id}
curl "https://engine.cullman.ai/v1/sessions/$SESSION_ID?include=transcript,reviews" \
-H "Authorization: Bearer $VOICE_ENGINE_API_KEY"
You can read the sessions your key started; any other ID answers 404 not_found. A session always has:
| Field | Meaning |
|---|---|
id | The session's ID. |
production | Whether it is a production session. |
agent | { id, slug, name }. |
version | { id, public_id, number, state, name }: the version it ran. state is draft or saved (frozen). |
source | api for every session started with an API key. |
client_ref / variables | As you sent them. |
status | created (not connected yet), live, ending or ended. |
end_reason | Who closed it (below), or null while it runs. |
agent_finished_at | When the conversation was finished (below), or null. |
transport | webrtc or websocket, once connected; else null. |
created_at, connected_at, ended_at | When it started, connected and ended (null until then). |
duration_ms | From connected to ended, or null. |
cost_usd | What its model calls cost so far, or null. |
Add more with include (comma-separated). An include that isn't one of these answers 400 bad_request:
include | Adds |
|---|---|
transcript | turns: each turn's idx (the turn live messages carry), role, text, whether it was interrupted, how much of it was heard (heard_ms) and how long its audio was (audio_ms), with started_at and ended_at. A participant turn the engine couldn't hear has inaudible: true. An agent turn that played has timings: how long it took to start, in ms after what it waited for (waited_for: participant, start for the opening line, or tool). Other turns have null. A participant turn's ended_at is when its transcript came; speech_ended_at, when present, is when they stopped speaking. |
reviews | reviews: the judge's review (score, summary, rubric scores, issues). Empty until it has judged. See Judges. |
feedback | feedback: what the participant said afterwards (see Send feedback). |
tool_calls | Every tool call with its arguments, result and latency and, for an HTTP request, a webhook or an MCP server, what was sent (request: kind, then method for an HTTP request or a webhook, server and tool for an MCP server, then url, status, ms, attempts). |
events | The session's event log. |
usage | Provider usage and cost per stage. |
prompts | The prompts as rendered for this session, and the pipeline it ran. |
end_reason says who closed the call:
end_reason | Meaning |
|---|---|
agent_ended | The agent ended the conversation and its goodbye finished playing. |
participant_ended | Your page ended it (session.end). |
client_command | Your server ended it (End a session, or Delete sessions on a live one). |
disconnected | The client's connection dropped. |
max_duration | The session reached its longest allowed length. |
expired | The browser never connected. |
error | Something failed. |
shutdown | The engine instance carrying the call stopped. |
agent_finished_at says whether the conversation was finished: it is set when the agent ended it, or when the page
sent session.end with finished: true.
End a session
POST /v1/sessions/{session_id}/end. For when your page went away without hanging up. Answers 202 with the
session's status ({ "status": "ended" }, or live while the instance running it ends it). The session ends with
client_command.
curl -X POST "https://engine.cullman.ai/v1/sessions/$SESSION_ID/end" \
-H "Authorization: Bearer $VOICE_ENGINE_API_KEY"
Send feedback
PUT /v1/sessions/{session_id}/feedback. Passes on what the participant thought of the conversation: a rating from 1
(poor) to 5 (great) and an optional comment (up to 2,000 characters). Send it any time after the session exists;
sending again replaces it. Answers 200 with the feedback as saved ({ rating, comment }); a rating out of range is
400 bad_request. It shows on the session's page in Cullman, counts in its version's mean rating, and the
session lists can find the sessions rated 1 or 2. Feedback is not a review: the judge never reads it, and it counts in
no score.
curl -X PUT "https://engine.cullman.ai/v1/sessions/$SESSION_ID/feedback" \
-H "Authorization: Bearer $VOICE_ENGINE_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "rating": 4, "comment": "Felt natural" }'
Delete sessions
DELETE /v1/sessions?client_ref=<JSON>, with at least one pair (400 bad_request otherwise). Deletes every session your key started whose client_ref contains these
pairs, for when a participant or a study is deleted on your side. Sessions still going on, or not connected yet, are
ended first. Answers { "deleted": n }, counting only sessions that weren't deleted already.
A deleted session is gone for your key: reading it, ending it or sending its feedback answers 404, and no webhook
is sent about it any more. The engine doesn't erase it: it keeps the session, out of every list, and never judges it.
curl -X DELETE "https://engine.cullman.ai/v1/sessions?client_ref=%7B%22user_id%22%3A%22u_123%22%7D" \
-H "Authorization: Bearer $VOICE_ENGINE_API_KEY"
Connecting the client
The client connects to engine_url with the session's client_token, never with the API key:
| Route | Auth | Does |
|---|---|---|
POST /v1/sessions/{session_id}/connect | Authorization: Bearer {client_token} | Sends a WebRTC offer and gets the engine's answer. |
GET /v1/sessions/{session_id}/ws | Subprotocols ve.v1 and ve.token.{client_token} | Opens the WebSocket fallback. |
The browser client calls them for you. Live protocol has both, with what travels over them once connected.
Limits
| Client token | 5 minutes, and only until the session first connects. Start the session right before the participant talks. |
| Session length | 45 minutes by default (set per version, up to 3 hours). |
| Lost connection | The session ends as soon as the connection is lost: WebRTC after 5 seconds of ICE disconnected, a WebSocket within 30 seconds of the client going silent. The client can't reconnect; start a new session. |
| Keeping sessions | Every session is kept until it is deleted, from Cullman or with Delete sessions. |
| Starting sessions | About 120 a minute per API key; then 429 with Retry-After. |
| Connecting | About 60 attempts a minute per client IP, WebRTC and WebSocket together; then 429 with Retry-After. |