# PDF to Word API: convert PDF to DOCX

> Convert PDF to editable Word (DOCX) files through a REST API. Tables become Word tables and scans are read too. Free API key, 20 files a day.

Send a PDF and get a Word document back with text you can edit. Tables become Word tables, and scanned pages are read too.

switchfile converts PDF to Excel, Word, PowerPoint and Markdown with its own engine, which we built ourselves. We measured PDF to Office against other online converters on 346 public PDFs we had never used. [PDF to Office benchmark](https://switchfile.io/benchmarks/pdf-to-office)

```bash
# API key: switchfile.io/dashboard/keys
code=$(curl -sL "https://api.switchfile.io/v1/convert?wait=30" \
  -o reply -D headers -w "%{http_code}" \
  -H "Authorization: Bearer $SWITCHFILE_API_KEY" \
  -H "Accept: application/octet-stream" \
  -F file=@report.pdf -F to=docx)
if grep -qi '^x-incomplete' headers; then
  grep -i '^x-notes' headers  # partial result, left in reply
elif [ "$code" = 200 ] && grep -qi '^content-disposition' headers; then
  mv reply report.docx
else
  # 202: still running, fetch links.self. Several files: result.files.
  cat reply  # otherwise the error
fi
```

```js
// npm i switchfile
import Switchfile from "switchfile";

const switchfile = new Switchfile({ apiKey: process.env.SWITCHFILE_API_KEY });
const conversion = await switchfile.convert("report.pdf", "docx");
if (conversion.result.incomplete) console.log((conversion.result.notes ?? []).join("\n"));
else await switchfile.download(conversion, "report.docx");
```

```python
# pip install switchfile-sdk
import os
import switchfile
switchfile.configure(api_key=os.environ["SWITCHFILE_API_KEY"])
conversion = switchfile.convert("report.pdf", "docx")
if conversion["result"]["incomplete"]:
    print("\n".join(conversion["result"].get("notes", [])))
else:
    switchfile.download(conversion, "report.docx")
```

```php
<?php // composer require switchfile/switchfile-php
require "vendor/autoload.php";

$switchfile = new Switchfile\Switchfile(["api_key" => getenv("SWITCHFILE_API_KEY")]);
$conversion = $switchfile->convert("report.pdf", "docx");
if ($conversion["result"]["incomplete"]) echo implode("\n", $conversion["result"]["notes"] ?? []), PHP_EOL;
else $switchfile->download($conversion, "report.docx");
```

[Get a free API key](https://switchfile.io/signup) (Free for 20 files a day, up to 50 pages per conversion.) [Try it in the browser](https://switchfile.io/pdf-to-docx).

## What comes back

With Accept: application/octet-stream, as in the curl example, a 200 response is the file itself when the conversion has exactly one result file. With several result files, for example one image per page, or without that header, you get the conversion as JSON, and the files are in result.files:

```json
{
  "id": "0b8a7c1e-5d0f-4a51-9f39-2f7f4c1d9a10",
  "object": "conversion",
  "status": "finished",
  "progress": 100,
  "input": {
    "filename": "report.pdf",
    "format": "pdf",
    "size": 48213
  },
  "to": "docx",
  "options": {},
  "result": {
    "files": [
      {
        "filename": "report.docx",
        "size": 61544,
        "url": "https://api.switchfile.io/files/2a6f8e1c-4b3d-4e7a-9c5f-8d1b0e2a4c67/report.docx?expires=1794074402&signature=3f9c2a7d41e8b6c05d1f9e2a7b4c8d3e6f0a1b2c3d4e5f60718293a4b5c6d7e8"
      }
    ],
    "incomplete": false
  },
  "download_url": "https://api.switchfile.io/files/2a6f8e1c-4b3d-4e7a-9c5f-8d1b0e2a4c67/report.docx?expires=1794074402&signature=3f9c2a7d41e8b6c05d1f9e2a7b4c8d3e6f0a1b2c3d4e5f60718293a4b5c6d7e8",
  "error": null,
  "credits": 2,
  "batch_id": null,
  "created_at": "2026-11-06T18:00:00+00:00",
  "finished_at": "2026-11-06T18:00:02+00:00",
  "expires_at": "2026-11-07T18:00:02+00:00",
  "links": {
    "self": "https://api.switchfile.io/v1/conversions/0b8a7c1e-5d0f-4a51-9f39-2f7f4c1d9a10"
  }
}
```

download_url is a signed link to the result. It works without your API key until expires_at, 24 hours after the conversion finished.

No browser at hand? POST /v1/signup with an email address sends a code, and POST /v1/signup/verify with that code returns the key. [Get an API key without a browser](https://switchfile.io/docs/authentication#get-an-api-key-without-a-browser)

## What you get

- **Text you can edit**: Text comes back as paragraphs, and tables become Word tables. Pictures stay where they are on the page.
- **Forms keep their layout**: Pages that look like forms keep their layout as closely as possible. prioritize_visual_appearance places all text where it sits on the page.
- **Scanned pages too**: Scanned pages are read with text recognition. The language is detected on its own, or you set ocr_language.
- **Page ranges**: pages picks the pages to convert. Up to 50 pages without credits and 300 with credits.

Step by step, with a folder of PDFs and error handling: [Convert PDF to Word in Python](https://switchfile.io/docs/pdf-to-word-python)

The tables of a PDF as rows and cells for your code: [PDF table extraction API](https://switchfile.io/pdf-table-extraction-api)

Converter pages: [PDF to DOCX](https://switchfile.io/pdf-to-docx)

## Options

| Option | Meaning |
|---|---|
| `pages` | Pages to convert, for example 1-3,5 or all. Up to 50 pages without credits, up to 300 with credits. |
| `prioritize_visual_appearance` | Place all text at its position on the page, with graphics as a background picture. Otherwise text flows as paragraphs, and only pages that look like forms keep their exact layout. Default: false. |
| `ocr_language` | Language of scanned pages: "auto" (detected on the first scanned page) or "deu", "eng", "spa", "fra", joined with + as in "deu+eng". Default: auto. |
| `connect_hyphens` | Join words that are split by a hyphen at the end of a line. Default: false. |
| `password` | Password to open the PDF. |

A 202 response means the conversion is still running: at once without the wait parameter, after 30 seconds with it. Fetch links.self with GET until status is finished, then download download_url. If you set a webhook URL for the request or your account, we also call it when the conversion is done. Up to 50 files go into one batch.

## Where your files go

- **Converted on our server**: Conversions run on our server in the EU. Stored files and results are deleted after 24 hours. [Hosting in the privacy policy](https://switchfile.io/privacy#hosting)
- **Without storage: store=false**: The file and the result are processed in memory while the request runs and are not written to our file storage or database. The service that converts them cannot open connections to the internet. In this mode files can be up to 50 MB. Your usage history keeps the time, formats, sizes and credits, never the file name. [Converting without storage](https://switchfile.io/docs/no-store)
- **Data processing agreement**: We sign a data processing agreement (DPA) under Art. 28 GDPR on request. Write to hello@switchfile.io. [Security](https://switchfile.io/security#dpa)

```bash
code=$(curl -s "https://api.switchfile.io/v1/convert?store=false" \
  -o reply -D headers -w "%{http_code}" \
  -H "Authorization: Bearer $SWITCHFILE_API_KEY" \
  -F file=@report.pdf -F to=docx)
if grep -qi '^x-incomplete' headers; then
  grep -i '^x-notes' headers  # partial result, left in reply
elif [ "$code" = 200 ] && grep -qi '^content-disposition' headers; then
  mv reply report.docx
else
  cat reply  # otherwise the error
fi
```

## Pricing

Free: 20 files/day, up to 50 pages per conversion, free API key
Credit pack: from €7, 500 credits, one-time, no subscription
Monthly: from €4, 500 credits a month, cancel at any time
PDF to Word: 1 credit per started minute of conversion time, at least 2 per file.
Up to 300 pages with credits.
A file that is done within a minute uses 2 credits, which costs €0.0086 to €0.028 depending on the plan or pack.
Add ?dry_run=1 to a convert request to see the credits and the price of a file before you convert it. [Cost before converting](https://switchfile.io/docs/simple-api#dry-run)
[Pricing](https://switchfile.io/pricing)

## What a PDF conversion costs

| Conversion | Pages | Time | Credits | Smallest pack (500 credits for €7) | Starter plan (2,000 credits for €13 a month) |
| --- | --- | --- | --- | --- | --- |
| PDF to Word, digital | 1 | 2.2 s (0.9 to 4.9 s) | 2 | €0.028 | €0.013 |
| PDF to Word, digital | 9 to 11 | 7.3 s (6.1 to 23 s) | 2 | €0.028 | €0.013 |
| PDF to Word, digital | 46 to 56 | 64 s (38 to 221 s) | 2 to 4 | €0.028 to €0.056 | €0.013 to €0.026 |
| PDF to Word, scanned | 12 | 6.8 s | 2 | €0.028 | €0.013 |

| For comparison | Credits | CloudConvert package (1,000 credits for €17.85) | CloudConvert subscription (2,000 credits for €17.85 a month) |
| --- | --- | --- | --- |
| CloudConvert, PDF to Word | 4 or more | €0.071 or more | €0.036 or more |

Measured on 17 November 2026 with 13 public PDFs per format on the same server setup as our live service. Time is the median; the range in brackets runs from the quickest to the slowest file.

The time depends on the file: dense tables and scanned pages take longer. A conversion costs one credit per started minute, at least 2 for PDF to Office, so a slower file can cost more than the table shows.

CloudConvert lists PDF to Office at a base of 4 credits (format list: pdftron-pdf2word), plus one credit for every extra minute. Its row uses that list price, because the time a conversion takes there was not part of this measurement. Prices include 19% VAT, as shown to visitors from Germany. Checked on 17 November 2026. switchfile is not affiliated with CloudConvert.

Quality is a separate benchmark: we measured PDF to Office against other online converters on 346 public PDFs we had never used.

Sources: [CloudConvert pricing](https://cloudconvert.com/pricing), [CloudConvert format list (API)](https://api.cloudconvert.com/v2/convert/formats?filter[input_format]=pdf), [CloudConvert price data](https://api.cloudconvert.com/v2/plans/package/1000).

## SDKs

Client libraries and integrations: [SDK overview](https://switchfile.io/developers#sdks).

## Questions

### What are the limits?

Without credits a PDF can have up to 50 pages, with credits up to 300. For a longer PDF, convert it in parts with the pages option. Files can be up to 1 GB. A file sent in the request can be up to 100 MB; larger files go through an upload, which the SDKs do on their own. One conversion can run for up to 5 minutes. Without storage (store=false), files can be up to 50 MB.

### Is there a free PDF to Word API?

Yes. A free API key converts 20 files and 20 minutes of conversion time a day, whichever runs out first, each PDF with up to 50 pages. After that, conversions use credits, and with credits a PDF can have up to 300 pages. Without credits left, the API answers 402 with the code CREDITS_EXCEEDED until the quota resets at midnight UTC.

### Does the Word file keep the layout of the PDF?

Text comes back as paragraphs you can edit, and tables become Word tables. Pictures stay where they are on the page, and pages that look like forms keep their layout as closely as possible. Set prioritize_visual_appearance to place all text where it sits on the page, with graphics as a background.

### Does it work with scanned PDFs?

Yes. Scanned pages are read with text recognition and become text you can edit. The language is detected on its own; to set it, pass ocr_language, for example deu for German.

### How do I convert PDF to Word in Python or Node.js?

Install the SDK with pip install switchfile-sdk or npm i switchfile. Then call convert with the PDF and "docx" and download the result; the SDK waits until the Word file is ready. The tabs at the top of this page show the whole script.

### How long do you keep my files?

A stored conversion keeps the file and the result for 24 hours, then both are deleted. With store=false no file is stored: the result comes back in the response, and only an entry with time, formats, sizes and credits stays in your usage history for 400 days.
