For AI agents: a documentation index is available at /llms.txt. Markdown versions of all pages can be requested by appending `.md` to the URL, or by setting the `Accept` header to `text/markdown`.
Skip to main content
Transcription API

Realtime transcription

WSS wss://global.rt.speechmatics.com/v2/

Transcribe audio as you stream it, over one WebSocket connection. Open the connection and send StartRecognition with your audio format and transcription settings; then stream audio as binary messages, and transcripts arrive as they are ready. Every other message is a JSON object that names itself in its message field.

New to the Realtime API? Start with the quickstart.

Handshake

  • GET wss://global.rt.speechmatics.com/v2/

Routes each connection to the nearest region, for the lowest latency. To keep data in one region instead, connect to that region's endpoint, such as wss://eu.rt.speechmatics.com/v2. See Supported endpoints.

Authentication

Any one of:

  • apiKey Authorization: Bearer <token>

    Your API key, for server-side connections.

  • temporaryKey ?jwt=<key>

    A temporary key, for connections from a browser, which cannot set the Authorization header — and should not hold your long-lived API key. For example, wss://global.rt.speechmatics.com/v2?jwt=<temporary-key>.

Responses​

Switching Protocols. Connected: send StartRecognition to begin.

A successful handshake request:

GET /v2/ HTTP/1.1
Host: global.rt.speechmatics.com
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Key: ujRTbIaQsXO/0uCbjjkSZQ==
Sec-WebSocket-Version: 13
Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits
Authorization: Bearer wmz9fkLJM6U5NdyaG3HLHybGZj65PXp
User-Agent: Python/3.8 websockets/8.1

And its response:

HTTP/1.1 101 Switching Protocols
Server: nginx/1.17.8
Date: Wed, 06 Jan 2021 11:01:05 GMT
Connection: upgrade
Upgrade: WebSocket
Sec-WebSocket-Accept: 87kiC/LI5WgXG52nSylnfXdz260=

Send client → server

StartRecognition

Initiates a new recognition session.

message
"StartRecognition"
audio_format
AudioFormatone of
transcription_config
TranscriptionConfig

Contains configuration for this recognition session.

translation_config
TranslationConfig
optional

Specifies various configuration values for translation. All fields except target_languages are optional, using default values when omitted.

audio_events_config
AudioEventsConfig
optional

Contains configuration for Audio Events

AddAudio

A binary chunk of audio. The server confirms receipt by sending an AudioAdded message.

application/octet-stream
string<binary>

Raw audio bytes, in the encoding and sample rate given by audio_format in StartRecognition.

AddChannelAudio

Audio belonging to a specific channel.

message
"AddChannelAudio"
channel
string

The channel identifier to which the audio belongs.

data
string

The audio data in base64 format.

EndOfStream

Declares that the client has no more audio to send.

message
"EndOfStream"
last_seq_no
integer

EndOfChannel

Declares that the channel has no more audio to send.

message
"EndOfChannel"
channel
string

The channel identifier to which the audio belongs.

last_seq_no
integer

ForceEndOfUtterance

Requests a finalized transcript followed by an EndOfUtterance message. Supported by Enhanced, Standard, and Melia 1. The client decides when to send this message using its own turn detection.

message
"ForceEndOfUtterance"
channel
string
optional

The channel to request finalized transcript from. This field is only seen in multichannel.

timestamp
number<float>≥ 0
optional

Timestamp of the audio data that corresponds to the force end of utterance request. It's the number of seconds since the beginning of the audio.

SetRecognitionConfig

Allows the client to re-configure the recognition session.

The language field can be included in SetRecognitionConfig, but its value must match the language specified in the initial StartRecognition message. Attempting to change the language or any other transcription configuration parameter not listed below will result in an error.

message
"SetRecognitionConfig"
transcription_config
MidSessionTranscriptionConfig

Contains configuration for this recognition session.

GetSpeakers

