JoinInDocs
Baton
v2 (beta)
Get a key
Baton v2 Streaming (WebSocket) BetaMarkdown

Room

One mixed recording of several people. Turn events plus per-speaker transcripts.

WSS/v2/room

Send the room's mixed audio as one source. Baton separates the voices (up to 8), transcribes each voice on its own, identifies each voice's language, and reports turn events for the room as a whole (speaker: "room").

Transcripts. Each voice gets asr.partial for its newest, still-changing word and asr.final for words that will not change. A word becomes final as soon as the speaker says another word, after about a second without change, or when you send finalize.

Turn boundaries. When your own turn logic decides a speaker has finished, send finalize. Every voice's pending word is emitted as asr.final, followed by asr.flushed. Cut your segments on asr.flushed, not on turn.end.

Languages. When a voice is clearly speaking another language from your allowed list, its transcription switches to that language; each asr.final says which language it is in. Without an allowed list Baton only warns (warning with code: language_mismatch). Add language to signals for the language events.

Same session options as the streams: signals (vad, bargein, and in rooms partials and language), agent.speech, keywords, idle_timeout_s, eot, and messages (the conversation so far, used to judge whether an utterance is complete, as on /v2/stream).

When rooms are at capacity the start closes with 1013; retry with backoff.

Same as /v2/streamIdentical messages; room events carry speaker: "room".
Show Session, Audio, Speech and turns, Barge-in

Session

Open, configure and close the session.

session.startyou sendThe first frame of a room. The same options as a stream's session.start.

