Skip to main content

Overview

The Live Speech API turns a live audio stream into text in real time over a single, authenticated WebSocket. You open one connection, send a short JSON config handshake, then stream raw audio frames. The server replies with transcript frames as each segment of speech is finalized — each one carrying precise word-level timings and, optionally, per-speaker turns. The API is designed for clinical dictation and conversation capture, so it is built around three guarantees: medical-grade accuracy, a continuous absolute timeline that survives reconnects, and strict privacy (audio is never written to disk and transcript text is never logged).
One socket, one session. Everything — config, audio, control, transcripts, acknowledgements and errors — flows over a single WebSocket. There is nothing else to poll.

How it works

1

Connect & authenticate

Open a WebSocket to the endpoint with a valid JWT passed as the token query parameter. The token is verified during the handshake.
2

Send a config handshake

Your first message is a single JSON config frame that declares your audio format, an optional language hint, and how you want speech chunked.
3

Receive session_ready

The server echoes the effective (validated and clamped) configuration and a session_id. You may now start streaming.
4

Stream audio

Send raw audio as binary frames of any length. Use JSON control frames to flush (end_utterance) or end (close) the session.
5

Receive transcripts

For each finalized segment the server sends a transcript frame with text, word timings, and a processed_until high-water mark.

Key features

Real-time captions

Finalized segments arrive as you speak. Tune latency vs. density with a single chunk.strategy setting.

Word-level timings

Every transcript carries per-word start/end times on one absolute timeline.

Speaker separation

Enable diarization to receive per-speaker turns (for example clinician vs. patient).

Resilient reconnects

processed_until and timeline_offset_seconds let a dropped connection resume with no lost transcript and one continuous timeline.

Multilingual

Automatic language detection across a wide set of European languages, including mid-conversation switches.

JWT-secured

Every connection is authenticated at the handshake with your JWT.

Connection at a glance

Endpoint
wss://speech.medisync.me/api/v2/ws/transcribe?token=<JWT>
PropertyValue
TransportWebSocket (WSS, TLS)
AuthenticationJWT in the token query parameter (verified at handshake)
First messageJSON config frame
AudioBinary frames — raw 16-bit PCM (pcm_s16le) or wav
Server messagesJSON: session_ready, transcript, ack, backpressure, status, error
Protocol version2.0

Message flow

One session per user

Each user may have one active live session at a time. If a second connection is opened while a session is still active, it is rejected with an error frame of code: "session_conflict" and the socket is closed. Close the previous socket before reconnecting.
This rule is what makes reconnection safe: because only one session can be live, a reconnecting client always resumes a single, unambiguous timeline. See Reconnection.

Privacy

Transcript text travels only over your authenticated socket. The service never writes audio to disk and never logs transcript text or PII. Nothing you stream is retained after the socket closes.

Next steps

Connection

Endpoint, JWT auth via query parameter, handshake sequence, and close codes.

Session config

Every config field, defaults, clamping, and the session_ready echo.

Messages

Audio frames, control frames, and the full transcript schema.

Reconnection

Resume mid-recording with no lost transcript and one continuous timeline.

Audio requirements

Formats, sample rate, channels, and chunking guidance.

Errors

Error frame schema, the full code table, and fatal/close semantics.