Requests any detected speaker identifiers to be returned.

message
"GetSpeakers"
final
boolean
optional

Optional. This flag controls when speaker identifiers are returned. Defaults to false if omitted. When false, multiple GetSpeakers requests can be sent during transcription, each returning the speaker identifiers generated so far. To reduce the chance of empty results, send requests after at least one TranscriptAdded message is received to make sure that the server has processed some audio. When true, speaker identifiers are returned only once at the end of the transcription, regardless of how many final: true requests are sent. Even with final: true requests, you can still send final: false requests to receive intermediate speaker identifier updates.

Receive server → client

RecognitionStarted

Server response to StartRecognition, acknowledging that a recognition session has started.

message
"RecognitionStarted"
orchestrator_version
string
optional
id
string
optional
language_pack_info
LanguagePackInfo
optional

Properties of the language pack.

channel_ids
string[]
optional

AudioAdded

Server response to AddAudio, indicating that audio has been added successfully.

When clients send audio faster than real-time, the server may read data slower than it's sent. If binary AddAudio messages exceed the server's internal buffer, the server will process other WebSocket messages until buffer space is available. Clients receive AudioAdded responses only after binary data is read. This can fill TCP buffers, potentially causing WebSocket write failures and connection closure with prejudice. Clients can monitor the WebSocket's bufferedAmount attribute to prevent this.

message
"AudioAdded"
seq_no
integer

ChannelAudioAdded

Server response to AddChannelAudio, indicating that audio has been added successfully.

message
"ChannelAudioAdded"
seq_no
integer
channel
string

AddPartialTranscript

A partial transcript is a transcript that can be changed in a future AddPartialTranscript as more words are spoken until the AddTranscript Final message is sent for that audio.

Partials will only be sent if transcription_config.enable_partials is set to true in the StartRecognition message.

The message structure is the same as AddTranscript, with a few limitations.

For AddPartialTranscript messages the confidence field for alternatives has no meaning and should not be relied on.

message
"AddPartialTranscript"
format
string
optional

Speechmatics JSON output format version number.

metadata
RecognitionMetadata
results
RecognitionResult[]
channel
string
optional

The channel identifier to which the audio belongs. This field is only seen in multichannel.

forced
boolean
optional

Whether this message was triggered by a ForceEndOfUtterance message. This field is only seen on forced messages, where its value is true.

AddTranscript

Contains the final transcript of a part of the audio that the client has sent.

message
"AddTranscript"
format
string
optional

Speechmatics JSON output format version number.

metadata
RecognitionMetadata
results
RecognitionResult[]
channel
string
optional

The channel identifier to which the audio belongs. This field is only seen in multichannel.

forced
boolean
optional

Whether this message was triggered by a ForceEndOfUtterance message. This field is only seen on forced messages, where its value is true.

AddPartialTranslation

Contains a work-in-progress translation of a part of the audio that the client has sent.

message
"AddPartialTranslation"
format
string
optional

Speechmatics JSON output format version number.

language
string

Language translation relates to given as an ISO language code.

results
TranslatedSentence[]

AddTranslation

Contains the final translation of a part of the audio that the client has sent.

message
"AddTranslation"
format
string
optional

Speechmatics JSON output format version number.

language
string

Language translation relates to given as an ISO language code.

results
TranslatedSentence[]

EndOfTranscript

Server response to EndOfStream, after the server has finished sending all AddTranscript messages.

message
"EndOfTranscript"

AudioEventStarted

Start of an audio event detected.

message
"AudioEventStarted"
event
AudioEventStartData
channel
string
optional

The channel identifier to which the audio belongs. This field is only seen in multichannel.

AudioEventEnded

End of an audio event detected.

message
"AudioEventEnded"
event
AudioEventEndData
channel
string
optional

The channel identifier to which the audio belongs. This field is only seen in multichannel.

EndOfUtterance

