OpenAPI spec for text translation

This page contains only a guide that is auto-generated from DeepL's OpenAPI file.

For a complete overview of text translation, including more detailed write-ups of request parameters, please see the Translate text entry.

Request Translation

POSThttps://api.deepl.com/v2/translate
Authorization
Body
text*array of string

Text to be translated. Only UTF-8-encoded plain text is supported. The parameter may be specified up to 50 times in a single request. Translations are returned in the same order as they are requested.

source_langSourceLanguage (enum)

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.

Example: "EN"
BGCSDADEELENESETFIFRHUIDITJAKOLTLVNBNLPLPTRORUSKSLSVTRUKZH
target_lang*TargetLanguage (enum)

The language into which the text should be translated.

Example: "DE"
BGCSDADEELEN-GBEN-USESETFIFRHUIDITJAKOLTLVNBNLPLPT-BRPT-PTRORUSKSLSVTRUKZH-HANS
contextContext (string)

Additional context that can influence a translation but is not translated itself.

Characters included in the context parameter will not be counted toward billing.

Example: "This is context."
split_sentencesSplitSentencesOption (enum)

Sets whether the translation engine should first split the input into sentences.

Possible values are:

  • 0 - no splitting at all, whole input is treated as one sentence
  • 1 (default when tag_handling is not set to html) - splits on punctuation and on newlines
  • nonewlines (default when tag_handling=html) - splits on punctuation only, ignoring newlines
Example: "1"
01nonewlines
preserve_formattingPreserveFormattingOption (boolean)

Sets whether the translation engine should respect the original formatting, even if it would usually correct some aspects.

formalityFormality (enum)

Sets whether the translated text should lean towards formal or informal language. This feature is only available for certain target languages. Setting this parameter with a target language that does not support formality will fail, unless one of the prefer_... options are used. Possible options are:

  • default (default)
  • more - for a more formal language
  • less - for a more informal language
  • prefer_more - for a more formal language if available, otherwise fallback to default formality
  • prefer_less - for a more informal language if available, otherwise fallback to default formality
Example: "prefer_more"
defaultmorelessprefer_moreprefer_less
glossary_idstring

Specify the glossary to use for the translation. Important: This requires the source_lang parameter to be set. The language pair of the glossary has to match the language pair of the request.

Example: "def3a26b-3e84-45b3-84ae-0c0aaf3525f7"
tag_handlingTagHandlingOption (enum)

Sets which kind of tags should be handled. Options currently available:

  • xml
  • html
Example: "html"
xmlhtml
outline_detectionOutlineDetectionOption (boolean)

Disable the automatic detection of XML structure by setting the outline_detection parameter to false and selecting the tags that should be considered structure tags. This will split sentences using the splitting_tags parameter.

non_splitting_tagsarray of string

Comma-separated list of HTML or XML tags which never split sentences.

splitting_tagsarray of string

Comma-separated list of HTML or XML tags which always cause splits.

ignore_tagsarray of string

Comma-separated list of HTML or XML tags that indicate text not to be translated.

Response

The translate function returns a JSON representation of the translations in the order the text parameters have been specified.

Body
translationsarray of object
Response
{
  "translations": [
    {
      "detected_source_language": "EN",
      "text": "Hallo, Welt!"
    }
  ]
}

Last updated