Skip to main content

Overview

Send an audio file in a single call, get a transcript back in milliseconds. No polling, no session management. The SDKs wrap the whole round trip in one method:
The Sync API uses our flagship Universal-3.5 Pro model and accepts audio from 80 milliseconds up to 120 seconds. It transcribes with state-of-the-art accuracy in 19 languages. Not using an SDK? The same flow works over plain HTTP — see Using the HTTP API directly.
When to use Sync STTSync STT is ideal for pre-recorded audio clips under 2 minutes where you need an immediate response without polling — for example, voice message transcription, short call recordings, or voice agent pipelines that handle turn detection externally and submit completed utterances for transcription. For audio longer than 120 seconds, use Pre-recorded STT. For live microphone audio, use Real-time STT.

Before you begin

To complete this guide, you need:
  • An API key — browse to API Keys in your dashboard and copy your key. Every example below reads it from an environment variable, so set it once:
  • An audio file in WAV format (or raw PCM S16LE), between 80 milliseconds and 120 seconds long.
  • Python 3.8+ for the Python SDK, or Node.js 18+ for the JavaScript SDK. The HTTP examples at the bottom of this page need Python 3.8+, Node.js 18+, or cURL.

Transcribe your first file

Step 1: Install the SDK

Step 2: Run your first transcription

Save this as transcribe.py (Python) or transcribe.mjs (JavaScript), next to a sample.wav file:
Then run it — python transcribe.py or node transcribe.mjs. You’ll see the transcript printed:
transcribe() accepts a local file path or raw audio bytes — an open binary file object in Python, or a Uint8Array, Blob, or readable stream in JavaScript — but not a URL. The Sync API has no URL ingestion; for remote files, download them first or use Pre-recorded STT.

Customize your request

The call above works with no extra configuration. Pass a config to change how the audio is transcribed — in Python a SyncTranscriptionConfig, either as the transcriber’s default (SyncTranscriber(config=...)) or per call (transcribe(data, config=...)); in JavaScript, a plain object as the second argument to transcribe().

Select a model

model selects the sync speech model and defaults to universal-3-5-pro. Set it explicitly to pin the model:

Choose a language

Pass language_codes as a list of ISO 639-1 codes — one code for monolingual audio, several for multilingual audio:

Get word timestamps

Per-word timings are opt-in. Set timestamps=True to compute start/end for every word, at a small latency cost. Without it, words carry text and confidence only:

Transcribe raw PCM audio

WAV files carry their sample rate and channel count in the file header. Raw PCM (S16LE little-endian) doesn’t, so set sample_rate and channels on the config — both are required, and setting either one routes the audio as raw PCM:

Complete example

Here’s the complete, runnable script — the call above plus options and error handling:
Calling the Sync API repeatedly? warm() opens the connection ahead of time so your next transcribe() doesn’t pay the DNS, TCP, and TLS handshake on the critical path. See Connection pre-warming.

What you get back

transcribe() returns a SyncTranscriptResponse with the transcript and word-level details: Failed requests raise SyncTranscriptError, which carries the HTTP status, a machine-readable error code (for example bad_audio, audio_too_large, capacity_exceeded, inference_timeout), and a retry-after value in seconds for 429/503 responses — named status_code/error_code/retry_after in the Python SDK and status/errorCode/retryAfter in the JavaScript SDK. See Error handling for status codes and retry guidance.

Using the HTTP API directly

If you prefer to call the Sync API over HTTP without an SDK, post the audio to POST https://sync.assemblyai.com/transcribe and read the transcript out of the JSON response. The Sync API accepts multipart/form-data with an audio part. For WAV files, set the part’s Content-Type to audio/wav. Authenticate with your key in the Authorization header (no Bearer prefix), and send the X-AAI-Model: universal-3-5-pro header — it is required on every request.
Replace <YOUR_API_KEY> in the request header:
The response JSON is printed to stdout. Pipe to jq to extract fields:

Response shape

A successful request returns a JSON object with the transcript and word-level details:

Sending raw PCM audio

When your audio is raw PCM (S16LE little-endian), set the audio part Content-Type to audio/pcm and include sample_rate and channels in the config part:

Next steps

Need help?

If you get stuck, contact our support team at support@assemblyai.com or create a support ticket. Include the session_id from the response to help us look up your request.