---
title: "PDF translation API"
canonical_url: "https://www.nutrient.io/guides/dws-processor/tools-and-api/pdf-translation-api/"
md_url: "https://www.nutrient.io/guides/dws-processor/tools-and-api/pdf-translation-api.md"
last_updated: "2026-11-24T00:00:00.000Z"
description: "Translate the text of a PDF into another language with the experimental PDF translation API. The translated PDF keeps the original page count and layout."
---

# 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](https://www.nutrient.io/api/reference/public/#tag/Document-Editing/operation/processor-translate).

## 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`:

### Shell

```bash

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.pdf

```

### Python

```python

import json
import 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](#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](https://www.nutrient.io/guides/dws-processor/pricing/pricing-per-tool.md).

## 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:

```bash

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"}'

```

```json

{
  "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`:

```bash

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`:

```bash

curl https://api.nutrient.io/processor/translate/runs/7KQ1798ESSE966BQNKQJXMQZHF/result \
  -H "Authorization: Bearer your_api_key_here" \
  -o translated.pdf

```

Downloading 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.                             |
---

## Related pages

- [Tools and APIs](/guides/dws-processor/tools-and-api.md)
- [Analyze Build API](/guides/dws-processor/tools-and-api/analyze-build-api.md)
- [Choose the right conversion and PDF generation workflow](/guides/dws-processor/tools-and-api/choose-the-right-conversion-and-pdf-generation-workflow.md)
- [Choose the right page and document editing workflow](/guides/dws-processor/tools-and-api/choose-the-right-page-and-document-editing-workflow.md)
- [Choose the right permissions and document security workflow](/guides/dws-processor/tools-and-api/choose-the-right-permissions-and-document-security-workflow.md)
- [Choose the right redaction workflow](/guides/dws-processor/tools-and-api/choose-the-right-redaction-workflow.md)
- [Document-to-image API](/guides/dws-processor/tools-and-api/document-to-image-api.md)
- [DOCX templating API](/guides/dws-processor/tools-and-api/docx-templating-api.md)
- [Image-to-PDF API](/guides/dws-processor/tools-and-api/image-to-pdf-api.md)
- [Import Instant JSON API](/guides/dws-processor/tools-and-api/import-instant-json-api.md)
- [Import XFDF annotations API](/guides/dws-processor/tools-and-api/import-xfdf-annotations-api.md)
- [Markdown-to-PDF API](/guides/dws-processor/tools-and-api/markdown-to-pdf-api.md)
- [Office-to-PDF API](/guides/dws-processor/tools-and-api/office-to-pdf-api.md)
- [PDF digital signature API](/guides/dws-processor/tools-and-api/pdf-digital-signature-api.md)
- [PDF flatten API](/guides/dws-processor/tools-and-api/pdf-flatten-api.md)
- [PDF form filling API](/guides/dws-processor/tools-and-api/pdf-form-filling-api.md)
- [PDF generator API](/guides/dws-processor/tools-and-api/pdf-generator-api.md)
- [PDF linearization API](/guides/dws-processor/tools-and-api/pdf-linearization-api.md)
- [PDF merge API](/guides/dws-processor/tools-and-api/pdf-merge-api.md)
- [PDF OCR API](/guides/dws-processor/tools-and-api/pdf-ocr-api.md)
- [PDF optimization API](/guides/dws-processor/tools-and-api/pdf-optimization-api.md)
- [PDF page manipulation API](/guides/dws-processor/tools-and-api/pdf-page-manipulation-api.md)
- [PDF rotate API](/guides/dws-processor/tools-and-api/pdf-rotate-api.md)
- [PDF security API](/guides/dws-processor/tools-and-api/pdf-security-api.md)
- [PDF split API](/guides/dws-processor/tools-and-api/pdf-split-api.md)
- [PDF-to-HTML API](/guides/dws-processor/tools-and-api/pdf-to-html-api.md)
- [PDF-to-image API](/guides/dws-processor/tools-and-api/pdf-to-image-api.md)
- [Convert PDF to Markdown with the Processor API](/guides/dws-processor/tools-and-api/pdf-to-markdown-api.md)
- [PDF-to-Office API](/guides/dws-processor/tools-and-api/pdf-to-office-api.md)
- [PDF-to-PDF/A API](/guides/dws-processor/tools-and-api/pdf-to-pdfa-api.md)
- [PDF watermark API](/guides/dws-processor/tools-and-api/pdf-watermark-api.md)
- [PDF/UA auto-tagging API](/guides/dws-processor/tools-and-api/pdfua-api.md)
- [Redaction API](/guides/dws-processor/tools-and-api/redaction-api.md)

