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

# Punctuation and formatting

## Formatting

`format_text` lets you control how numbers and other entities in your transcript are formatted. By default, `format_text` is `true`, so numbers, dates, and similar entities are formatted for readability.

When `format_text` is set to `false`, the transcript reflects exactly what was said instead — a speaker saying "one hundred" comes back as "one hundred" rather than `100`, useful for verbatim workflows, like medical dictation.

> [tab] Python
>
> To enable text formatting, set `format_text` to `True` in the POST request body:
>
> ```python {10}  expandable theme={null}
> import requests
> import time
>
> base_url = "https://api.assemblyai.com"
> headers = {"authorization": "<YOUR_API_KEY>"}
>
> data = {
>     "audio_url": "https://assemblyaiassets.com/8e23e453-format_text.m4a",
>     "language_detection": True,
>     "format_text": True
> }
>
> response = requests.post(base_url + "/v2/transcript", headers=headers, json=data)
>
> if response.status_code != 200:
>     print(f"Error: {response.status_code}, Response: {response.text}")
>     response.raise_for_status()
>
> transcript_response = response.json()
> transcript_id = transcript_response["id"]
> polling_endpoint = f"{base_url}/v2/transcript/{transcript_id}"
>
> while True:
>     transcript = requests.get(polling_endpoint, headers=headers).json()
>     if transcript["status"] == "completed":
>         print(transcript["text"])
>         break
>     elif transcript["status"] == "error":
>         raise RuntimeError(f"Transcription failed: {transcript['error']}")
>     else:
>         time.sleep(3)
> ```

> [tab] Python SDK
>
> To enable text formatting, set `format_text` to `True` in the transcription config.
>
> ```python {11}  theme={null}
> from assemblyai.prerecorded.v2 import Transcriber, TranscriptionConfig
>
> # You can use a local filepath:
> # audio_file = "./example.mp3"
>
> # Or use a publicly-accessible URL:
> audio_file = "https://assemblyaiassets.com/8e23e453-format_text.m4a"
>
> config = TranscriptionConfig(
>     language_detection=True,
>     format_text=True,
> )
>
> transcriber = Transcriber(api_key="<YOUR_API_KEY>")
> transcript = transcriber.transcribe(audio_file, config)
>
> print(transcript.text)
> ```

> [tab] JavaScript
>
> To enable text formatting, set `format_text` to `true` in the POST request body:
>
> ```javascript {9}  expandable theme={null}
> const baseUrl = "https://api.assemblyai.com";
> const headers = {
>   authorization: "<YOUR_API_KEY>",
> };
>
> const data = {
>   audio_url: "https://assemblyaiassets.com/8e23e453-format_text.m4a",
>   language_detection: true,
>   format_text: true,
> };
>
> const url = `${baseUrl}/v2/transcript`;
> let res = await fetch(url, {
>   method: "POST",
>   headers: { ...headers, "Content-Type": "application/json" },
>   body: JSON.stringify(data),
> });
> if (!res.ok) throw new Error(`Error: ${res.status}`);
> const response = await res.json();
>
> const transcriptId = response.id;
> const pollingEndpoint = `${baseUrl}/v2/transcript/${transcriptId}`;
>
> while (true) {
>   res = await fetch(pollingEndpoint, { headers });
>   if (!res.ok) throw new Error(`Error: ${res.status}`);
>   const transcriptionResult = await res.json();
>
>   if (transcriptionResult.status === "completed") {
>     console.log(transcriptionResult.text);
>     break;
>   } else if (transcriptionResult.status === "error") {
>     throw new Error(`Transcription failed: ${transcriptionResult.error}`);
>   } else {
>     await new Promise((resolve) => setTimeout(resolve, 3000));
>   }
> }
> ```

> [tab] JavaScript SDK
>
> To enable text formatting, set `format_text` to `true` in the transcription config.
>
> ```javascript {16}  expandable theme={null}
> import { AssemblyAI } from "assemblyai";
>
> const client = new AssemblyAI({
>   apiKey: "<YOUR_API_KEY>",
> });
>
> // You can use a local filepath:
> // const audioFile = "./example.mp3"
>
> // Or use a publicly-accessible URL:
> const audioFile = "https://assemblyaiassets.com/8e23e453-format_text.m4a";
>
> const params = {
>   audio: audioFile,
>   language_detection: true,
>   format_text: true,
> };
>
> const run = async () => {
>   const transcript = await client.transcripts.transcribe(params);
>   console.log(transcript.text);
> };
>
> run();
> ```

### Supported languages

Unformatted output (`format_text: false`) is supported in the following languages:

