docx
/doc
- Microsoft Word Documentpptx
- Microsoft PowerPoint Documentxlsx
- Microsoft Excel Documentpdf
- Portable Document Formathtm / html
- HTML Documenttxt
- Plain Text Documentxlf / xliff
- XLIFF Document, version 2.1srt
- SRT (SubRip Subtitle) Document
When translating a
doc
file, you will receive a docx
file as the output format.Step 1: upload a document to the /document
endpoint
This call uploads a document and queues it for translation. The call returns once the upload is complete, returning a document ID and key which can be used to query the translation status and to download the translated document once translation is complete.
Because the request includes a file upload, it must be an HTTP POST request with content type multipart/form-data
.
Please be aware that the uploaded document is automatically removed from the server once the translated document has been downloaded. You have to upload the document again in order to restart the translation.
You may specify the glossary to use for the document translation using the glossary_id
parameter. Important: This requires the source_lang
parameter to be set and the language pair of the glossary has to match the language pair of the request.
For more detail about request body parameters, see the Request Body Descriptions section further down on the page.
The examples below use our API Pro endpoint
https://api.deepl.com
. If you’re an API Free user, remember to update your requests to use https://api-free.deepl.com
instead.Example request: document upload (no glossary)
Example request: document upload (with glossary)
Example response
Request Body Descriptions
Note: themodel_type
parameter is not supported for API document translation and is only supported for text translation. It’s possible to submit a document translation request that includes the parameter, but the parameter will be ignored and will not have an effect on translation results.
Language of the text to be translated. If omitted, the API will attempt to detect the language of the text and translate it. You can find supported languages here.
The language into which the text should be translated. You can find supported languages here.
The document file to be translated. The file name should be included in this part’s content disposition. As an alternative, the filename parameter can be used.
The following file types and extensions are supported:
docx
: Microsoft Word Documentpptx
: Microsoft PowerPoint Documentxlsx
: Microsoft Excel Documentpdf
: Portable Document Formathtm / .html
: HTML Documenttxt
: Plain Text Documentxlf / .xliff
: XLIFF Document, version 2.1
The name of the uploaded file. Can be used as an alternative to including the file name in the file part’s content disposition.
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), NL
(Dutch), PL
(Polish), PT-BR
and PT-PT
(Portuguese), JA
(Japanese), and RU
(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 the prefer_...
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
A unique ID assigned to a glossary.
File extension of desired format of translated file, for example:
pdf
. If unspecified, by default the translated file will be in the same format as the input file.
Note: Not all combinations of input file and translation file extensions are permitted. See Document format conversions for the permitted combinations.Step 2: check the document status and wait for translation to complete
Retrieve the current status of a document translation process. Please note that theseconds_remaining
parameter is just an estimate and can be unreliable (e.g. sometimes it might return 2^27). We recommend polling the document status, either in regular intervals or with exponential back-off. Translation time depends on the document size and server load, but should be in the order of seconds for small documents and 1-2 minutes for larger documents once translation has started.
The example below uses our API Pro endpoint
https://api.deepl.com
. If you’re an API Free user, remember to update your requests to use https://api-free.deepl.com
instead.Example request: check document status
Example response: translating
Example response: done
Example response: queued
Example response: error
Step 3: download the translated document
Once the status of the document translation process isdone
, the result can be downloaded.
For privacy reasons the translated document is automatically removed from the server once it was downloaded and cannot be downloaded again.
The example below uses our API Pro endpoint
https://api.deepl.com
. If you’re an API Free user, remember to update your requests to use https://api-free.deepl.com
instead.Example request: download translated document
Client libraries and document translation
The examples on this page show how to translate documents with DeepL using the API directly. DeepL’s client libraries simplify API document translation by providing a convenience function to upload the document, check translation status and download the translated document with a single function call.Document format conversions
By default, the DeepL API returns translated documents in the same format as the input document. Using theoutput_format
parameter during document upload, you can select alternative output formats. For example, you can translate a PDF file and receive the translation as an editable Microsoft Word Document (DOCX), allowing you to make additional changes as necessary.
The range of alternative output formats you can select are indicated in the table below:
Input document format | Alternative output document formats |
---|---|
docx - Microsoft Word Document | |
Others | None |