Translate document
Translate a document's text and/or title to the desired language.
If you want to translate documents, use the Batch Translation route
Request
Request Body
document_id*
uuidThe document's identifier.
Example: "c34ac671a1b0b80078f9acd7e80217e28e8c554e14e1de707fb4370e52299add"extracted
date-timeThe document's extraction date. If absent, the most recent document will be used.
Example: "2022-11-25T14:31:10.834Z"fields
(string (enum))[]Fields to translate
Default: ["title", "text"]Values: "title", "text"language
stringThe language in which you want the document to be translated
Default: "english"Example: "italian"
{
"document_id": "c34ac671a1b0b80078f9acd7e80217e28e8c554e14e1de707fb4370e52299add",
"extracted": "2022-12-30T22:59:57.502Z",
"fields": [
"title",
"text"
],
"language": "french"
}
Response
Response - 200
An identifier of the analysis to retrieve results
partial
booleanWhether the document has been partially translated or not.
Example: falsetext
stringThe document's text translated. Undefined if 'text' is not in the requested fields.
Example: "A translated text"title
stringThe document's title translated. Undefined if 'title' is not in the requested fields.
Example: "A translated title"
{
"partial": false,
"text": "the document's text translated",
"title": "the document's title translated"
}
Error handling
We raise error an error in the following cases:
- The user’s company is out of quota:
- Each company can translate up to 10.000 documents. This quota is defined in the company license.
- Each document count as 1 translation.
- We return a 403 error with all information in headers in this case.
- A document is not found or his language is not supported:
- This document is still counted in the quota.
- Other documents are not impacted.
- An error occurred when translating a field:
- Other fields are not impacted.
- An
error
containing helpful information is added in the document response.
Partial translation
When a document's text or title reaches a length of 10,000 bytes, only the first 10,000 bytes are translated.
- This limit is lowered depending on the content of the document, to avoid sentence breaks.
- If a sentence reaches the 10,000 bytes limit, it is ignored.
- If there is no sentence with less than 10.000 bytes, an error is thrown.
When a partial translation is done, the returned document will contain "partial": true