PDF translation API
PDF translation is experimental. Its request options, its output, and its price can change.
The PDF translation API translates the text of a PDF into another language and returns a PDF with the same number of pages. Pages with a text layer keep their layout. The API first recognizes scanned pages and then translates them. For every option, response, and error, see the API reference.
Translate a PDF
Send the PDF in the file part and the options as JSON in the data part. The response is the translated PDF.
The example below translates document.pdf into German and saves the result as translated.pdf:
curl -X POST https://api.nutrient.io/processor/translate \ -H "Authorization: Bearer your_api_key_here" \ -F file=@document.pdf \ -F data='{"targetLanguage": "de"}' \ -o translated.pdfimport jsonimport requests
with open("document.pdf", "rb") as file: response = requests.post( "https://api.nutrient.io/processor/translate", headers={"Authorization": "Bearer your_api_key_here"}, files={"file": file}, data={"data": json.dumps({"targetLanguage": "de"})}, timeout=660, )
response.raise_for_status()with open("translated.pdf", "wb") as output: output.write(response.content)A translation can take several minutes. Set your HTTP client’s timeout above 10 minutes, or use asynchronous translation.
With a test API key, the API checks the request and returns a placeholder PDF without translating it.
Options
| Option | Default | Description |
|---|---|---|
targetLanguage | Required | The language to translate into, as an ISO 639-1 code. |
mirrorLayout | true | Applies only when targetLanguage is ar (Arabic): Mirror the layout of pages with a text layer so they read right to left. Ignored for every other language. |
translateTextInImages | true | On pages with a text layer, also translate the text inside pictures. |
targetLanguage accepts ar (Arabic), de (German), el (Greek), en (English), es (Spanish), fr (French), it (Italian), ja (Japanese), nl (Dutch), pl (Polish), pt (Portuguese), ru (Russian), and zh (Chinese). The API rejects an unknown option with status 400.
Partial translations
If the translation of a text block fails validation, the block keeps its original text. The request still returns status 200 and is charged. The X-Nutrient-Untranslated-Blocks response header gives the number of blocks left in the source language. The header is absent when every block was translated.
Limits and pricing
- A document can have at most 50 pages. A request with a longer document returns status
400. - A translation that doesn’t finish within 10 minutes fails with status
504. - A translation costs $0.10 per page of the translated PDF. Accounts still on a credits plan pay 1.5 credits per page. Translations that fail or time out aren’t charged. Refer to pricing per tool.
Asynchronous translation
A synchronous request keeps the connection open until the translated PDF is ready, which can take up to 10 minutes. An asynchronous request returns at once with a translation run. You then check the run’s status and download the PDF once the run is done. A run is charged only if it finishes successfully.
Start a run
Send the same request as a synchronous translation, with the Prefer: respond-async header. The API returns status 202 with a JSON description of the run. The Location header gives the path of the status:
curl -X POST https://api.nutrient.io/processor/translate \ -H "Authorization: Bearer your_api_key_here" \ -H "Prefer: respond-async" \ -H "Idempotency-Key: translate-document-42" \ -F file=@document.pdf \ -F data='{"targetLanguage": "de"}'{ "id": "7KQ1798ESSE966BQNKQJXMQZHF", "status": "queued", "createdAt": "2026-11-16T10:00:00Z", "expiresAt": "2026-11-17T10:00:00Z", "statusUrl": "/processor/translate/runs/7KQ1798ESSE966BQNKQJXMQZHF"}The Idempotency-Key header is optional. Sending the same request again with the same key — for example, after a network error — returns the original run instead of starting a second translation. A request that reuses the key with a different PDF or different options returns status 409.
Check the run’s status
Call GET /processor/translate/runs/{runId} until status is done or error:
curl https://api.nutrient.io/processor/translate/runs/7KQ1798ESSE966BQNKQJXMQZHF \ -H "Authorization: Bearer your_api_key_here"| Status | Meaning |
|---|---|
queued | The run is waiting to start. |
running | The document is being translated. |
done | The translated PDF is ready. The response adds resultUrl and untranslatedBlocks. |
error | The translation failed. The response adds an error object. A failed run isn’t charged. |
Download the translated PDF
When the run is done, download the PDF from resultUrl:
curl https://api.nutrient.io/processor/translate/runs/7KQ1798ESSE966BQNKQJXMQZHF/result \ -H "Authorization: Bearer your_api_key_here" \ -o translated.pdfDownloading the result of a run that isn’t done returns status 409.
How long runs are kept
You can read a run’s status and download its PDF for 24 hours after the run finishes. After that, both requests return status 410. Once the run is deleted, they return status 404. Only your organization can read its runs.
Test API keys can’t start asynchronous runs. Their request returns status 403.
Errors
| Status | Meaning |
|---|---|
400 | The file isn’t a PDF, an option is missing or invalid, or the document has more than 50 pages. |
402 | The organization’s balance is too low, or a payment restriction applies. |
403 | A test API key asked for an asynchronous translation. |
502 | The translation failed. It isn’t charged. |
504 | The translation didn’t finish within 10 minutes. It isn’t charged. |