All guides

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; agent is 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" }
  }'
FieldRequiredMeaning
agentyesThe agent's slug.
versionnoOne 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.
versionsnoSeveral 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.
variablesnoValues 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_refnoA flat object of your ids (string, number, boolean or null values).
options.visionnotrue: 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": "…"
  }
}
FieldMeaning
session_idThe session's ID (a UUID).
client_tokenWhat the client connects with. Works until the session first connects, and until client_token_expires_at.
client_token_expires_atWhen the token stops working: 5 minutes after the session started.
engine_urlWhere the client connects. Use this, not a URL of your own: it may differ from the base URL.
ice_serversSTUN and TURN servers for WebRTC, each { urls, username?, credential? }. Hand them to the client as they are.
agent.slugThe agent.
agent.version_id / agent.version_public_id / agent.versionThe version that runs: its internal ID, its public ID (ver_…) and its number.
agent.productionWhether it is a production session.
agent.modelThe 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

StatuscodeWhy
400bad_requestThe body is not valid JSON or doesn't match the request above.
400invalid_variablesThe 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" }.
400template_error / invalid_pipelineThe version's prompts or models can't be built. Fix the version in Cullman.
401unauthorizedMissing, unknown or revoked API key.
400unknown_versionThe agent has no version with an ID you sent. details.versions lists them.
404not_foundThere is no such agent in the key's workspace, or it was archived or deleted.
409nothing_promotedYou named no version and the agent has nothing in production. Promote a version in Cullman, or name one.
409version_archivedA version you named is archived. Restore it in Cullman, or name another.
429rate_limitedToo many sessions started; wait for Retry-After seconds.
503provider_unavailableThe 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:

FieldMeaning
idThe session's ID.
productionWhether 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).
sourceapi for every session started with an API key.
client_ref / variablesAs you sent them.
statuscreated (not connected yet), live, ending or ended.
end_reasonWho closed it (below), or null while it runs.
agent_finished_atWhen the conversation was finished (below), or null.
transportwebrtc or websocket, once connected; else null.
created_at, connected_at, ended_atWhen it started, connected and ended (null until then).
duration_msFrom connected to ended, or null.
cost_usdWhat 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:

includeAdds
transcriptturns: 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.
reviewsreviews: the judge's review (score, summary, rubric scores, issues). Empty until it has judged. See Judges.
feedbackfeedback: what the participant said afterwards (see Send feedback).
tool_callsEvery 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).
eventsThe session's event log.
usageProvider usage and cost per stage.
promptsThe prompts as rendered for this session, and the pipeline it ran.

end_reason says who closed the call:

end_reasonMeaning
agent_endedThe agent ended the conversation and its goodbye finished playing.
participant_endedYour page ended it (session.end).
client_commandYour server ended it (End a session, or Delete sessions on a live one).
disconnectedThe client's connection dropped.
max_durationThe session reached its longest allowed length.
expiredThe browser never connected.
errorSomething failed.
shutdownThe 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:

RouteAuthDoes
POST /v1/sessions/{session_id}/connectAuthorization: Bearer {client_token}Sends a WebRTC offer and gets the engine's answer.
GET /v1/sessions/{session_id}/wsSubprotocols 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 token5 minutes, and only until the session first connects. Start the session right before the participant talks.
Session length45 minutes by default (set per version, up to 3 hours).
Lost connectionThe 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 sessionsEvery session is kept until it is deleted, from Cullman or with Delete sessions.
Starting sessionsAbout 120 a minute per API key; then 429 with Retry-After.
ConnectingAbout 60 attempts a minute per client IP, WebRTC and WebSocket together; then 429 with Retry-After.