New LanguageAI Voice — Real-time multilingual voice translation is now live LanguageAI API now supports more languages → Watch our webinar: The future of AI translation → New LanguageAI Voice — Real-time multilingual voice translation is now live LanguageAI API now supports more languages → Watch our webinar: The future of AI translation →

Translate Text API

Complete reference for the POST /v2/translate endpoint

← Back to API Docs

Endpoint

POST /v2/translate

Base URLs

https://api-free.deepl.com/v2/translate  (Free API)
https://api.deepl.com/v2/translate       (Pro / Enterprise)

Request Parameters

Required Parameters

Parameter Type Description
text string[] Text(s) to translate. Up to 50 texts per request.
target_lang string Target language code (e.g., "DE", "FR", "JA").

Optional Parameters

Parameter Type Description
source_lang string Source language code. If omitted, auto-detected.
context string Additional context text to improve translation quality.
split_sentences string Sentence splitting mode: "0" (no splitting), "1" (punctuation-based), "nonewlines" (default, no splitting on newlines).
preserve_formatting boolean If true, preserve original formatting. Default: true.
formality string Formality preference: "default", "more", "less", "prefer_more", "prefer_less".
model_type string Model to use: "quality_optimized" (default), "latency_optimized", "prefer_quality_optimized".
glossary_id string Glossary ID to apply. Up to 5 glossaries can be specified.
style_id string Style rule ID to apply for translation output style control.
translation_memory_id string Translation memory ID for reusing previously translated content.
custom_instructions string Custom translation instructions for fine-grained control.
tag_handling string XML/HTML tag handling: "xml" or "html". Required when texts contain markup.
outline_detection boolean Enable automatic outline/list structure detection. Default: true.

Request Example (cURL)

curl -X POST 'https://api-free.deepl.com/v2/translate' \
  -H 'Authorization: DeepL-Auth-Key YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "text": ["Hello, world!", "How are you?"],
    "target_lang": "DE",
    "source_lang": "EN",
    "formality": "prefer_more",
    "preserve_formatting": true,
    "split_sentences": "1",
    "tag_handling": "xml",
    "outline_detection": true
  }'

Response Format (JSON)

{
  "translations": [
    {
      "detected_source_language": "EN",
      "text": "Hallo, Welt!"
    },
    {
      "detected_source_language": "EN",
      "text": "Wie geht es Ihnen?"
    }
  ]
}

Response Fields

Field Type Description
translations array Array of translation results, one per input text.
detected_source_language string Language code detected for the source text.
text string The translated text.

Error Handling

The API returns standard HTTP status codes:

  • 200 — Request successful
  • 400 — Bad request (invalid parameters)
  • 403 — Invalid or missing API key
  • 456 — Quota exceeded
  • 500 — Internal server error

Rate Limits

Rate limits depend on your subscription plan. Free plans have lower limits. If you exceed the rate limit, the API returns HTTP 429. Implement exponential backoff for retry logic.

Ready to build?

Start integrating the LanguageAI API into your applications today