Indicates the end of an utterance, triggered by a configurable period of non-speech or a client-sent ForceEndOfUtterance message. Enhanced and Standard support automatic silence-based detection, configured by the end_of_utterance_silence_trigger parameter in conversation_config (see End of utterance). Melia 1 does not support automatic silence-based detection and rejects this setting. With Melia 1, send ForceEndOfUtterance to receive an EndOfUtterance message.

Like punctuation, an EndOfUtterance has zero duration.

message
"EndOfUtterance"
metadata
EndOfUtteranceMetadata
channel
string
optional

The channel identifier to which the EndOfUtterance message belongs. This field is only seen in multichannel.

forced
boolean
optional

Whether this message was triggered by a ForceEndOfUtterance message. This field is only seen on forced messages, where its value is true.

LanguageInfo

Reports the word delimiter and writing direction for a language detected in the audio.

Sent only by the melia-1 model, which labels each word with the language it was spoken in. The message is emitted once per language code, immediately before that language first appears in an AddPartialTranscript or AddTranscript message. Use it to set word spacing and text direction when rendering the transcript (see LanguageInfo message).

message
"LanguageInfo"
language
string

The detected language code.

word_delimiter
string

The delimiter to place between words of this language when reconstructing the transcript.

writing_direction
WritingDirectionEnum"left-to-right""right-to-left"

The direction that words in the language should be written and read in.

partial
boolean
optional

Whether the message was triggered by a Partial transcript. This field is only seen when its value is true.

Info

Additional information sent from the server to the client.

message
"Info"
type
InfoTypeEnumone of

The kind of information an Info message carries.

reason
string
code
integer
optional
seq_no
integer
optional
quality
string
optional

Only set when type is recognition_quality. Quality-based model name. It is one of "telephony", "broadcast". The model is selected automatically, for high-quality audio (12kHz+) the broadcast model is used, for lower quality audio the telephony model is used.

usage
number
optional

Only set when type is concurrent_session_usage. Indicates the current usage (number of active concurrent sessions).

quota
number
optional

Only set when type is concurrent_session_usage. Indicates the current quota (maximum number of concurrent sessions allowed).

last_updated
string
optional

Only set when type is concurrent_session_usage. Indicates the timestamp of the most recent usage update, in the format YYYY-MM-DDTHH:MM:SSZ (UTC). This value is updated even when usage exceeds the quota, as it represents the most recent known data. In some cases, it may be empty or outdated due to internal errors preventing successful update.

region
string
optional

Only set when type is concurrent_session_usage. The region that reported this usage, for example eu.

Warning

Warning messages sent from the server to the client.

message
"Warning"
type
WarningTypeEnumone of

The kind of problem a Warning message reports.

reason
string
code
integer
optional
seq_no
integer
optional
duration_limit
number
optional

Only set when type is duration_limit_exceeded. Indicates the limit that was exceeded (in seconds).

Error

Error messages sent from the server to the client. After any error, the transcription is terminated and the connection is closed.

message
"Error"
type
ErrorTypeEnumone of

The kind of error an Error message reports.

invalid_message, protocol_error and unknown_error can be triggered as a response to any type of messages.

reason
string
code
integer
optional
seq_no
integer
optional

SpeakersResult

Server response to GetSpeakers request returning any detected speaker identifiers.

message
"SpeakersResult"
speakers
SpeakersResultItem[]

Connection close​

An Error message can be followed by a WebSocket close frame. Its code, and the reason it carries:

Close codeReason
1003protocol_error
1008policy_violation
1011internal_error
4001not_authorised
4003not_allowed
4004invalid_model
4005quota_exceeded
4006timelimit_exceeded
4013job_error

For 4005, 4013 and 1011 only, retry after at least 5–10 seconds.

Sessions also close when they idle or run too long; see Realtime limits.

Session

ClientServer
repeat while audio streams
at any time
Info↓
Error↓