> ## Documentation Index
> Fetch the complete documentation index at: https://assemblyai.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Transcribe a short audio file

> Learn how to transcribe an audio file synchronously with the Sync API.

## Overview

Send an audio file in a single HTTP request, get a transcript back in milliseconds. No polling, no session management.

<Tabs>
  <Tab title="Python" language="python">
    ```python expandable theme={null}
    import requests

    with open("sample.wav", "rb") as f:
        audio = f.read()

    response = requests.post(
        "https://sync.assemblyai.com/transcribe",
        headers={
            "Authorization": "<YOUR_API_KEY>",
            "X-AAI-Model": "universal-3-5-pro",
        },
        files={
            "audio": ("sample.wav", audio, "audio/wav"),
        },
        timeout=60,
    )
    response.raise_for_status()
    result = response.json()
    print(result["text"])
    ```
  </Tab>

  <Tab title="JavaScript" language="javascript">
    ```javascript expandable theme={null}
    import { readFileSync } from "fs";

    const audio = readFileSync("sample.wav");
    const form = new FormData();
    form.append("audio", new Blob([audio], { type: "audio/wav" }), "sample.wav");

    const response = await fetch("https://sync.assemblyai.com/transcribe", {
      method: "POST",
      headers: {
        Authorization: "<YOUR_API_KEY>",
        "X-AAI-Model": "universal-3-5-pro",
      },
      body: form,
    });

    if (!response.ok) {
      const error = await response.json();
      throw new Error(error.message || error.detail);
    }

    const result = await response.json();
    console.log(result.text);
    ```
  </Tab>

  <Tab title="cURL" language="bash">
    ```bash expandable theme={null}
    curl -X POST https://sync.assemblyai.com/transcribe \
      -H 'Authorization: <YOUR_API_KEY>' \
      -H 'X-AAI-Model: universal-3-5-pro' \
      -F 'audio=@sample.wav;type=audio/wav'
    ```
  </Tab>
</Tabs>

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](/sync-stt/language-selection#supported-languages).

<Note>
  **When to use Sync STT**

  Sync 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](/pre-recorded-audio/getting-started/transcribe-an-audio-file).
  For live microphone audio, use [Real-time STT](/streaming/getting-started/transcribe-streaming-audio).
</Note>

## Before you begin

To complete this guide, you need:

