pdf2md API

PDF to Markdown. Version 0.1.0, parser pdf-inspector 1.17.0.

This instance is open: no API key is required.

Everything is parsed in process by a WebAssembly module. Uploads are held in memory for the length of the request and are never written to disk or sent anywhere else.

Convert

curl -X POST https://pdf2md-api.dudko.dev/api/v1/convert \
  -F file=@report.pdf \
  -F profile=compact

Returns text/markdown. Add ?format=json for the full result — page count, detected type, layout, which pages would need OCR.

The body may also be a raw application/pdf, or JSON {"pdf": "<base64>", "options": {…}}. Options work as query parameters in every case.

Detect

curl -X POST https://pdf2md-api.dudko.dev/api/v1/detect --data-binary @report.pdf

Classification only, in milliseconds: is this text, a scan or a mix, how many pages, and which of them would need OCR. Use it to route work before paying for a conversion.

Plain text

curl -X POST https://pdf2md-api.dudko.dev/api/v1/text --data-binary @report.pdf

Options

OptionMeaning
pages1-indexed selection: 1,3,5-7
passwordfor an encrypted document
profilefidelity (default) or compact, which spends fewer tokens
includePageMarkersinsert <!-- Page N --> between pages
includeImages, includeLinksemit image placeholders / extracted hyperlinks
stripHeadersFootersdrop running headers and footers
detectHeaders, detectLists, detectCode, detectBold, detectItalic, detectUnderlineturn individual detectors off with =false
removePageNumbers, formatUrls, fixHyphenationpost-processing, all on by default
baseFontSizebody text size in points, when the heuristic gets it wrong

GET /api/v1/options returns the same list as JSON, plus this instance's limits.

Response headers

HeaderMeaning
X-Pdf-TypeTextBased, Scanned, ImageBased or Mixed
X-Pdf-Pagespage count
X-Pdf-Needs-Ocrcomma-separated 1-indexed pages, empty when none
X-Pdf-Encoding-Issuestrue when the text is probably garbled
X-Pdf-Msconversion time

Status codes

401missing or wrong API key, or the wrong password for an encrypted PDF
413larger than 32 MB
415not a PDF
422a PDF, but nothing could be extracted — a scan, usually
429rate limit or daily quota
503the queue is full; retry shortly
504the conversion hit the deadline

This is not OCR

A scanned document is reported as Scanned with no Markdown and a 422 from /convert. Run it through an OCR tool first. Watch X-Pdf-Encoding-Issues as well: text came out, but the fonts declare an encoding the bytes do not honour, so the characters are probably wrong.

Doing it yourself

The same conversion runs in a browser and in Node with no server at all — npm i @dudko.dev/pdf-to-md-core, or npx @dudko.dev/pdf-to-md-cli file.pdf. The web app at pdf2md.dudko.dev never calls this API: it runs the same module in the visitor's browser.