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.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:- Basic Example
- With Attributes
- Placeholder Tag
Request
Response
Exclude content from translation
List tags whose content should not be translated in theignore_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, withsplit_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
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
Keep sentences together across tags
When a single sentence is spread across multiple text-bearing tags, list those tags in thenon_splitting_tags parameter so the sentence is translated as a whole:
- Restricted Splitting
Parameters
Request
Response
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 withoutline_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