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

# Steer toward known languages

> Steer a voice agent's speech-to-text toward the languages you expect with language_codes, or leave it on automatic multilingual detection.

The agent transcribes any [supported language](https://assemblyai.com/docs/voice-agents/voice-agent-api/supported-languages.md) automatically and code-switches natively, so a caller can move between, say, English and Spanish mid-sentence with no configuration. When you know which language(s) a line serves, set `input.language_codes` to steer transcription toward them for a bit more accuracy. Omit it for automatic detection. Set it when you [create](https://assemblyai.com/docs/voice-agents/voice-agent-api/create-agent.md) or [update](https://assemblyai.com/docs/voice-agents/voice-agent-api/manage-agents.md) the agent.

* **Global or mixed-language line**: omit `language_codes`. The agent detects and code-switches on its own.
* **Region-specific line**: pin the language(s) you expect. A Spanish support line set to `["es"]` won't drift into look-alike transcriptions of another language.

```bash cURL {8} theme={null}
curl -X POST https://agents.assemblyai.com/v1/agents \
  -H "Authorization: $ASSEMBLYAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Soporte",
    "system_prompt": "Eres un agente de soporte amable. Responde en español.",
    "voice": { "voice_id": "lola" },
    "input": { "language_codes": ["es"] }
  }'
```

```python Python {12} theme={null}
# pip install requests
import os
import requests

resp = requests.post(
    "https://agents.assemblyai.com/v1/agents",
    headers={"Authorization": os.environ["ASSEMBLYAI_API_KEY"]},
    json={
        "name": "Soporte",
        "system_prompt": "Eres un agente de soporte amable. Responde en español.",
        "voice": {"voice_id": "lola"},
        "input": {"language_codes": ["es"]},
    },
)
resp.raise_for_status()
print(resp.json())
```

```javascript Node.js {12} theme={null}
// Node 18+ has fetch built in
const res = await fetch("https://agents.assemblyai.com/v1/agents", {
  method: "POST",
  headers: {
    Authorization: process.env.ASSEMBLYAI_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    name: "Soporte",
    system_prompt: "Eres un agente de soporte amable. Responde en español.",
    voice: { voice_id: "lola" },
    input: { language_codes: ["es"] },
  }),
});
const data = await res.json();
console.log(data);
```

| Field | Type | Required | Notes |
| - | - | - | - |
| `input.language_codes` | string\[] | No | Languages to steer toward. Omit (or leave empty) for automatic detection. Pass one code to pin a single language, or several to constrain to a set. |

## Supported language codes

Universal-3.5 Pro Realtime code-switches across all 18 languages below. Pass any of these codes in `language_codes`:

| Language | Code | Language | Code |
| - | - | - | - |
| English | `en` | Danish | `da` |
| Spanish | `es` | Finnish | `fi` |
| French | `fr` | Hindi | `hi` |
| German | `de` | Vietnamese | `vi` |
| Italian | `it` | Arabic | `ar` |
| Portuguese | `pt` | Hebrew | `he` |
| Turkish | `tr` | Japanese | `ja` |
| Dutch | `nl` | Mandarin | `zh` |
| Swedish | `sv` | Norwegian | `no` |

> [!TIP]
>
> Set the input language and a matching [voice](https://assemblyai.com/docs/voice-agents/voice-agent-api/voices.md) together: transcribing Spanish while replying in an English voice is jarring. The example above pairs `["es"]` with the Spanish voice `lola`.

> [!NOTE]
>
> `language_codes` is applied when the speech-to-text connection opens; a mid-session change takes effect on the next reconnect, not the current turn. For how native code-switching works, see [Multilingual transcription](https://assemblyai.com/docs/streaming/multilingual-transcription.md).