| Model | Supported languages |
| - | - |
| AssemblyAI-STT-3.7 | All [32 supported languages](https://assemblyai.com/docs/pre-recorded-audio/supported-languages.md#assemblyai-stt-3-7): English, Spanish, German, French, Portuguese, Italian, Afrikaans, Arabic, Cantonese, Catalan, Danish, Dutch, Estonian, Finnish, Galician, Hebrew, Hindi, Japanese, Korean, Mandarin, Marathi, Norwegian, Norwegian Nynorsk, Persian, Romanian, Russian, Swedish, Turkish, Urdu, Vietnamese, Xhosa, Zulu |
| Universal-2 | English, Spanish, German |

## Punctuation

`punctuate` controls whether the transcript includes punctuation and casing. By default, `punctuate` is `true`, so the transcript comes back with periods, commas, question marks, and capitalized sentences and proper nouns.

When `punctuate` is set to `false`, punctuation is removed and the transcript is returned in lowercase. This applies to both `text` and the `text` of each item in `words`.

> [!NOTE]
>
> `punctuate` is supported in all [supported languages](https://assemblyai.com/docs/pre-recorded-audio/supported-languages.md).

> [tab] Python
>
> To turn off punctuation and casing, set `punctuate` to `False` in the POST request body:
>
> ```python {10}  expandable theme={null}
> import requests
> import time
>
> base_url = "https://api.assemblyai.com"
> headers = {"authorization": "<YOUR_API_KEY>"}
>
> data = {
>     "audio_url": "https://assemblyaiassets.com/8e23e453-format_text.m4a",
>     "language_detection": True,
>     "punctuate": False
> }
>
> response = requests.post(base_url + "/v2/transcript", headers=headers, json=data)
>
> if response.status_code != 200:
>     print(f"Error: {response.status_code}, Response: {response.text}")
>     response.raise_for_status()
>
> transcript_response = response.json()
> transcript_id = transcript_response["id"]
> polling_endpoint = f"{base_url}/v2/transcript/{transcript_id}"
>
> while True:
>     transcript = requests.get(polling_endpoint, headers=headers).json()
>     if transcript["status"] == "completed":
>         print(transcript["text"])
>         break
>     elif transcript["status"] == "error":
>         raise RuntimeError(f"Transcription failed: {transcript['error']}")
>     else:
>         time.sleep(3)
> ```

> [tab] Python SDK
>
> To turn off punctuation and casing, set `punctuate` to `False` in the transcription config.
>
> ```python {11}  theme={null}
> from assemblyai.prerecorded.v2 import Transcriber, TranscriptionConfig
>
> # You can use a local filepath:
> # audio_file = "./example.mp3"
>
> # Or use a publicly-accessible URL:
> audio_file = "https://assemblyaiassets.com/8e23e453-format_text.m4a"
>
> config = TranscriptionConfig(
>     language_detection=True,
>     punctuate=False,
> )
>
> transcriber = Transcriber(api_key="<YOUR_API_KEY>")
> transcript = transcriber.transcribe(audio_file, config)
>
> print(transcript.text)
> ```

> [tab] JavaScript
>
> To turn off punctuation and casing, set `punctuate` to `false` in the POST request body:
>
> ```javascript {9}  expandable theme={null}
> const baseUrl = "https://api.assemblyai.com";
> const headers = {
>   authorization: "<YOUR_API_KEY>",
> };
>
> const data = {
>   audio_url: "https://assemblyaiassets.com/8e23e453-format_text.m4a",
>   language_detection: true,
>   punctuate: false,
> };
>
> const url = `${baseUrl}/v2/transcript`;
> let res = await fetch(url, {
>   method: "POST",
>   headers: { ...headers, "Content-Type": "application/json" },
>   body: JSON.stringify(data),
> });
> if (!res.ok) throw new Error(`Error: ${res.status}`);
> const response = await res.json();
>
> const transcriptId = response.id;
> const pollingEndpoint = `${baseUrl}/v2/transcript/${transcriptId}`;
>
> while (true) {
>   res = await fetch(pollingEndpoint, { headers });
>   if (!res.ok) throw new Error(`Error: ${res.status}`);
>   const transcriptionResult = await res.json();
>
>   if (transcriptionResult.status === "completed") {
>     console.log(transcriptionResult.text);
>     break;
>   } else if (transcriptionResult.status === "error") {
>     throw new Error(`Transcription failed: ${transcriptionResult.error}`);
>   } else {
>     await new Promise((resolve) => setTimeout(resolve, 3000));
>   }
> }
> ```

> [tab] JavaScript SDK
>
> To turn off punctuation and casing, set `punctuate` to `false` in the transcription config.
>
> ```javascript {16}  expandable theme={null}
> import { AssemblyAI } from "assemblyai";
>
> const client = new AssemblyAI({
>   apiKey: "<YOUR_API_KEY>",
> });
>
> // You can use a local filepath:
> // const audioFile = "./example.mp3"
>
> // Or use a publicly-accessible URL:
> const audioFile = "https://assemblyaiassets.com/8e23e453-format_text.m4a";
>
> const params = {
>   audio: audioFile,
>   language_detection: true,
>   punctuate: false,
> };
>
> const run = async () => {
>   const transcript = await client.transcripts.transcribe(params);
>   console.log(transcript.text);
> };
>
> run();
> ```

## Combine punctuation and formatting

`punctuate` and `format_text` are independent, so you can set them separately:

| `format_text` | `punctuate` | Result |
| - | - | - |
| `true` (default) | `true` (default) | Formatted numbers and entities, with punctuation and casing. |
| `false` | `true` | Spoken-form numbers and entities, with punctuation and casing. |
| `true` | `false` | Formatted numbers and entities, lowercase with no punctuation. |
| `false` | `false` | Spoken-form, lowercase text with no punctuation. |
