Skip to main content
Both endpoints speak the same protocol. The URL picks the engine; everything else is identical. For a walkthrough with full examples see the Streaming transcription guide.

Engines

Connecting

Query parameters (both endpoints) Authentication, one of:
  1. Subprotocol list ["token", "<api key>"] on the upgrade. The socket is authenticated before it opens; a bad key is refused with HTTP 401.
  2. An auth message within 30 seconds of connecting (below).
Rejections at upgrade time: 400 for an invalid languages value, 401 for a bad key, 503 when the service is at capacity.

Client → server messages

Audio is sent as binary frames: 16 kHz, 16-bit signed little-endian PCM, mono, ideally 640 bytes (20 ms) per frame at a steady cadence. Control messages are JSON text frames:
object
Authenticate when no subprotocol was used. Must be the first message.
languages and metadata are optional. metadata is passed through unchanged to usage webhooks and cannot be set with subprotocol auth.
object
Signal that no more audio is coming. The engine flushes its last result. Keep the socket open until you receive it, then close.

Server → client messages

object
Authentication succeeded and the engine is configured. Send audio after this.
sessionId is the same id reported in usage webhooks. languages echoes the configuration actually applied.
object
A recognition result.
isFinal: false results are provisional and will be replaced. isFinal: true results are settled. On /v2/stream an interim carries the cumulative text of the current utterance so far; the matching final replaces it.
object
error and message carry the same text. Codes you may see:

Lifecycle

  1. Connect with the key in the subprotocol, or connect and send auth.
  2. Wait for ready.
  3. Send audio frames at a steady 20 ms cadence. Read transcript messages.
  4. Send end. Wait for the last isFinal: true.
  5. Close the socket.
Usage is reported once per session, after the socket closes, with type: "stream", the billed duration, and any metadata you attached.