Rejections close with 1008 (the same reasons as a stream's session.start, or unsupported language '<code>' when the room's transcriber can't serve a language) or 1013 when rooms are at capacity or temporarily unavailable (retry with backoff).

FieldTypeDescription
type required"session.start"
api_key requiredstring
mode"transactional_call" | "working_session" | "one_on_one" | "brainstorm" | "formal"

Default "transactional_call".

eotobject

Choose an end-of-turn operating point by name, or by the mean latency you can afford (the closest of the cutoff_* points wins; ties go to the faster one). Give at most one. Setting eot overrides mode; omit it to use the mode's default point. patient is chosen by name only. What each point is for.

Operating point Mean latency False cut-offs
cutoff_10pct 317 ms about 10 %
cutoff_5pct 563 ms about 5 %
cutoff_2pct 861 ms about 2 %
patient 1658 ms about 1 %

English figures, /v2/stream and /v2/room; every language's points are at GET /v2/eot/profiles.

action_delay_ms and timeout_ms replace the chosen point's own values; the rest of the point stays as published. timeout_ms may not be below action_delay_ms. Examples: {"profile": "cutoff_5pct"}, {"latency_budget_ms": 600}, {"profile": "patient", "timeout_ms": 8000}.

languageone of: Pinned, Allowed set, Automatic

The language the user speaks. Telling Baton improves quality; if they may speak one of several, an allowed list is still better than nothing. Default {"pin": "en"}.

signalsarray of "vad" | "bargein" | "partials" | "language"

Optional event families to receive besides the turn events and asr.final, which every room gets: vad (vad.start, vad.end), bargein (bargein.onset, bargein.class), partials (asr.partial) and language (asr.language, language.switched, language.switch_recommended, language.summary). Default: none. Only what you are sent changes, never how turns are decided or what is transcribed. An unknown name closes with 1008. What each event is for: Events.

keywordsobject

Words that interrupt your agent at once, said over it (bargein.class claim). A list you send REPLACES Baton's default for that list; a list you leave out keeps its default. Entries are one or two words (answer: up to three); case and punctuation are ignored. A bad list or entry closes the session with 1008.

echo"on" | "off"

on: Baton ignores your agent's own voice when the microphone picks it up again (speakerphone, laptop without headphones), using what agent.speech tells it. off: your audio is already free of your agent's voice (headphones, or your own echo cancellation), so speech over your agent is the user's at once: it opens a turn and counts as barge-in. agent.speech still drives barge-in either way. Any other value closes with 1008. Default "on".

idle_timeout_snumber

Close after this many seconds without speech. 0 or less disables it. Default 600.

inference_intervalnumber

Leave it at 0.1; other values void the published numbers and timings. Default 0.1.

messagesarray of object

Conversation so far, used to judge whether an utterance is complete. Read once, at session.start; nothing updates it later.

An English meeting that may switch to Spanish or French speakers.

{
  "type": "session.start",
  "api_key": "baton_0123456789abcdef0123456789abcdef0123456789abcdef",
  "eot": {"profile": "cutoff_5pct"},
  "language": {"allowed": ["en", "es", "fr"]},
  "signals": ["vad", "bargein", "partials"],
  "idle_timeout_s": 900
}

session.startedyou receiveThe room is open and the transcriber is ready.

FieldTypeDescription
type required"session.started"
schema_version required2

The protocol version, sent once per connection on session.started. Events do not repeat it.

session_id requiredstring
signals requiredarray of "vad" | "bargein" | "partials" | "language"

The optional event families this room receives, as you asked for them (in this order).

eot requiredobject

The policy this session uses. mean_latency_ms and cutoff_rate were measured for the operating point's own delay and timeout, so they are null once you set action_delay_ms or timeout_ms.

echo"on" | "off"

Whether Baton ignores your agent's echo in this session, as session.start set it.

modelsobject

Present when bargein was requested.

{
  "type": "session.started",
  "schema_version": 2,
  "session_id": "8b1e4f2a9c3d4e7f8a1b2c3d4e5f6a7b",
  "signals": ["vad", "partials"],
  "eot": {
    "profile": "cutoff_5pct",
    "rule": "score_point",
    "action_delay_ms": 300,
    "timeout_ms": 3000,
    "overridden": [],
    "mean_latency_ms": 563,
    "cutoff_rate": 0.0482
  }
}

warning (idle_timeout)you receiveNo speech for a while. The session will close soon.

Sent before an idle close (idle_timeout_s, default 600 s). Speech resets the timer. The close is code 1000 with reason idle_timeout.

FieldTypeDescription
seq requiredinteger

Event sequence number. Starts at 1 and increases by one per event.

type required"warning"
code required"idle_timeout"
close_in_s requirednumber

Seconds until the idle close.

{
  "type": "warning",
  "seq": 40,
  "code": "idle_timeout",
  "close_in_s": 30.0
}

session.endyou sendEnd the session. Baton replies with session.summary and closes with 1000.

FieldTypeDescription
type required"session.end"
{"type": "session.end"}

session.summaryyou receiveTotals for the session. Sent in reply to session.end.

FieldTypeDescription
seq requiredinteger

Event sequence number. Starts at 1 and increases by one per event.

type required"session.summary"
audio_s requirednumber

Seconds of audio received.

turns requiredinteger

Turn ends

{
  "type": "session.summary",
  "seq": 41,
  "audio_s": 312.4,
  "turns": 18
}

Audio

16 kHz mono PCM16 in binary frames.

audioyou sendOne binary frame of audio.

A binary WebSocket frame: one leading byte (send 0; it identifies the source and is reserved for multi-source sessions), then signed 16-bit little-endian PCM, mono, 16 000 Hz. Any whole number of samples per frame; 80–100 ms (1280–1600 samples) is typical. Resample on the client: other rates are not accepted. A frame whose PCM part is an odd number of bytes (e.g. no source byte) closes the session with 1008 audio frame must be a source byte and 16-bit PCM.

Binary frame. [u8 source = 0][PCM16LE mono 16 kHz samples...]

Speech and turns

When people speak, pause and finish, what they answered, and what may have been missed.

vad.startyou receiveSomeone in the room started speaking. With vad in signals.

FieldTypeDescription
seq requiredinteger

Event sequence number. Starts at 1 and increases by one per event.

type required"vad.start"
tnumber

Audio time in seconds since the session's first sample. Not always increasing across events; vad.start and vad.end may be dated earlier than the event before them.

speaker"room"

vad.endyou receiveThe room went quiet. With vad in signals.

FieldTypeDescription
seq requiredinteger

Event sequence number. Starts at 1 and increases by one per event.

type required"vad.end"
tnumber

Audio time in seconds since the session's first sample. Not always increasing across events; vad.start and vad.end may be dated earlier than the event before them.

speaker"room"
durationnumber

turn.endyou receiveThe room's current turn has ended.

FieldTypeDescription
seq requiredinteger

Event sequence number. Starts at 1 and increases by one per event.

type required"turn.end"
tnumber

Audio time in seconds since the session's first sample. Not always increasing across events; vad.start and vad.end may be dated earlier than the event before them.

speaker"room"
p_eotnumber

Probability, from 0 to 1, that the user has finished their turn, at the moment the turn ended. With by: timeout it is usually low: Baton was not confident and the silence reached the timeout.

latency_msinteger
by"score" | "timeout"
profilestring
hintobject

Baton heard speech in this turn but no clear words. hint carries its best guess at what was said, with a confidence. It comes on turn.end when ready, otherwise in a turn.hint shortly after. Never logged or stored.

answerobject or null

Which of your expect answers the user gave, with a confidence, so your agent can act on it without interpreting a transcript. Present only on the turn that followed an agent.speech with expect. null when Baton could not tell (a session in a language other than English, or no result within 6 s). Never logged or stored.

turn.resumedyou receiveSpeech resumed within 2 s of turn.end.

FieldTypeDescription
seq requiredinteger

Event sequence number. Starts at 1 and increases by one per event.

type required"turn.resumed"
tnumber

Audio time in seconds since the session's first sample. Not always increasing across events; vad.start and vad.end may be dated earlier than the event before them.

speaker"room"
after_msinteger

turn.answeryou receiveWhich of your expected answers the user gave in the turn that just ended.

The result for a turn that followed an agent.speech with expect. It comes on the turn.end itself when ready; otherwise in this event, typically 2–3 s after the turn.end (occasionally about 4 s, never more than 6 s). turn_t is that turn.end's t: match on it. At most one per turn end. A turn.resumed cancels it with its turn end, and the answer comes again with the next turn.end. An answer still pending at session.end is not sent: wait for it before ending the session.

FieldTypeDescription
seq requiredinteger

Event sequence number. Starts at 1 and increases by one per event.

type required"turn.answer"
turn_t requirednumber

The t of the turn.end this answer is about.

answer requiredobject or null

Which of your expect answers the user gave, with a confidence, so your agent can act on it without interpreting a transcript. Present only on the turn that followed an agent.speech with expect. null when Baton could not tell (a session in a language other than English, or no result within 6 s). Never logged or stored.

{
  "type": "turn.answer",
  "seq": 5,
  "turn_t": 3.0,
  "answer": {
    "match": "feel good",
    "score": 0.91,
    "runner_up": "feel bad",
    "scores": {"feel good": 0.91, "feel bad": 0.06, "none": 0.03}
  }
}

turn.hintyou receiveBaton's best guess at words it heard in the turn that just ended.

Baton heard speech in a turn but no clear words. The hint is its best guess at what was said. It comes on the turn.end itself when ready; otherwise in this event, typically 2–3 s after the turn.end (occasionally about 4 s, never more than 6 s). turn_t is that turn.end's t: match on it. At most one per turn end, and none when every word was heard. A turn.resumed cancels it with its turn end. A hint still pending at session.end is not sent. Never logged or stored.

FieldTypeDescription
seq requiredinteger

Event sequence number. Starts at 1 and increases by one per event.

type required"turn.hint"
turn_t requirednumber

The t of the turn.end this hint is about.

hint requiredobject

Baton heard speech in this turn but no clear words. hint carries its best guess at what was said, with a confidence. It comes on turn.end when ready, otherwise in a turn.hint shortly after. Never logged or stored.

{
  "type": "turn.hint",
  "seq": 4,
  "turn_t": 3.0,
  "hint": {
    "suspect": "speech_without_words",
    "text": "Yes.",
    "certainty": "low"
  }
}

Barge-in

Speech over your agent: a real interruption, or a backchannel.

agent.speechyou sendTell Baton what your agent is saying, and when.

Telling Baton what your agent says makes its predictions better exactly where they are hardest: quiet users, noisy rooms, speakerphones, and short one-word answers.

  • Your agent's own voice is ignored. When the user hears your agent through a speaker, the microphone picks it up again. With text (and duration_s) or words, Baton knows that sound is your agent: it opens no turn and never stops your agent, while the user's own words still do.
  • Answers you expect are recognised. With expect on the question, Baton tells you which answer the user gave, with a confidence, so your agent can act on it at once (answer on turn.end, or turn.answer).
  • Barge-in. start and end tell Baton when your agent is talking, so speech over it is reported (bargein.onset, bargein.class).

Send start before your agent's audio can reach the user's microphone, and end when it stops. Every field but phase is optional. A malformed field closes the session with 1008 (see Errors and limits). A phase other than start or end is ignored.

FieldTypeDescription
type required"agent.speech"
phase required"start" | "end"
utterance_idstring

Your id for the agent utterance. Echoed on barge-in events (null when you sent none).

textstring

What the agent says. With duration_s, enough for Baton to ignore your agent's voice coming back through the user's speaker.

duration_snumber

How long the utterance plays, in seconds. Accepted on start and on end.

wordsarray of object

Instead of text, the agent's words with play times in seconds from this utterance's start message, if your TTS gives them.

expectarray of string

start only. The answers the agent expects to this question, e.g. ["feel good", "feel bad"]. Baton tells you which one the user gave in their NEXT turn (answer on its turn.end, or a turn.answer); then the list is cleared. A later start with expect replaces it, and one without clears it. Once the agent has finished, a one-word answer from the list opens the user's turn at once, even while the agent's voice is still dying away. Candidates must differ after ignoring case, punctuation and number spelling ("seven" = "7"), and none is reserved. Anything else closes the session with 1008. English only (session language en or auto). Never logged or stored.

{
  "type": "agent.speech",
  "phase": "start",
  "utterance_id": "sp_1"
}
{
  "type": "agent.speech",
  "phase": "end",
  "utterance_id": "sp_1"
}

bargein.onsetyou receiveThe user started speaking while your agent was talking.

Sent when the speech starts. bargein.class follows with the decision. Your agent's own voice coming back through the user's speaker never opens one.

FieldTypeDescription
seq requiredinteger

Event sequence number. Starts at 1 and increases by one per event.

type required"bargein.onset"
t requirednumber

Audio time in seconds since the session's first sample. Not always increasing across events; vad.start and vad.end may be dated earlier than the event before them.

agent_speaking requiredtrue
utterance_idstring or null
{
  "type": "bargein.onset",
  "seq": 7,
  "t": 12.1,
  "agent_speaking": true,
  "utterance_id": "sp_1"
}

bargein.classyou receiveWhether the interruption claims the floor or is a backchannel.

claim means the user wants to talk: stop or yield. backchannel ("mm-hmm", "right") means keep talking. Decided as soon as Baton is confident, typically a few hundred milliseconds into the interruption. p_claim is the probability, from 0 to 1, that the user is taking the floor; it is null when the user stopped too soon to judge (reported as a backchannel) and on a claim decided by a word.

A stop word ("stop", "wait", "hold on"), a floor grab ("no", "actually") or one of your answer words decides a claim at once. Such a claim carries text (the word or phrase, as in your list) and intent (stop or answer). It can follow a backchannel for the same interruption, and it comes with its own bargein.onset when none was open. One per agent utterance. Your agent's own voice saying "stop" never triggers it.

Rooms only: confirmed_by: two_speakers marks a stop said by someone in the room over your agent's own "stop".

FieldTypeDescription
seq requiredinteger

Event sequence number. Starts at 1 and increases by one per event.

type required"bargein.class"
t requirednumber

Audio time in seconds since the session's first sample. Not always increasing across events; vad.start and vad.end may be dated earlier than the event before them.

class required"claim" | "backchannel"
textstring

On a claim decided by a word: the stop word, floor grab or answer heard, as in your list (or Baton's). Absent otherwise.

intent"stop" | "answer"

With text: stop for a stop word or floor grab, answer for one of your answers.

confirmed_by"two_speakers"

Rooms, with text: a stop said by someone in the room over your agent's own "stop".

p_claim requirednumber or null

Probability, from 0 to 1, that the user is taking the floor (1 = certainly a claim, 0 = certainly a backchannel). Null when the user stopped too soon to judge, and on a claim decided by a word, which needs no probability.

decided_after_ms requiredinteger

Milliseconds from the onset to this decision.

utterance_idstring or null
{
  "type": "bargein.class",
  "seq": 8,
  "t": 12.4,
  "class": "claim",
  "p_claim": 0.9,
  "decided_after_ms": 300,
  "utterance_id": "sp_1"
}
{
  "type": "bargein.class",
  "seq": 9,
  "t": 15.2,
  "class": "claim",
  "text": "stop",
  "intent": "stop",
  "p_claim": null,
  "decided_after_ms": 100,
  "utterance_id": "sp_2"
}
Added in roomsWhat a room adds on top of the stream.

Transcripts

Per-speaker words, and clean cuts at turn boundaries.

finalizeyou sendFinalise every voice's pending word now (a turn boundary you decided).

Baton emits each voice's pending newest word as asr.final, then asr.flushed. Without it, a speaker's last word waits up to 1 s and can land after you have already cut the segment ("...in Saint" / "Paul").

FieldTypeDescription
type required"finalize"
{"type": "finalize"}

asr.partialyou receiveA voice's newest word or words, still subject to change. With partials in signals.

FieldTypeDescription
seq requiredinteger

Event sequence number. Starts at 1 and increases by one per event.

type required"asr.partial"
t requirednumber

Audio time in seconds since the session's first sample. Not always increasing across events; vad.start and vad.end may be dated earlier than the event before them.

speaker requiredstring

A voice in the room, numbered in order of first appearance. Stable for the session.

text requiredstring

The voice's newest word or words not yet final. Replaces the previous partial for this voice.

language requiredstring

The language this voice is decoded in.

{
  "type": "asr.partial",
  "seq": 2,
  "t": 3.2,
  "speaker": "spk_1",
  "text": "I",
  "language": "en"
}

asr.finalyou receiveWords from one voice that will not change.

FieldTypeDescription
seq requiredinteger

Event sequence number. Starts at 1 and increases by one per event.

type required"asr.final"
t requirednumber

Audio time in seconds since the session's first sample. Not always increasing across events; vad.start and vad.end may be dated earlier than the event before them.

speaker requiredstring

A voice in the room, numbered in order of first appearance. Stable for the session.

text requiredstring

Final words. Append to the voice's transcript.

t0 requirednumber

When the first of these words was first heard (seconds).

t1 requirednumber

When the last of these words was first heard (seconds).

language requiredstring
{
  "type": "asr.final",
  "seq": 4,
  "t": 3.52,
  "speaker": "spk_1",
  "text": "I never",
  "t0": 3.2,
  "t1": 3.52,
  "language": "en"
}

asr.flushedyou receiveEvery word pending at your finalize has been sent. Safe to cut segments.

FieldTypeDescription
seq requiredinteger

Event sequence number. Starts at 1 and increases by one per event.

type required"asr.flushed"
{"type": "asr.flushed", "seq": 6}

Languages

Each voice's language, and switching within your allowed set.

asr.languageyou receiveThe language Baton hears one voice speaking. With language in signals.

FieldTypeDescription
seq requiredinteger

Event sequence number. Starts at 1 and increases by one per event.

type required"asr.language"
t requirednumber

Audio time in seconds since the session's first sample. Not always increasing across events; vad.start and vad.end may be dated earlier than the event before them.

speaker requiredstring

A voice in the room, numbered in order of first appearance. Stable for the session.

language requiredstring
confidence requirednumber
{
  "type": "asr.language",
  "seq": 30,
  "t": 15.36,
  "speaker": "spk_0",
  "language": "en",
  "confidence": 0.9981
}

warning (language_mismatch)you receiveA voice sounds like a different language and the room has no allowed list.

FieldTypeDescription
seq requiredinteger

Event sequence number. Starts at 1 and increases by one per event.

type required"warning"
code"language_mismatch"
tnumber

Audio time in seconds since the session's first sample. Not always increasing across events; vad.start and vad.end may be dated earlier than the event before them.

speakerstring

A voice in the room, numbered in order of first appearance. Stable for the session.

languagestring

language.switchedyou receiveA voice is now transcribed in another language from your allowed list. With language in signals.

FieldTypeDescription
seq requiredinteger

Event sequence number. Starts at 1 and increases by one per event.

type required"language.switched"
tnumber

Audio time in seconds since the session's first sample. Not always increasing across events; vad.start and vad.end may be dated earlier than the event before them.

speakerstring

A voice in the room, numbered in order of first appearance. Stable for the session.

languagestring
modelstring

Diagnostic; may change or be removed.

{
  "type": "language.switched",
  "seq": 52,
  "t": 41.6,
  "speaker": "spk_2",
  "language": "es"
}

language.switch_recommendedyou receiveA voice is speaking a language from your allowed list that this room can't switch its transcript to. With language in signals.

That voice's asr.final keeps coming in the room's current language, so its words may be poor. Turn events are unaffected. To get a good transcript of that voice, start a new room with language set to include it: pin it if that person is the one you need, or put it first in allowed if most of the room speaks it.

FieldTypeDescription
seq requiredinteger

Event sequence number. Starts at 1 and increases by one per event.

type required"language.switch_recommended"
tnumber

Audio time in seconds since the session's first sample. Not always increasing across events; vad.start and vad.end may be dated earlier than the event before them.

speakerstring

A voice in the room, numbered in order of first appearance. Stable for the session.

languagestring

language.summaryyou receiveSeconds of speech per voice per language. Sent at the end, with language in signals.

FieldTypeDescription
seq requiredinteger

Event sequence number. Starts at 1 and increases by one per event.

type required"language.summary"
tnumber

Audio time in seconds since the session's first sample. Not always increasing across events; vad.start and vad.end may be dated earlier than the event before them.

speakersobject

{voice: {language: seconds of solo speech}}

{
  "type": "language.summary",
  "seq": 900,
  "t": 1802.24,
  "speakers": {
    "spk_0": {"en": 512.0},
    "spk_1": {"en": 301.0, "es": 12.0}
  }
}
Last updated 21 Oct 2026