Translate documents
The document translation API allows you to translate whole documents and supports the following file types and extensions:
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
Please note that with every submitted document of type .pptx, .docx, .doc, .xlsx, or .pdf, you are billed a minimum of 50,000 characters with the DeepL API plan, no matter how many characters are included in the document.
The maximum upload limit for documents is available here and may vary based on API plan and document type.
We also provide a spec that is auto-generated from DeepL's OpenAPI file. You can find it here.
When translating a doc
file, you will receive a docx
file as the output format.
Step 1: upload a document to the /document
endpoint
/document
endpointThis 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.
These examples are for demonstration purposes only. In production code, the authentication key should not be hard-coded but instead fetched from a configuration file or environment variable.
Request Body Descriptions
Body parameter | Description |
---|---|
| |
| |
| 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:
Type: |
| The name of the uploaded file. Can be used as an alternative to including the file name in the file part's content disposition.
Type: |
|
Type: |
| A unique ID assigned to a glossary.
Type: |
| File extension of desired format of translated file, for example: Type: |
Step 2: check the document status and wait for translation to complete
Retrieve the current status of a document translation process.
Please note that the seconds_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.
Step 3: download the translated document
Once the status of the document translation process is done
, 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.
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 the output_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 |
---|---|
| |
Others | None |
Last updated