> ## 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 finished recording



## OpenAPI

````yaml specs/dictation.yaml POST /v1/transcribe
openapi: 3.1.0
info:
  title: AssemblyAI Dictation API
  description: >-
    Short-form dictation that returns send-ready cleaned-up text together with
    the verbatim transcript, in a single HTTP call.
  version: 1.0.0
servers:
  - url: https://dictation.assemblyai.com
    description: Global (default — routes to nearest region)
  - url: https://dictation.us.assemblyai.com
    description: US data residency (us-east-1, us-east-2, us-west-1, us-west-2)
  - url: https://dictation.eu.assemblyai.com
    description: >-
      EU data residency (eu-central-1, eu-north-1, eu-south-1, eu-south-2,
      eu-west-1, eu-west-3)
security:
  - ApiKey: []
paths:
  /v1/transcribe:
    post:
      summary: Transcribe a finished recording
      description: |
        Send a complete recording and receive text ready to send, together with
        the verbatim transcript. Audio must be between 80 ms and 20 minutes,
        and at most 256 MB.

        This endpoint takes audio you already hold in full. The server reads
        the whole body before it starts transcribing, so the `config` part can
        come before or after `audio`, and can be left out to use the defaults.
        Besides WAV and raw PCM, it accepts compressed audio: AAC, MP3, M4A,
        Ogg/Opus, FLAC, and WebM.

        For audio that is still being recorded, use
        [`/v1/transcribe/live`](/api-reference/dictation-api/transcribe-live)
        instead. It uploads while the user speaks and accepts up to 120 seconds
        of WAV or raw PCM. The SDKs use `/v1/transcribe/live`, so this endpoint
        is called over HTTP.

        This endpoint is also served at `/transcribe`, without the version
        prefix.
      operationId: transcribeDictationRecording
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              required:
                - audio
              properties:
                config:
                  type: object
                  additionalProperties: false
                  description: >-
                    Transcription and rewrite configuration. Optional; when
                    omitted, the audio is transcribed with defaults, including
                    the default rewrite. Only the fields below are accepted. An
                    unknown field is rejected with a `400`.
                  properties:
                    sample_rate:
                      type: integer
                      description: >-
                        Source sample rate in Hz, for example `16000`. Required
                        when `audio` is `audio/pcm`. Not needed for WAV or
                        compressed formats, which carry it in the file.
                    channels:
                      type: integer
                      description: >-
                        Number of audio channels. Required when `audio` is
                        `audio/pcm`. Not needed for WAV or compressed formats.
                    language_codes:
                      type: array
                      items:
                        type: string
                        enum:
                          - en
                          - es
                          - de
                          - fr
                          - it
                          - pt
                          - tr
                          - nl
                          - sv
                          - 'no'
                          - da
                          - fi
                          - hi
                          - vi
                          - ar
                          - he
                          - ja
                          - ur
                          - zh
                          - ko
                          - ca
                          - gl
                          - ru
                          - ro
                          - et
                          - fa
                          - yue
                          - af
                          - mr
                          - zu
                          - xh
                          - nn
                      description: >-
                        Language or languages of the audio, as ISO language
                        codes. A code outside this set is rejected with a `400`.
                        When omitted, no language steering is applied.
                    stt_prompt:
                      type: string
                      maxLength: 6000
                      description: >-
                        Context for the transcription: a description of what the
                        audio is about, such as "A doctor dictating a patient
                        visit note." It describes the situation rather than
                        instructing the model, and is prepended to the base
                        transcription prompt, which always applies. Also
                        accepted as `prompt`; send one or the other, or the
                        request is rejected with `400`.
                    keyterms_prompt:
                      type: array
                      maxItems: 100
                      items:
                        type: string
                      description: >-
                        Terms to bias transcription toward, such as names or
                        jargon. Maximum 100 terms and 8000 characters in total.
                        The legacy names `keyterms` and `word_boost` are also
                        accepted; send only one of the three, or the request is
                        rejected with `400`.
                    llm_instruction:
                      type: string
                      nullable: true
                      description: >-
                        Plain-English description of the shape you want the text
                        in, which replaces the default cleanup task. Describe
                        only the transformation: rules about output format,
                        refusing to answer the text, and handling clean input
                        are enforced automatically. Omitting the field, or
                        setting it to `null`, keeps the default cleanup task,
                        which removes filler, applies punctuation and
                        capitalization, and can resolve self-corrections.
                    rewrite_mode:
                      type: string
                      enum:
                        - fast
                        - smart
                      default: fast
                      description: >-
                        Model tier that runs the rewrite. `fast`, the default,
                        gives a lighter cleanup at the lowest latency. `smart`
                        resolves self-corrections more consistently and follows
                        `llm_instruction` more reliably, but has higher latency.
                        Any other value is rejected with `400`.
                    llm:
                      $ref: '#/components/schemas/DictationLlmRequest'
                audio:
                  type: string
                  format: binary
                  description: >-
                    Audio bytes, between 80 ms and 20 minutes and at most 256
                    MB. Set the part's Content-Type to the format: `audio/wav`,
                    `audio/pcm` (raw 16-bit PCM), `audio/aac`, `audio/mpeg`
                    (MP3), `audio/mp4` (M4A), `audio/ogg` (Ogg/Opus),
                    `audio/flac`, or `audio/webm`.
            encoding:
              config:
                contentType: application/json
              audio:
                contentType: >-
                  audio/wav, audio/pcm, audio/aac, audio/mpeg, audio/mp4,
                  audio/ogg, audio/flac, audio/webm
      responses:
        '200':
          description: >-
            Transcription completed. The rewrite is best-effort: a failed
            rewrite still returns `200` with the transcription, `llm_response`
            set to `null`, and `llm_error` set. Fall back to `text` in that
            case, and never treat a non-`null` `llm_error` as a failed request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DictationResponse'
        '400':
          description: >-
            A malformed request body, or a Dictation-specific `config` field
            that fails validation, uses the `error`/`error_code` shape: a
            missing or empty `audio` part, an `audio` part over 256 MB, or
            `config` that is not valid JSON. Audio shorter than 80 ms, audio
            that cannot be decoded, and a transcription `config` field that
            fails validation, including an unknown field, use the
            `status`/`title`/`detail` shape instead.
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/ErrorResponse'
                  - $ref: '#/components/schemas/DetailErrorResponse'
        '401':
          description: Missing `Authorization` header, or an invalid API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DetailErrorResponse'
        '413':
          description: 'The audio is longer than 20 minutes (`title: "Audio Too Large"`).'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DetailErrorResponse'
        '415':
          description: The `audio` part's Content-Type is not a supported format.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DetailErrorResponse'
        '429':
          description: Rate limited. Back off and retry.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DetailErrorResponse'
        '502':
          description: >-
            Transcription upstream unavailable (`error_code: "upstream_error"`).
            Retry once, then surface an error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '503':
          description: Server at capacity. Back off and retry.
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/ErrorResponse'
                  - $ref: '#/components/schemas/DetailErrorResponse'
        '504':
          description: Transcription timed out. Retry once, then surface an error.
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/ErrorResponse'
                  - $ref: '#/components/schemas/DetailErrorResponse'
      x-codeSamples:
        - lang: bash
          label: cURL
          source: |
            curl -X POST https://dictation.assemblyai.com/v1/transcribe \
              -H 'Authorization: <YOUR_API_KEY>' \
              -F 'audio=@recording.mp3;type=audio/mpeg'
        - lang: python
          label: Python
          source: |
            import requests

            with open("recording.mp3", "rb") as f:
                audio = f.read()

            response = requests.post(
                "https://dictation.assemblyai.com/v1/transcribe",
                headers={"Authorization": "<YOUR_API_KEY>"},
                files={
                    "audio": ("recording.mp3", audio, "audio/mpeg"),
                    # Optional; omit for the defaults.
                    "config": (None, '{"language_codes": ["en"]}', "application/json"),
                },
                timeout=90,
            )
            response.raise_for_status()
            result = response.json()

            print(result["text"])          # verbatim transcript
            print(result["llm_response"])  # default cleanup rewrite
        - lang: javascript
          label: JavaScript
          source: >
            import { readFileSync } from "fs";


            const audio = readFileSync("recording.mp3");

            const form = new FormData();

            form.append("audio", new Blob([audio], { type: "audio/mpeg" }),
            "recording.mp3");


            const response = await fetch(
              "https://dictation.assemblyai.com/v1/transcribe",
              {
                method: "POST",
                headers: { Authorization: "<YOUR_API_KEY>" },
                body: form,
              }
            );


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


            const result = await response.json();

            console.log(result.text);         // verbatim transcript

            console.log(result.llm_response); // default cleanup rewrite