* An AssemblyAI API key — get one by signing up at [assemblyai.com](https://www.assemblyai.com)
* An audio file in WAV format (or raw PCM S16LE)
* Python 3.8+, Node.js 18+, or cURL

## Step 1: Configure your API key

Browse to [API Keys](https://www.assemblyai.com/dashboard/home) in your dashboard and copy your API key.

<Tabs>
  <Tab title="Python" language="python">
    ```python theme={null}
    YOUR_API_KEY = "<YOUR_API_KEY>"
    ```
  </Tab>

  <Tab title="JavaScript" language="javascript">
    ```javascript theme={null}
    const YOUR_API_KEY = "<YOUR_API_KEY>";
    ```
  </Tab>

  <Tab title="cURL" language="bash">
    Replace `<YOUR_API_KEY>` in the request header:

    ```bash theme={null}
    -H 'Authorization: <YOUR_API_KEY>'
    ```
  </Tab>
</Tabs>

## Step 2: Send the audio file

The Sync API accepts `multipart/form-data` with an `audio` part. For WAV files, set the part's Content-Type to `audio/wav`. The `X-AAI-Model: universal-3-5-pro` header is required on every request.

<Tabs>
  <Tab title="Python" language="python">
    Install the `requests` library if you haven't already:

    ```bash theme={null}
    pip install requests
    ```

    Send the audio file:

    ```python theme={null}
    import requests

    with open("sample.wav", "rb") as f:
        audio = f.read()

    response = requests.post(
        "https://sync.assemblyai.com/transcribe",
        headers={
            "Authorization": "<YOUR_API_KEY>",
            "X-AAI-Model": "universal-3-5-pro",
        },
        files={
            "audio": ("sample.wav", audio, "audio/wav"),
        },
        timeout=60,
    )
    response.raise_for_status()
    ```
  </Tab>

  <Tab title="JavaScript" language="javascript">
    ```javascript theme={null}
    import { readFileSync } from "fs";

    const audio = readFileSync("sample.wav");
    const form = new FormData();
    form.append("audio", new Blob([audio], { type: "audio/wav" }), "sample.wav");

    const response = await fetch("https://sync.assemblyai.com/transcribe", {
      method: "POST",
      headers: {
        Authorization: "<YOUR_API_KEY>",
        "X-AAI-Model": "universal-3-5-pro",
      },
      body: form,
    });

    if (!response.ok) {
      const error = await response.json();
      throw new Error(error.message || error.detail);
    }
    ```
  </Tab>

  <Tab title="cURL" language="bash">
    ```bash theme={null}
    curl -X POST https://sync.assemblyai.com/transcribe \
      -H 'Authorization: <YOUR_API_KEY>' \
      -H 'X-AAI-Model: universal-3-5-pro' \
      -F 'audio=@sample.wav;type=audio/wav'
    ```
  </Tab>
</Tabs>

<Note>
  **Sending raw PCM audio**

  If your audio is raw PCM (S16LE little-endian), set the part Content-Type to
  `audio/pcm` and include `sample_rate` and `channels` in a `config` part.
  See [Sending raw PCM audio](#sending-raw-pcm-audio) below for a full example.
</Note>

## Step 3: Parse the response

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

```json theme={null}
{
  "text": "Hi, I'm calling about my Best Buy order...",
  "words": [
    { "text": "Hi",  "start": 0,   "end": 200, "confidence": 0.91 },
    { "text": "I'm", "start": 220, "end": 320, "confidence": 0.88 }
  ],
  "confidence": 0.87,
  "audio_duration_ms": 101567,
  "session_id": "eb92c4ff-4bbb-429f-9b99-7279d7fe738f"
}
```

| Field               | Description                                                                        |
| ------------------- | ---------------------------------------------------------------------------------- |
| `text`              | Full transcript of the audio.                                                      |
| `words`             | Word-level timestamps (`start`, `end`, in milliseconds) and per-word `confidence`. |
| `confidence`        | Overall transcript confidence score (0–1).                                         |
| `audio_duration_ms` | Duration of the submitted audio in milliseconds.                                   |
| `session_id`        | Server-generated UUID. Include this when contacting support.                       |

<Tabs>
  <Tab title="Python" language="python">
    ```python theme={null}
    result = response.json()
    print(result["text"])
    print(result["session_id"])
    ```
  </Tab>

  <Tab title="JavaScript" language="javascript">
    ```javascript theme={null}
    const result = await response.json();
    console.log(result.text);
    console.log(result.session_id);
    ```
  </Tab>

  <Tab title="cURL" language="bash">
    The response JSON is printed to stdout. Pipe to `jq` to extract fields:

    ```bash theme={null}
    curl -X POST https://sync.assemblyai.com/transcribe \
      -H 'Authorization: <YOUR_API_KEY>' \
      -H 'X-AAI-Model: universal-3-5-pro' \
      -F 'audio=@sample.wav;type=audio/wav' \
      | jq '.text'
    ```
  </Tab>
</Tabs>

## 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:

<Tabs>
  <Tab title="Python" language="python">
    ```python theme={null}
    import json
    import requests

    with open("sample.pcm", "rb") as f:
        audio = f.read()

    response = requests.post(
        "https://sync.assemblyai.com/transcribe",
        headers={
            "Authorization": "<YOUR_API_KEY>",
            "X-AAI-Model": "universal-3-5-pro",
        },
        files={
            "audio": ("sample.pcm", audio, "audio/pcm"),
            "config": (
                None,
                json.dumps({"sample_rate": 16000, "channels": 1}),
                "application/json",
            ),
        },
        timeout=60,
    )
    response.raise_for_status()
    print(response.json()["text"])
    ```
  </Tab>

  <Tab title="JavaScript" language="javascript">
    ```javascript theme={null}
    import { readFileSync } from "fs";

    const audio = readFileSync("sample.pcm");
    const form = new FormData();
    form.append("audio", new Blob([audio], { type: "audio/pcm" }), "sample.pcm");
    form.append(
      "config",
      new Blob(
        [JSON.stringify({ sample_rate: 16000, channels: 1 })],
        { type: "application/json" }
      )
    );

    const response = await fetch("https://sync.assemblyai.com/transcribe", {
      method: "POST",
      headers: {
        Authorization: "<YOUR_API_KEY>",
        "X-AAI-Model": "universal-3-5-pro",
      },
      body: form,
    });

    const result = await response.json();
    console.log(result.text);
    ```
  </Tab>

  <Tab title="cURL" language="bash">
    ```bash theme={null}
    curl -X POST https://sync.assemblyai.com/transcribe \
      -H 'Authorization: <YOUR_API_KEY>' \
      -H 'X-AAI-Model: universal-3-5-pro' \
      -F 'audio=@sample.pcm;type=audio/pcm' \
      -F 'config={"sample_rate":16000,"channels":1};type=application/json'
    ```
  </Tab>
</Tabs>

## Next steps

* [Prompting and keyterms](/sync-stt/prompting-and-keyterms) — improve accuracy with custom prompts and keyterm biasing
* [Conversation context](/sync-stt/conversation-context) — pass prior dialogue for multi-turn continuity
* [Language selection](/sync-stt/language-selection) — transcribe in any of the 19 supported languages
* [Audio requirements](/sync-stt/audio-requirements) — duration, size, and format constraints
* [Error handling](/sync-stt/error-handling) — status codes and retry guidance
* [Cloud endpoints & data residency](/sync-stt/endpoints-and-data-zones) — use the EU endpoint for data residency
* [API reference](/api-reference/sync-api/transcribe) — full endpoint documentation

## Need help?

If you get stuck, contact our support team at [support@assemblyai.com](mailto:support@assemblyai.com) or create a [support ticket](https://www.assemblyai.com/contact/support). Include the `session_id` from the response to help us look up your request.
