Skip to main content
To translate XML content, set the tag_handling parameter to xml. The API extracts the text from the XML structure, translates it, and places the translation back into the structure. Without tag_handling, tags are treated as regular text. Set tag_handling_version to v2 to use the improved tag handling algorithm. For version details and defaults, see the tag_handling_version parameter.
Example request
Example response
Accounts that first used tag handling after December 1, 2025 default to v2. All other accounts default to v1 and need to set tag_handling_version=v2 explicitly. Results differ between versions, so test representative content before switching versions in production.
With v2, XML input is strictly parsed: invalid XML (for example, an unclosed tag) returns the error Tag handling parsing failed, please check input. Make sure your XML is well-formed and handle this error in your integration.
To translate HTML content, see Translating HTML.

Translate sentences with inline markup

Send marked-up text as is; tags stay attached to the words they wrap, and placeholder tags are placed next to the translation of the words that precede or follow them:
Request
Response

Exclude content from translation

List tags whose content should not be translated in the ignore_tags parameter. The example below uses ignore_tags=x to preserve the text between <x> and </x> as is:

Example: ignore \<x\> tag

Parameters
Request
Response

Translate whole XML documents

Send complete XML files the same way, with split_sentences=nonewlines so that line breaks in the file don’t split sentences. Tags that contain text (here title and par) are treated as sentence boundaries, and the content of each is translated separately:

Example

Parameters
Example request
Example response
Without split_sentences=nonewlines, a newline in the middle of a sentence causes each part to be translated separately, producing wrong results:

Incorrect translation due to new lines

Request
Response
The two parts of the sentence have been translated separately: “oat biscuits” became “Hafer Kekse” instead of “Haferkekse”.

Keep sentences together across tags

When a single sentence is spread across multiple text-bearing tags, list those tags in the non_splitting_tags parameter so the sentence is translated as a whole:
Parameters
Request
Response
The sentence is translated as a whole and the par tags are treated as markup. Because the translation of “had been” moved to another position in the German sentence, the tags are duplicated (which is expected here).

Control sentence splitting manually

If automatic detection of the XML structure doesn’t yield good results for your files, turn it off with outline_detection=0 and list your structure tags in the splitting_tags parameter. The example below reproduces the automatic behavior for the document shown earlier:

Outline detection example

Parameters
Example request
Example response
This approach takes more setup but gives you full control over how the translation output is structured.