Skip to main content
Streaming transcription returns partial and final text while audio is being captured. Connect over WebSocket, wait for the connected status message, then send base64-encoded audio chunks.

Connect

The endpoint is:
Server-side WebSocket clients should authenticate with headers:
Browser WebSocket APIs cannot set custom headers. For a browser integration, use a short-lived API token issued for the account and connect with account_id plus token query parameters. Never place a permanent API key in a URL or browser bundle. The SDKs create short-lived streaming tokens but do not manage the WebSocket or audio capture. Use the WebSocket library appropriate for your application.

SDK

These server-side examples use the Sully SDK for token creation and a WebSocket library for the connection.
The file examples close the connection after two seconds without a server message, allowing final results to drain without leaving an idle billable session open. For live capture, close the WebSocket explicitly when the user stops recording. For live capture, send short, consistently paced chunks instead of reading the whole file at once.

Query parameters

Example URL before URL encoding:

Wait for readiness

Do not send audio immediately after the WebSocket opens. Wait for:
The server drops audio received before recognition is ready.

Send audio

Each WebSocket message is JSON with a base64-encoded audio chunk:
The bytes must match the encoding and sample_rate declared at connection time. For linear16, send signed 16-bit little-endian PCM. Small, consistently paced chunks—about 50–200 ms of audio—work well for live capture. Malformed messages are ignored so that a later valid audio frame can continue the session.

Receive transcripts

Partial and final results share one shape:
Use is_final as the canonical finality field. isFinal is included for compatibility. Timing values may be null, and word objects can contain additional normalized metadata. Render partial text as provisional and replace it when a final segment arrives.

Errors and reconnects

The server can send an error message before closing:
A session can last up to two hours. A network or service interruption ends the current session; reconnecting creates a new session.

Usage behavior

Billable streaming time starts when the server sends connected, not when the WebSocket transport opens. Idle time after readiness counts. Time spent starting transcription and draining final results after audio closes does not count.