Request Translation Run in API Explorer
The translate function.
The total request body size must not exceed 128 KiB (128 · 1024 bytes). Please split up your text into multiple calls if it exceeds this limit.
Body
Required
-
Text to be translated. Only UTF-8-encoded plain text is supported. The parameter may be specified multiple times and translations are returned in the same order as they are requested. Each of the parameter values may contain multiple sentences.
-
Language of the text to be translated. If this parameter is omitted, the API will attempt to detect the language of the text and translate it.
Note: Some languages only work with
model_typeset toquality_optimized. See supported languages for more details.Values are
ACE,AF,AN,AR,AS,AY,AZ,BA,BE,BG,BHO,BN,BR,BS,CA,CEB,CKB,CS,CY,DA,DE,EL,EN,EO,ES,ET,EU,FA,FI,FR,GA,GL,GN,GOM,GU,HA,HE,HI,HR,HT,HU,HY,ID,IG,IS,IT,JA,JV,KA,KK,KMR,KO,KY,LA,LB,LMO,LN,LT,LV,MAI,MG,MI,MK,ML,MN,MR,MS,MT,MY,NB,NE,NL,OC,OM,PA,PAG,PAM,PL,PRS,PS,PT,QU,RO,RU,SA,SCN,SK,SL,SQ,SR,ST,SU,SV,SW,TA,TE,TG,TH,TK,TL,TN,TR,TS,TT,UK,UR,UZ,VI,WO,XH,YI,YUE,ZH, orZU. -
The language into which the text should be translated.
Note: Some languages only work with
model_typeset toquality_optimized. See supported languages for more details.Values are
ACE,AF,AN,AR,AS,AY,AZ,BA,BE,BG,BHO,BN,BR,BS,CA,CEB,CKB,CS,CY,DA,DE,EL,EN,EN-GB,EN-US,EO,ES,ES-419,ET,EU,FA,FI,FR,GA,GL,GN,GOM,GU,HA,HE,HI,HR,HT,HU,HY,ID,IG,IS,IT,JA,JV,KA,KK,KMR,KO,KY,LA,LB,LMO,LN,LT,LV,MAI,MG,MI,MK,ML,MN,MR,MS,MT,MY,NB,NE,NL,OC,OM,PA,PAG,PAM,PL,PRS,PS,PT,PT-BR,PT-PT,QU,RO,RU,SA,SCN,SK,SL,SQ,SR,ST,SU,SV,SW,TA,TE,TG,TH,TK,TL,TN,TR,TS,TT,UK,UR,UZ,VI,WO,XH,YI,YUE,ZH,ZH-HANS,ZH-HANT, orZU. -
The
contextparameter makes it possible to include additional context that can influence a translation but is not translated itself. This additional context can potentially improve translation quality when translating short, low-context source texts such as product names on an e-commerce website, article headlines on a news website, or UI elements.For example...
- When translating a product name, you might pass the product description as context.
- When translating a news article headline, you might pass the first few sentences or a summary of the article as context.
For best results, we recommend sending a few complete sentences of context in the same language as the source text. There is no size limit for the
contextparameter itself, but the request body size limit of 128 KiB still applies to all text translation requests.If you send a request with multiple
textparameters, thecontextparameter will be applied to each one.Characters included in the
contextparameter will not be counted toward billing (i.e. there is no additional cost for using thecontextparameter, and only characters sent in the text parameter(s) will be counted toward billing for text translation even when thecontextparameter is included in a request). -
When true, the response will include the billed_characters parameter, giving the number of characters from the request that will be counted by DeepL for billing purposes.
Note: for requests sent as URL-encoded forms, boolean values should be specified as "1" or "0".
-
Sets whether the translation engine should first split the input into sentences. For text translations where
tag_handlingis not set tohtml, the default value is1, meaning the engine splits on punctuation and on newlines.For text translations where
tag_handling=html, the default value isnonewlines, meaning the engine splits on punctuation only, ignoring newlines.The use of
nonewlinesas the default value for text translations wheretag_handling=htmlis new behavior that was implemented in November 2022, when HTML handling was moved out of beta.Possible values are:
0- no splitting at all, whole input is treated as one sentence1(default whentag_handlingis not set tohtml) - splits on punctuation and on newlinesnonewlines(default whentag_handling=html) - splits on punctuation only, ignoring newlines
For applications that send one sentence per text parameter, we recommend setting
split_sentencesto0, in order to prevent the engine from splitting the sentence unintentionally.Please note that newlines will split sentences when
split_sentences=1. We recommend cleaning files so they don't contain breaking sentences or setting the parametersplit_sentencestononewlines.Values are
0,1, ornonewlines. Default value is1. -
Sets whether the translation engine should respect the original formatting, even if it would usually correct some aspects.
The formatting aspects affected by this setting include:
- Punctuation at the beginning and end of the sentence
- Upper/lower case at the beginning of the sentence
Note: for requests sent as URL-encoded forms, boolean values should be specified as "1" or "0".
Default value is
false. -
Sets whether the translated text should lean towards formal or informal language. This feature currently only works for target languages
DE(German),FR(French),IT(Italian),ES(Spanish),ES-419(Latin American Spanish),NL(Dutch),PL(Polish),PT-BRandPT-PT(Portuguese),JA(Japanese), andRU(Russian). Learn more about the plain/polite feature for Japanese here. Setting this parameter with a target language that does not support formality will fail, unless one of theprefer_...options are used. Possible options are:default(default)more- for a more formal languageless- for a more informal languageprefer_more- for a more formal language if available, otherwise fallback to default formalityprefer_less- for a more informal language if available, otherwise fallback to default formality
Values are
default,more,less,prefer_more, orprefer_less. Default value isdefault. -
Specifies which DeepL model should be used for translation.
Possible values are:
latency_optimized(default) - uses lower latency “classic” translation models, which support all language pairs; default valuequality_optimized- uses higher latency, improved quality “next-gen” translation models, which support only a subset of language pairs; if a language pair that is not supported by next-gen models is included in the request, it will fail. Consider using prefer_quality_optimized instead.prefer_quality_optimized- prioritizes use of higher latency, improved quality “next-gen” translation models, which support only a subset of DeepL languages; if a request includes a language pair not supported by next-gen models, the request will fall back to latency_optimized classic models.
Values are
quality_optimized,prefer_quality_optimized, orlatency_optimized. -
Specify the glossary to use for the translation. Important: This requires the
source_langparameter to be set and the language pair of the glossary has to match the language pair of the request. -
Specify a list of instructions to customize the translation behavior. Up to 10 custom instructions can be specified, each with a maximum of 300 characters.
Important: The target language must be
de,en,es,fr,it,ja,ko,zhor any variants of these languages.Note: Any request with the
custom_instructionsparameter enabled will default to use thequality_optimizedmodel type. Requests combiningcustom_instructionsandmodel_type: latency_optimizedwill be rejected. -
Enables 81 additional beta languages. See the full list at https://developers.deepl.com/docs/getting-started/supported-languages#beta-languages. Note: Any request with the
enable_beta_languagesparameter enabled will usequality_optimizedmodels. Requests combiningenable_beta_languages: trueandmodel_type: latency_optimizedwill be rejected. Beta languages do not support formality or glossaries.Default value is
false. -
Sets which kind of tags should be handled. Options currently available:
xml: Enable XML tag handling; see XML Handling.html: Enable HTML tag handling; see HTML Handling.
Values are
xmlorhtml. -
The automatic detection of the XML structure won't yield best results in all XML files. You can disable this automatic mechanism altogether by setting the
outline_detectionparameter tofalseand selecting the tags that should be considered structure tags. This will split sentences using thesplitting_tagsparameter.In the example below, we achieve the same results as the automatic engine by disabling automatic detection with
outline_detection=0and setting the parameters manually totag_handling=xml,split_sentences=nonewlines, andsplitting_tags=par,title.- Example request:
<document> <meta> <title>A document's title</title> </meta> <content> <par>This is the first sentence. Followed by a second one.</par> <par>This is the third sentence.</par> </content> </document> - Example response:
<document> <meta> <title>Der Titel eines Dokuments</title> </meta> <content> <par>Das ist der erste Satz. Gefolgt von einem zweiten.</par> <par>Dies ist der dritte Satz.</par> </content> </document>While this approach is slightly more complicated, it allows for greater control over the structure of the translation output.
Note: for requests sent as URL-encoded forms, boolean values should be specified as "1" or "0".
Default value is
true. - Example request:
Body
Required
-
Text to be translated. Only UTF-8-encoded plain text is supported. The parameter may be specified multiple times and translations are returned in the same order as they are requested. Each of the parameter values may contain multiple sentences.
-
Language of the text to be translated. If this parameter is omitted, the API will attempt to detect the language of the text and translate it.
Note: Some languages only work with
model_typeset toquality_optimized. See supported languages for more details.Values are
ACE,AF,AN,AR,AS,AY,AZ,BA,BE,BG,BHO,BN,BR,BS,CA,CEB,CKB,CS,CY,DA,DE,EL,EN,EO,ES,ET,EU,FA,FI,FR,GA,GL,GN,GOM,GU,HA,HE,HI,HR,HT,HU,HY,ID,IG,IS,IT,JA,JV,KA,KK,KMR,KO,KY,LA,LB,LMO,LN,LT,LV,MAI,MG,MI,MK,ML,MN,MR,MS,MT,MY,NB,NE,NL,OC,OM,PA,PAG,PAM,PL,PRS,PS,PT,QU,RO,RU,SA,SCN,SK,SL,SQ,SR,ST,SU,SV,SW,TA,TE,TG,TH,TK,TL,TN,TR,TS,TT,UK,UR,UZ,VI,WO,XH,YI,YUE,ZH, orZU. -
The language into which the text should be translated.
Note: Some languages only work with
model_typeset toquality_optimized. See supported languages for more details.Values are
ACE,AF,AN,AR,AS,AY,AZ,BA,BE,BG,BHO,BN,BR,BS,CA,CEB,CKB,CS,CY,DA,DE,EL,EN,EN-GB,EN-US,EO,ES,ES-419,ET,EU,FA,FI,FR,GA,GL,GN,GOM,GU,HA,HE,HI,HR,HT,HU,HY,ID,IG,IS,IT,JA,JV,KA,KK,KMR,KO,KY,LA,LB,LMO,LN,LT,LV,MAI,MG,MI,MK,ML,MN,MR,MS,MT,MY,NB,NE,NL,OC,OM,PA,PAG,PAM,PL,PRS,PS,PT,PT-BR,PT-PT,QU,RO,RU,SA,SCN,SK,SL,SQ,SR,ST,SU,SV,SW,TA,TE,TG,TH,TK,TL,TN,TR,TS,TT,UK,UR,UZ,VI,WO,XH,YI,YUE,ZH,ZH-HANS,ZH-HANT, orZU. -
The
contextparameter makes it possible to include additional context that can influence a translation but is not translated itself. This additional context can potentially improve translation quality when translating short, low-context source texts such as product names on an e-commerce website, article headlines on a news website, or UI elements.For example...
- When translating a product name, you might pass the product description as context.
- When translating a news article headline, you might pass the first few sentences or a summary of the article as context.
For best results, we recommend sending a few complete sentences of context in the same language as the source text. There is no size limit for the
contextparameter itself, but the request body size limit of 128 KiB still applies to all text translation requests.If you send a request with multiple
textparameters, thecontextparameter will be applied to each one.Characters included in the
contextparameter will not be counted toward billing (i.e. there is no additional cost for using thecontextparameter, and only characters sent in the text parameter(s) will be counted toward billing for text translation even when thecontextparameter is included in a request). -
When true, the response will include the billed_characters parameter, giving the number of characters from the request that will be counted by DeepL for billing purposes.
Note: for requests sent as URL-encoded forms, boolean values should be specified as "1" or "0".
-
Sets whether the translation engine should first split the input into sentences. For text translations where
tag_handlingis not set tohtml, the default value is1, meaning the engine splits on punctuation and on newlines.For text translations where
tag_handling=html, the default value isnonewlines, meaning the engine splits on punctuation only, ignoring newlines.The use of
nonewlinesas the default value for text translations wheretag_handling=htmlis new behavior that was implemented in November 2022, when HTML handling was moved out of beta.Possible values are:
0- no splitting at all, whole input is treated as one sentence1(default whentag_handlingis not set tohtml) - splits on punctuation and on newlinesnonewlines(default whentag_handling=html) - splits on punctuation only, ignoring newlines
For applications that send one sentence per text parameter, we recommend setting
split_sentencesto0, in order to prevent the engine from splitting the sentence unintentionally.Please note that newlines will split sentences when
split_sentences=1. We recommend cleaning files so they don't contain breaking sentences or setting the parametersplit_sentencestononewlines.Values are
0,1, ornonewlines. Default value is1. -
Sets whether the translation engine should respect the original formatting, even if it would usually correct some aspects. Possible values are:
0(default)1
The formatting aspects affected by this setting include:
- Punctuation at the beginning and end of the sentence
- Upper/lower case at the beginning of the sentence
Values are
0or1. Default value is0. -
Sets whether the translated text should lean towards formal or informal language. This feature currently only works for target languages
DE(German),FR(French),IT(Italian),ES(Spanish),ES-419(Latin American Spanish),NL(Dutch),PL(Polish),PT-BRandPT-PT(Portuguese),JA(Japanese), andRU(Russian). Learn more about the plain/polite feature for Japanese here. Setting this parameter with a target language that does not support formality will fail, unless one of theprefer_...options are used. Possible options are:default(default)more- for a more formal languageless- for a more informal languageprefer_more- for a more formal language if available, otherwise fallback to default formalityprefer_less- for a more informal language if available, otherwise fallback to default formality
Values are
default,more,less,prefer_more, orprefer_less. Default value isdefault. -
Specifies which DeepL model should be used for translation.
Possible values are:
latency_optimized(default) - uses lower latency “classic” translation models, which support all language pairs; default valuequality_optimized- uses higher latency, improved quality “next-gen” translation models, which support only a subset of language pairs; if a language pair that is not supported by next-gen models is included in the request, it will fail. Consider using prefer_quality_optimized instead.prefer_quality_optimized- prioritizes use of higher latency, improved quality “next-gen” translation models, which support only a subset of DeepL languages; if a request includes a language pair not supported by next-gen models, the request will fall back to latency_optimized classic models.
Values are
quality_optimized,prefer_quality_optimized, orlatency_optimized. -
Specify the glossary to use for the translation. Important: This requires the
source_langparameter to be set and the language pair of the glossary has to match the language pair of the request. -
Sets which kind of tags should be handled. Options currently available:
xml: Enable XML tag handling; see XML Handling.html: Enable HTML tag handling; see HTML Handling.
Values are
xmlorhtml. -
Sets which version of the tag handling algorithm should be used. Options currently available:
v2: Improved algorithm released in October 2025 (default as of December 2025).v1: Traditional algorithm (default until December 2025).
Values are
v1orv2. -
The automatic detection of the XML structure won't yield best results in all XML files. You can disable this automatic mechanism altogether by setting the
outline_detectionparameter to0and selecting the tags that should be considered structure tags. This will split sentences using thesplitting_tagsparameter.In the example below, we achieve the same results as the automatic engine by disabling automatic detection with
outline_detection=0and setting the parameters manually totag_handling=xml,split_sentences=nonewlines, andsplitting_tags=par,title.- Example request:
<document> <meta> <title>A document's title</title> </meta> <content> <par>This is the first sentence. Followed by a second one.</par> <par>This is the third sentence.</par> </content> </document> - Example response:
<document> <meta> <title>Der Titel eines Dokuments</title> </meta> <content> <par>Das ist der erste Satz. Gefolgt von einem zweiten.</par> <par>Dies ist der dritte Satz.</par> </content> </document>While this approach is slightly more complicated, it allows for greater control over the structure of the translation output.
Value is
0. - Example request:
Responses
-
The translate function returns a JSON representation of the translations in the order the text parameters have been specified.
-
Bad request. Please check error message and your parameters.
-
Authorization failed. Please supply a valid
DeepL-Auth-Keyvia theAuthorizationheader. -
The requested resource could not be found.
-
The request size exceeds the limit.
-
The request URL is too long. You can avoid this error by using a POST request instead of a GET request, and sending the parameters in the HTTP body.
-
Too many requests. Please wait and resend your request.
-
Quota exceeded. The character limit has been reached.
-
Internal error.
-
Resource currently unavailable. Try again later.
-
Too many requests. Please wait and resend your request.
curl \
--request POST 'https://api.deepl.com/v2/translate' \
--header "Authorization: $API_KEY" \
--header "Content-Type: application/json" \
--data '{"text":["Hello, World!"],"source_lang":"EN","target_lang":"DE","context":"string","show_billed_characters":true,"split_sentences":"1","preserve_formatting":false,"formality":"default","model_type":"quality_optimized","glossary_id":"def3a26b-3e84-45b3-84ae-0c0aaf3525f7","custom_instructions":["Use a friendly, diplomatic tone"],"enable_beta_languages":false,"tag_handling":"xml","outline_detection":true,"non_splitting_tags":["a","p","span"],"splitting_tags":["a","p","span"],"ignore_tags":["a","p","span"]}'
curl \
--request POST 'https://api.deepl.com/v2/translate' \
--header "Authorization: $API_KEY" \
--header "Content-Type: application/x-www-form-urlencoded" \
--data 'text=Hello%2C+world%21&target_lang=DE'
{
"text": [
"Hello, World!"
],
"source_lang": "EN",
"target_lang": "DE",
"context": "string",
"show_billed_characters": true,
"split_sentences": "1",
"preserve_formatting": false,
"formality": "default",
"model_type": "quality_optimized",
"glossary_id": "def3a26b-3e84-45b3-84ae-0c0aaf3525f7",
"custom_instructions": [
"Use a friendly, diplomatic tone"
],
"enable_beta_languages": false,
"tag_handling": "xml",
"outline_detection": true,
"non_splitting_tags": [
"a",
"p",
"span"
],
"splitting_tags": [
"a",
"p",
"span"
],
"ignore_tags": [
"a",
"p",
"span"
]
}
{"text" => ["Hello, world!"], "target_lang" => "DE"}
{"text" => ["Hello, world!"], "target_lang" => "DE", "source_lang" => "EN", "glossary_id" => "[yourGlossaryId]"}
{"text" => ["The table is green. The chair is black."], "target_lang" => "DE"}
{"text" => ["This is the first sentence.", "This is the second sentence.", "This is the third sentence."], "target_lang" => "DE"}
{
"translations": [
{
"detected_source_language": "EN",
"text": "Hallo, Welt!",
"billed_characters": 42
}
]
}
{
"translations": [
{
"text": "Hallo, Welt!"
}
]
}
{
"translations": [
{
"detected_source_language": "EN",
"text": "Der Tisch ist grün. Der Stuhl ist schwarz."
}
]
}
{
"translations": [
{
"detected_source_language": "EN",
"text": "Das ist der erste Satz."
},
{
"detected_source_language": "EN",
"text": "Das ist der zweite Satz."
},
{
"detected_source_language": "EN",
"text": "Dies ist der dritte Satz."
}
]
}