# Translate text

Canonical page: https://docs.ovok.com/api/ai-translation/translate-text

`POST /ai/translation`

Translates a list of strings from one language to another with an LLM. Use it to draft translations for content and localization keys.

**Auth:** bearer token.
**Scope:** the caller's project (from the token). The project's settings can add instructions to the translation prompt.

## Behaviour

- `sourceLanguage` and `targetLanguage` take a language code such as `en` or `de-DE`, or a language name. Each is 2 to 100 characters.
- `text` holds 1 or more strings. Each string and all strings together are limited to 10,000 characters.
- Strings can be plain text, HTML or Markdown, and can contain placeholders such as `{{name}}`. Markup and placeholders are meant to be kept as they are, but the output comes from an LLM, so check it before you publish it.
- The response returns the translations in `text`, in the same order as the input.
- If the project has a setting named `TRANSLATION_ADDITIONAL_PROMPT`, its value is added to the prompt for every translation in that project.
- Nothing is stored. The route only returns the translation.

## Example

```bash
curl -X POST 'https://api.sandbox.ovok.com/ai/translation' \
  -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' \
  -H 'Content-Type: application/json' \
  -d '{
    "sourceLanguage": "en",
    "targetLanguage": "de",
    "text": ["Hello {{name}}, how are you?", "<p>Your appointment is <b>today</b>.</p>"]
  }'
```
