Skip to navigation

WebSockets

The channel for streaming audio and receiving transcription results. Connect to wss://in.api.murf.ai/v1/transcription/stream-input and authenticate with your API key (query or header). See bindings below.

Speech to Text (Beta) is available in the India region only. Connect to wss://in.api.murf.ai/v1/transcription/stream-input.

Handshake

WSS
wss://in.api.murf.ai/v1/transcription/stream-input

Headers

api_keystringOptional
Your Murf API key.
api-keystringOptional

Your Murf API key (hyphenated header name).

Query parameters

api_keystringOptional

Your Murf API key. Required unless you send the api-key header.

languagestringOptionalDefaults to auto

Language of the audio. One of en_IN (English, India), as (Assamese), bn (Bengali), gu (Gujarati), hi (Hindi), kn (Kannada), ml (Malayalam), mr (Marathi), or (Odia), pa (Punjabi), ta (Tamil), te (Telugu); auto (default) to detect from every supported language; or a comma-separated list such as hi,en_IN to detect from a smaller set. Each value also accepts the India region, for example hi_IN or en-IN.

keywordsstringOptional

Comma-separated words or phrases to boost during recognition. URL-encode spaces (for example voice%20clone).

alphadoubleOptional0-1Defaults to 0.5

How strongly to boost keywords. Higher values increase their influence.

text_formattingbooleanOptionalDefaults to false

Set to true to format numbers and similar terms in Hindi and English (India) transcripts. Has no effect for other languages.

commit_modestringOptional

Coming soon. commit_mode=auto will end a turn when the caller stops speaking. Accepted today but ignored. A turn ends only when you send Finalize or CloseStream.

bvcbooleanOptional

Coming soon. bvc=true will remove background voices before transcription. Accepted today but ignored.

Send

setAudioConfigurationobjectRequired

Optional. Send once, as the first text message, before any binary audio. If omitted, the server expects 16-bit PCM, 16 kHz, mono.

OR
AudiostringRequiredformat: "binary"

Binary WebSocket frames, encoded as declared in AudioConfig (or raw 16-bit PCM, 16 kHz, mono if no AudioConfig was sent). For Opus, send one Opus packet per frame, without an Ogg or WebM container.

OR
FinalizeobjectRequired

Flush pending speech immediately and send a final message with rawEvent.event set to EndOfTurn and rawEvent.trigger set to manual. The connection stays open; audio sent afterwards starts the next turn. rawEvent.turn_index goes up by one, rawEvent.sequence_id keeps counting, and audio_window_start / audio_window_end stay relative to the start of the session.

OR
CloseStreamobjectRequired

Flush pending speech, send a final message if a turn is still open, then close the WebSocket with code 1000.

OR
KeepAliveobjectRequired
Send while you are not sending audio to stop the connection from closing due to inactivity.

Receive

PartialobjectRequired

Sent while the caller is speaking. Each partial contains the whole turn up to that point, so replace the text you are showing instead of appending to it. Word timestamps are not included.

OR
FinalobjectRequired

Sent after Finalize or CloseStream. Use transcript as the caller’s utterance, and read rawEvent.words for word timestamps. If there was no pending speech, transcript is empty.

OR
QuotaWarningobjectRequired
Sent at most once per session when remaining funds reach the warning threshold. The stream stays open until credits run out or the client closes it.
OR
ErrorobjectRequired

Sent immediately before the server closes the WebSocket. The close code identifies the cause: 4001 invalid or missing API key; 4002 invalid audio config, undecodable audio, invalid JSON, or invalid query parameter; 4003 insufficient credits at connect; 4004 concurrency limit reached; 4005 credits exhausted mid-session; 4006 API key revoked mid-session; 4008 no audio or KeepAlive (initial_timeout or idle_timeout); 4010 billing service unreachable at connect; 4011 speech detection unavailable at connect.