components:
  schemas:
    DictationLlmRequest:
      type: object
      description: >-
        Your own LLM Gateway [chat completions
        request](/llm-gateway/chat-completions) for the rewrite, used instead of
        `llm_instruction`. Send `llm` or `llm_instruction`, not both, or the
        request is rejected with `400`. Put the transcript in the request in one
        of two ways: write `prompt` or `messages` with `{{turn}}` where the
        transcript goes, or set `aai_prompt` to a [saved
        prompt](/llm-gateway/saved-prompts) that contains `{{ text }}`. The
        model gets exactly the prompt you send, without the guardrails that
        apply to `llm_instruction`. Only the fields below are accepted. Field
        names are case-sensitive, and any other field, such as `fallbacks`,
        `tools`, `stream` or `transcript_id`, is rejected with `400`. If LLM
        Gateway rejects or fails the request, the response is still `200` and
        `llm_error` says why. See [Sending your own LLM
        request](/dictation/transcript-rewriting#sending-your-own-llm-request).
      properties:
        model:
          type: string
          enum:
            - qwen3.5-4b-32k-fast
            - gemma-4-31b
            - gemini-3.5-flash-lite
          description: >-
            Model that runs the rewrite. In the EU region, use
            `qwen3.5-4b-32k-fast` or `gemini-3.5-flash-lite`. Any other model is
            rejected with `400`. Without `model`, `rewrite_mode` picks one.
        messages:
          type: array
          items:
            type: object
          description: >-
            Chat messages, as in an LLM Gateway chat completions request.
            Dictation renders each message as a Jinja2 template and fills
            `{{turn}}` with the transcript.
        prompt:
          type: string
          description: >-
            A single prompt, as in an LLM Gateway chat completions request.
            Dictation renders it as a Jinja2 template and fills `{{turn}}` with
            the transcript.
        temperature:
          type: number
          default: 0
          description: Sampling temperature. `0` unless you set it.
        top_p:
          type: number
          description: Nucleus sampling, as in LLM Gateway.
        top_k:
          type: integer
          description: Top-k sampling, as in LLM Gateway.
        max_tokens:
          type: integer
          maximum: 8192
          description: >-
            Maximum output tokens, at most 8192. If you leave it out, Dictation
            sizes it from the transcript, so a prompt that expands the text may
            need a larger value. A rewrite that runs out of tokens returns
            `llm_error: "truncated"`.
        max_completion_tokens:
          type: integer
          maximum: 8192
          description: Maximum completion tokens, at most 8192.
        response_format:
          type: object
          description: Response format, as in LLM Gateway.
        reasoning_effort:
          type: string
          description: Reasoning effort, as in LLM Gateway.
        zero_data_retention:
          type: boolean
          description: >-
            Dictation sets this to `true` on every LLM Gateway request,
            including ones that use `aai_prompt`, and you can't turn it off.
        aai_prompt:
          type: string
          description: >-
            Name of a [saved prompt](/llm-gateway/saved-prompts) in your
            account. Dictation passes the transcript as the `text` replacement,
            so put `{{ text }}` in the saved prompt. The model, `max_tokens` and
            every other setting come from the saved prompt, and the model and
            output limits above don't apply. Only `prompt_replacements` may
            accompany `aai_prompt`. Any other `llm` field, or `rewrite_mode`, is
            rejected with `400`.
        prompt_replacements:
          type: object
          additionalProperties:
            type: string
          description: >-
            Values for your own `{{ tag }}` placeholders in the saved prompt.
            Requires `aai_prompt`. Setting `text` or `transcript` is rejected
            with `400`: Dictation fills `text`, and LLM Gateway reserves
            `transcript`.
    DictationResponse:
      type: object
      required:
        - text
        - words
        - confidence
        - audio_duration_ms
        - session_id
      properties:
        text:
          type: string
          description: The verbatim transcript. Never altered by the LLM.
        words:
          type: array
          items:
            $ref: '#/components/schemas/Word'
          description: Per-word transcript objects.
        confidence:
          type: number
          format: float
          description: Overall transcription confidence (0–1).
        llm_response:
          type: string
          nullable: true
          description: >-
            The rewritten text, or `null` when the rewrite failed. Fall back to
            `text` when it is `null`.
        llm_error:
          type: string
          nullable: true
          enum:
            - timeout
            - error
            - truncated
            - prompt_not_found
            - context_exceeded
            - unsupported_param
            - rate_limited
            - invalid_request
            - upstream_error
          description: >-
            Set when the rewrite failed, and `null` on success. The
            transcription is still returned in `text`. `timeout`: the rewrite
            ran past its deadline. `error`: the model returned nothing usable,
            or an unexpected failure. `truncated`: the output hit `max_tokens`
            before finishing. `prompt_not_found`: your account has no saved
            prompt with the name in `llm.aai_prompt`. `context_exceeded`: the
            input is too long for the model's context window.
            `unsupported_param`: the model doesn't support a parameter that was
            sent. `rate_limited`: LLM Gateway returned `429`. `invalid_request`:
            LLM Gateway rejected the request with any other `4xx`.
            `upstream_error`: LLM Gateway returned a `5xx` or another non-`2xx`
            error.
        audio_duration_ms:
          type: number
          description: Duration of the submitted audio in milliseconds.
        session_id:
          type: string
          format: uuid
          description: >-
            Server-generated request identifier. Include it when reporting
            problems.
        request_time_ms:
          type: number
          format: float
          description: Total server-side processing time in milliseconds.
        auth_time_ms:
          type: number
          format: float
          description: >-
            Time in milliseconds spent authenticating the request, included in
            `request_time_ms`.
        sync_time_ms:
          type: number
          format: float
          description: The transcription portion of `request_time_ms`, in milliseconds.
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
          description: Human-readable error description.
        error_code:
          type: string
          description: >-
            Machine-readable error code, such as `bad_request`,
            `audio_too_large`, `capacity_exceeded`, `upstream_error`, or
            `upstream_timeout`.
    DetailErrorResponse:
      type: object
      description: >-
        The shape used by auth failures (`401`), rate limiting (`429`), and
        errors from the transcription step, including transcription `config`
        validation failures (`400`) and unsupported audio formats (`415`).
      properties:
        status:
          type: integer
        title:
          type: string
        detail:
          type: string
          description: Human-readable error description.
    Word:
      type: object
      required:
        - text
        - confidence
      properties:
        text:
          type: string
        confidence:
          type: number
          format: float
  securitySchemes:
    ApiKey:
      type: apiKey
      in: header
      name: Authorization
      description: >-
        Your AssemblyAI API key, sent as the raw key with no `Bearer` prefix. A
        missing header or an invalid key returns `401`.

````