> ## Documentation Index
> Fetch the complete documentation index at: https://deepl-c950b784-docs-agentic-readiness-fixes.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Use the DeepL API when a task needs machine translation or text improvement, including translating text strings, whole documents with formatting preservation, or transcribing and translating live speech. Preferred terminology and phrasing may be enforced using customizations (glossaries, style rules, and translation memories). Retrieve supported languages for each product from the `/v3/languages` endpoints.
> Read the machine-readable API surface instead of inferring request shapes from prose: the REST spec is at https://developers.deepl.com/api-reference/openapi.yaml (also served as openapi.json) and the Voice WebSocket protocol is at https://developers.deepl.com/api-reference/voice/voice.asyncapi.yaml. These docs also expose an MCP server at https://developers.deepl.com/mcp (Streamable HTTP, no authentication).
> Use https://api.deepl.com for Pro plans and https://api-free.deepl.com for the Free plan. Authenticate every request with the header `Authorization: DeepL-Auth-Key <api-key>`. Never fabricate an API key: ask the user for one, or point them at https://developers.deepl.com/docs/getting-started/quickstart.
> Errors use standard HTTP status codes with a JSON body containing a `message` field, plus a `code` field where available, and an `X-Trace-ID` response header that identifies the request in DeepL's logs. Log `X-Trace-ID` by default. Retry 429 and 5xx with exponential backoff. Do not retry 456, which means the account quota is exhausted, or 400, which means the request itself is invalid.

# How to Translate Between Language Variants

> Learn how to translate between language variants, like British English and US English, using the DeepL API.

**This guide shows you:**

* How to translate between language variants (e.g., `en-US` to `en-GB`, `pt-PT` to `pt-BR`)
* Which method to choose: Write API, style rules, or custom instructions
* An example workflow for converting American English to British English

***

## Methods for translating between variants

You can use the DeepL API to translate between variants of the same language using 3 methods:

### 1. DeepL Write API

Use the [/write/rephrase](/docs/translate/write-quickstart) endpoint to rephrase text into the target language variant.

**When to use this:**

* You're translating shorter texts (headlines, product names, brief descriptions)
* You want high-quality rephrasing alongside variant translation

```bash Example cURL request theme={null}
curl -X POST 'https://api.deepl.com/v2/write/rephrase' \
--header 'Authorization: DeepL-Auth-Key [yourAuthKey]' \
--header 'Content-Type: application/json' \
--data '{
  "text": ["Check out the new fall colors!"],
  "target_lang": "en-GB"
}'
```

```json Example response theme={null}
{
  "improvements": [
    {
      "text": "Check out the new autumn colours!",
      "detected_source_language": "en",
      "target_language": "en-GB"
    }
  ]
}
```

<Warning>
  For longer texts, the Write API may rephrase and enhance content beyond simple variant conversion. If you need to maintain the exact structure while only updating locale-specific spelling and grammar, use another method.

  Please note that currently, the methods outlined below are not fully supported for this use case and may not always perform as intended. We encourage you to conduct your own evaluations.
</Warning>

### 2. Style rules with custom instructions

Create a reusable [style rule list](/docs/customize/using-style-rules) with attached `custom_instructions` describing the desired variant translation.

**When to use this:**

* You need to maintain the text's content between variants as precisely as possible
* You need consistent variant transformations across many translation requests
* You want to reuse the same variant rules without repeating the custom instructions

```bash Example cURL request theme={null}
curl -X POST 'https://api.deepl.com/v2/translate' \
--header 'Authorization: DeepL-Auth-Key [yourAuthKey]' \
--header 'Content-Type: application/json' \
--data '{
  "text": ["I went to the pharmacy."],
  "target_lang": "en-GB",
  "style_id": "your-style-rule-id"
}'
```

```json Example response theme={null}
{
  "translations": [
    {
      "detected_source_language": "EN",
      "text": "I went to the chemist's."
    }
  ]
}
```

<Info>
  Glossaries and style rules are unique to each of DeepL's global data centers and are not shared between them.

  Clients using the `api-us.deepl.com` endpoint will not be able to access glossaries or style rules created in the UI at this time.
</Info>

### 3. Per-request custom instructions

Add [custom\_instructions](/api-reference/translate/request-translation#body-custom-instructions) describing the desired variant translation directly into your `/translate` requests.

**When to use this:**

* You need to maintain the text's content between variants as precisely as possible
* You need ad-hoc, one-off translations with specific variant requirements
* You don't want to manage separate style rules

```bash Example cURL request theme={null}
curl -X POST 'https://api.deepl.com/v2/translate' \
--header 'Authorization: DeepL-Auth-Key [yourAuthKey]' \
--header 'Content-Type: application/json' \
--data '{
  "text": ["I went to the pharmacy."],
  "target_lang": "en-GB",
  "custom_instructions": ["translate to British English"]
}'
```

```json Example response theme={null}
{
  "translations": [
    {
      "detected_source_language": "EN",
      "text": "I went to the chemist's."
    }
  ]
}
```

You can specify up to 10 custom instructions per request, each with a maximum of 300 characters.

***

## Next steps

Now that you understand how to translate between language variants:

* **Try it yourself:** Test out style rules and custom instructions in the [text translation API playground](/api-reference/translate/request-translation?playground=open)
* **Learn about the Write API:** Explore the [/write/rephrase endpoint](/docs/translate/write-quickstart) for high-quality variant translation and rephrasing
* **Manage reusable rules:** Learn how to create [style rules](/docs/customize/using-style-rules) for systematic variant transformations
* **Improve translation quality:** Understand how [the context parameter](/docs/learning-how-tos/examples-and-guides/how-to-use-context-parameter) can enhance ambiguous translations
