Skip to main content

Endpoint

POST /translate
This is the free translation endpoint that works without a DeepL Pro account. It uses the DeepL free API to translate text between supported languages.

Authentication

If an access token is configured on the server, include it in one of the following ways:
POST /translate?token=your_access_token

Request Body

text
string
required
The text to be translated. Can contain multiple sentences or paragraphs.
source_lang
string
The source language code (e.g., “EN”, “DE”, “FR”, “ZH”). Use “auto” or omit for automatic detection.
target_lang
string
required
The target language code (e.g., “EN”, “DE”, “FR”, “ZH”).
tag_handling
string
Specifies how to handle tags in the text. Allowed values: html or xml. Leave empty for plain text.

Response

code
number
HTTP status code (200 for success)
id
number
Unique identifier for the translation request
data
string
The primary translated text
alternatives
array
Array of alternative translations
source_lang
string
Detected or specified source language
target_lang
string
Target language for the translation
method
string
Translation method used by the API

Examples

curl -X POST http://localhost:1188/translate \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Hello, world!",
    "source_lang": "EN",
    "target_lang": "DE"
  }'

Success Response

{
  "code": 200,
  "id": 1234567890,
  "data": "Hallo, Welt!",
  "alternatives": [
    "Hallo Welt!",
    "Servus, Welt!"
  ],
  "source_lang": "EN",
  "target_lang": "DE",
  "method": "Free"
}

Error Responses

{
  "code": 400,
  "message": "Invalid tag_handling value. Allowed values are 'html' and 'xml'."
}
Returned when tag_handling is set to a value other than html or xml.
{
  "code": 401,
  "message": "Invalid access token"
}
Returned when the provided access token doesn’t match the server configuration.
{
  "code": 429,
  "message": "Too many requests"
}
Returned when rate limits are exceeded.

Notes

  • This endpoint uses the DeepL free API and does not require a Pro account
  • Source language can be set to “auto” for automatic detection
  • The alternatives field provides additional translation options
  • Tag handling is useful for preserving HTML or XML structure in translated text

Build docs developers (and LLMs) love