Skip to main content
By default, /transcribe returns final transcripts as segments: multi-word phrases with one start and end time for the whole phrase. With wordLevel enabled, every recognized word comes back as its own item with its own timestamps. Per-word timings let you highlight the word being spoken while the audio plays back, the karaoke-style pattern this guide builds for a dictation verification UI. This guide walks through enabling wordLevel on a live /transcribe session, handling the word-level messages, and driving highlight-on-playback. The same per-word timestamps are available for pre-recorded files through /transcripts; see Transcribe a pre-recorded file at the end.

Feature availability:

/transcribe
/streams
/transcripts


Enable word-level transcripts

Enable wordLevel in the configuration message of your /transcribe session:
Configuration message
The same option exists on the other speech to text endpoints. On /streams, include wordLevel in the configuration: the transcript data is already a list, and each item is a word in the /streams segment schema. On /transcripts, set it on the create request, described in Transcribe a pre-recorded file.
Interim previews are not split into words. When interimResults is also enabled, previews arrive as a one-element list carrying the in-progress segment, and the first finalized batch replaces the preview. See Interim Results for the interim feature and word-level transcripts for the response schema.

Handle word-level messages

During dictation your client receives two kinds of transcript messages with wordLevel enabled:
  • Final batches: data is a list of word items with isFinal of true, one message per finalized utterance.
  • Interim previews: data is a one-element list whose item carries the in-progress segment with isFinal of false (only when interimResults is enabled).
Accumulate the final word items in order and keep the latest preview text separately:
JavaScript
Both shapes are intentional: without wordLevel, data keeps the singular segment object sessions have always used; with wordLevel, every finalized word arrives in one list message. The handler therefore narrows with Array.isArray before reading the message fields.
To display the transcript, join the word items using the spacing and casing rules described in Transcript Text Handling, and show the interim preview as ghost text following the committed words; see Interim & final result handling for the preview patterns.
Your words array now carries one item per spoken word, with second-precision timings: that list is the input for the player in the next section. Record the audio in parallel to the dictation session, for example with the browser MediaRecorder API, to replay it afterwards.

Highlight the spoken word during playback

As the audio plays, highlight the word whose time span contains the playback position, and seek the audio when the user clicks a word. The words are ordered by start time, so a binary search finds the active word cheaply, and the loop runs on requestAnimationFrame for smooth highlighting at display frame rate; the timeupdate event fires only a few times per second, which makes the highlight visibly stutter.
JavaScript
Render one element per word and toggle the active styling in onActiveWordChange; to let users seek, set audio.currentTime = words[index].start when the word element is clicked. Keep the layout stable while highlighting: bold text is wider than regular text, so give each word a fixed horizontal padding that absorbs the difference, or the line reflows at every word change.
JavaScript

Transcribe a pre-recorded file

When the audio is a pre-recorded file instead of a live session, run the /transcripts REST pipeline from the File transcription guide and set wordLevel on the create request:
Create-transcript request (excerpt)
The finalized transcript then holds one segment per word or entity, each with text, start, and end in milliseconds; note the unit difference from the live /transcribe word items, which use seconds. Divide the start and end times by 1000, map them into PlayerWord objects, and the player from Highlight the spoken word during playback works unchanged. See Create Transcript and Get Transcript for the request and response schemas.

Next steps

Word-level transcripts

The response schema for /transcribe sessions with wordLevel enabled.

Transcript Text Handling

Spacing and casing rules for joining words and segments into display text.

Interim Results

How interim previews behave on /transcribe.

File transcription

The full /transcripts pipeline for pre-recorded audio.