Skip to content
For developers

PDF to Markdown API for LLM and RAG pipelines

Send a PDF and get Markdown back that a language model can read. Tables become pipe tables, and the text follows the reading order of the page.

Free for 20 files a day, up to 50 pages per conversion.

# 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=md)
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.md
else
  # 202: still running, fetch links.self. Several files: result.files.
  cat reply  # otherwise the error
fi

Tables in a public benchmark

In our public benchmark of 160 business PDFs, switchfile put 93.8 % of the numbers in the right table cell, the highest-scoring open-source tool selected for this comparison 67.9 %, as a mean per PDF with numeric table cells (n = 102 of 160). One more open-source tool in the benchmark repository scored higher than the selected open-source tools and is left out of this comparison. Measured by us on 16 November 2026, digital PDFs only.

See the benchmark and its limits

93.8 % vs 67.9 %

All PDFs, mean per PDF with numeric table cells (n = 102 of 160)

What comes out

A page from an annual report and the Markdown you get for it.

Page 4 of the PDF

Annual report 2025 Ā· Page 4 (running header, left out)

Revenue by region

RegionQ1Q2
North1,234.561,310.00
South789.00802.40
report.md
<!-- page 4 -->
## Revenue by region

| Region | Q1 | Q2 |
| --- | --- | --- |
| North | 1,234.56 | 1,310.00 |
| South | 789.00 | 802.40 |

Tables as pipe tables

One cell per value, so a model knows which number is which.

Text in reading order

Running headers and page numbers stay out of your chunks.

Scanned pages too

Scanned pages are read with text recognition, and the language is detected on its own.

Page numbers for citations

Every page starts with a comment that gives its number, so a chunk can cite its page.

Details

Long documents and webhooks

Leave out wait and the request answers at once with the conversion id while the conversion keeps running. Pass webhook_url to be told when it is done, or collect the result later. The same works for many files at once and for files behind a URL. Waiting and webhooks in the docs

Office files to Markdown

Send them with the same call and to=md.

  • Word to Markdown: Headings and tables keep their structure. Images are left out; alt text stays as [Image: alt text].
  • PowerPoint to Markdown: Each slide becomes a section with its title and text, followed by its speaker notes.
  • Excel to Markdown: Each worksheet becomes a section with one table, with values formatted the way the spreadsheet shows them.
Where your files go
  • Conversions run on our server in the EU. Stored files and results are deleted after 24 hours. Hosting in the privacy policy
  • With store=false the PDF and the Markdown are processed in memory while the request runs and are not written to our file storage or database. Files can be up to 50 MB. Converting without storage
  • We sign a data processing agreement (DPA) under Art. 28 GDPR on request. Write to hello@switchfile.io. Security
Pricing and limits

Free for 20 files a day, each PDF up to 50 pages and 1 GB. PDF to Markdown is billed by conversion time, not by page: 1 credit per started minute, at least 1 per file. Up to 300 pages with credits. A file that is done within a minute uses 1 credit, which costs €0.0043 to €0.014 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 prices
Questions

Parameters and error codes are in the API docs, client libraries in the SDK overview.

What does the Markdown file contain?
Headings and lists keep their structure, and tables become Markdown tables. Running headers and page numbers are left out. Each page starts with an HTML comment that gives its number. Pictures appear as placeholders without image data, and footnotes stay on their page.
Does it work with scanned PDFs?
Yes. Scanned pages are read with text recognition, so their text ends up in the Markdown too. The language is detected on its own; to set it, pass ocr_language, for example deu for German.
Can I send Office files too?
Yes, with the same call and to=md. A Word file keeps its headings and tables. A presentation becomes one section per slide with the speaker notes, and a workbook one section per worksheet with its table.
What are the limits?
Without credits you get 20 files and 20 minutes of conversion time a day, whichever runs out first, and a PDF can have up to 50 pages and 1 GB. With credits a PDF can have up to 300 pages. For a longer PDF, convert it in parts with the pages option, for example 1-50. Without storage, a file can be up to 50 MB.
How long do you keep my files?
A stored conversion keeps the PDF and the Markdown for 24 hours, then both are deleted. With store=false no file is stored: the Markdown comes back in the response, and only an entry with time, formats, sizes and credits stays in your usage history for 400 days.