PDF to Word API: convert PDF to DOCX
Send a PDF and get a Word document back with text you can edit. Tables become Word tables, and scanned pages are read too.
# 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
// 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");
# 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 // 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");
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:
{
"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"
}
}What you get
Text you can edit
Forms keep their layout
Scanned pages too
Page ranges
Measured against CloudConvert and FreeConvert
On 146 public PDFs we had never used (38 of them scans), converted to Word, switchfile scored 81.5 of 100, CloudConvert 78.7 and FreeConvert 78.9: switchfile ahead of CloudConvert by 2.8 and FreeConvert by 2.6 points.
See the benchmark, with the method and what we got wrongOptions
Send them in options as JSON. Options that do not fit the format are rejected with a message that names them.
| Option | Meaning |
|---|---|
| pagespages | Pages to convert, for example 1-3,5 or all. Up to 50 pages without credits, up to 300 with credits. |
| prioritize_ | 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 of scanned pages: "auto" (detected on the first scanned page) or "deu", "eng", "spa", "fra", joined with + as in "deu+eng". Default: auto. |
| connect_ | Join words that are split by a hyphen at the end of a line. Default: false. |
| passwordpassword | Password to open the PDF. |
Where your files go
Converted on our server
Without storage: store=false
Data processing agreement
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
fiPricing
Free
20
up to 50 pages per conversion, free API key
Credit pack
€7
500 credits, one-time, no subscription
Monthly
€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
See all pricesSDKs and integrations
What a PDF conversion costs
Measured times and the credits they cost, with the price in euros.
| 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 |
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
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, CloudConvert format list (API), CloudConvert price data.
Questions
About PDF to Word through the API.
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.