GET /ws/transcribe WebSocket.
Send each message as a UTF-8 JSON text frame containing exactly one JSON object. Audio must be Base64-encoded and included in the JSON payload. Do not send audio as a binary WebSocket frame.
Message format
Each outbound message is a JSON object with atype field. For audio chunks, the payload field is audioData.
Audio chunks
Send audio withtype set to AUDIO:
audioData value must be:
- Standard Base64 (RFC 4648).
- An encoding of the raw PCM_S16LE bytes you intend to send.
- Sent as a JSON string, regardless of the programming language you use.
End-of-audio message
When you finish sending audio on the WebSocket, send oneEVENT message with event set to AUDIO_END:
Dictation
/ws/transcribe does not use START_TIME, does not use ambient-style AUDIO messages with a data field, and does not use the ambient end marker RU9G. Use audioData for chunks, and send an EVENT message with event set to AUDIO_END when you are done sending audio.Required message order
For each logical stream of audio on the socket:- Send one or more
AUDIOmessages. Each message includes oneaudioDatachunk. - After the last audio chunk you intend to send on that connection, send one
EVENTmessage witheventset toAUDIO_END.
START_TIME step and no ambient RU9G end marker on this endpoint.
Example flow
This example shows the outbound message sequence for one stream: multipleAUDIO chunks, followed by AUDIO_END.
Audio format and chunking
Use raw PCM_S16LE audio chunks in eachaudioData message after Base64 decode.
Audio streaming recommendations
Sample Rate of 16 kHz
Stream Dictation audio at 16 kHz, which matches the capture rate used in the Dictation streaming examples.
Mono Channel
Send a single mono channel of audio, not stereo or multi-channel.
PCM_S16LE Encoding
Encode as PCM_S16LE (PCM signed 16-bit little-endian). Remove WAV headers or decode to raw PCM before you send.
About 100 ms per Chunk
For 16 kHz, mono, 16-bit audio, about 3200 bytes per chunk is about 100 ms of audio. Size chunks to your capture pipeline if your encoder differs.
Stream at Real-Time Speed
Pace audio chunks to match their actual duration and stream at or near real time, rather than sending buffered audio as fast as possible.
PCM vs WAV
PCM_S16LE is raw audio data..wav is a container format and usually includes a header before the audio data.
If your source is WAV, skip the 44-byte header before chunking, or decode the file to raw PCM before sending. Use 0 as the offset if your buffer is already raw PCM. Sending WAV headers as PCM reduces recognition quality and makes debugging harder.
Recommended audio format
- Encoding: PCM_S16LE, PCM signed 16-bit little-endian, same family as LINEAR16 at 16 kHz mono in typical capture pipelines.
- Channels: Mono.
- Sample rate: 16 kHz, aligned with what your integration expects.
Chunk size
Send audio in small chunks during streaming. For 16 kHz, mono, 16-bit audio, about 3200 bytes per chunk is a common choice, which is about 100 ms per message. Size chunks to your capture pipeline if your encoder differs.Encode each chunk
For everyAUDIO message:
- Take raw PCM_S16LE bytes.
- Encode the bytes using standard Base64 (RFC 4648).
- Send the encoded string as
audioData.
Related topics
Stream Dictation Audio
How Dictation streaming works, prerequisites, and when to use
/ws/transcribe.Ambient Wire Format
Outbound message contract for Ambient
GET /ws/stream.Dictation Transcript Frames
Inbound partial and final transcript frames for
/ws/transcribe.Complete the Session
Close the socket, end with REST, and troubleshoot common errors.