Skip to main content
An example document is a document written in the language you translate into, such as a published newsletter, a product manual, or a past report. When a translation request references it, DeepL adapts the translation to the document’s style, tone, and terminology. Use this guide when you already have published text in your target language that shows how translations should read, and you want to store it once and reuse it across requests. To send a few source and target sentence pairs with each request instead, see Using adaptive translation.

Prerequisites

The steps below use member-newsletter.txt, a German customer newsletter that addresses readers informally and uses gender-inclusive forms such as “Kund:innen”.

Step 1: Create the import job

Declare the file you are going to upload. Send its name and its size in bytes, and optionally a name for the example document.
Example request
Example response
Keep the job ID for Step 3, and export the upload URL as UPLOAD_URL for Step 2. The URL stops working at the expiry time in the response. To get the size of a file in bytes, run wc -c < member-newsletter.txt.

Step 2: Upload the file

Send the file to the upload URL with a PUT request. The URL is already signed, so leave out the Authorization header.
Example request
A successful upload returns 201 Created. Processing starts on its own, so there is no call to confirm the upload.

Step 3: Wait for the import to finish

Poll the job until its status is completed, failed, or expired. Imports of short documents typically finish within a minute.
Example request
Example response
Copy the example document ID from the result. If the status is failed, the result carries a message instead. See the import job reference for the status values and failure messages.

Step 4: Translate with the example document

Reference the example document in a text translation request. Send the request as JSON and translate into the language the document is written in.
Example request
Example response
If you want to apply several example documents, list up to 10 IDs. Documents that are not written in the target language of the request are left out without an error, so one list can cover several target languages.
Example documents are only applied to requests with a JSON body. In a form-encoded request they are ignored, and the response is a normal 200 with an unadapted translation.

Verify the result

Nothing in the response says whether an example document was applied. To confirm it, send the same request without the example document and compare the two translations.
Example response without the example document
With the example document, the translation picks up the newsletter’s informal address (“dein” instead of “Ihr”) and its gender-inclusive forms. “Teilnehmer:innen” follows the document’s pattern for a sentence the document does not contain.

Remove an example document

To see which example documents your account holds, list them. When a document is out of date, delete it and import the new version, because an imported document cannot be edited. Remove the ID from your translation requests before you delete the document. A request that references a deleted example document fails.
Example request
A successful delete returns 204 No Content with an empty body.

Troubleshooting