Bytefusedocs

Extract

PDF to Markdown

Convert a PDF into clean, structure-preserving Markdown for RAG and LLM ingestion — headings, GFM tables, lists, code and links intact. Deterministic by default, with optional AI tiers.

Login required 40 credits / callLLM: 100 · Vision: 200Synchronous

Overview

Upload a PDF; the Markdown comes back inline in the response body (no download URL). Billed per call.

POSThttps://api.bytefuse.in/api/v1/pdf/to-markdown

Auth required — and AI tiers are paid

This tool is not on the free-try path: anonymous → 401. The AI paths (llm_cleanup=true or engine=vision) are paid features — a free-tier account requesting them gets 403. The standard engine=auto path works on any paid plan.

Request

Content type multipart/form-data:

filefilerequired
The PDF to convert. Must end in .pdf (else 415).
llm_cleanupbooleanoptional
Run a model-agnostic LLM polish pass over the deterministic Markdown — fixes broken structure and OCR noise without changing wording. Paid feature (free tier → 403).Default: false
enginestringoptional
auto (deterministic) or vision (premium AI, structure-perfect on scanned/complex pages). Any other value → 422. Paid feature (free tier → 403).Default: auto

Engines & pricing

Billed per call. Precedence when both are set: vision > LLM cleanup > default.

ConditionCost / call
engine=auto, llm_cleanup=false (default)pdf.to_markdown40
engine=auto, llm_cleanup=truepdf.to_markdown_llm100
engine=visionpdf.to_markdown.ai200

Graceful behaviour

engine=auto routes digital PDFs through a fast deterministic converter and scanned PDFs through OCR. llm_cleanup is best-effort — if the LLM pass fails, the deterministic Markdown is returned unchanged (still billed the LLM rate). engine=vision falls back to the deterministic engine if it finds nothing; if AI vision isn’t configured at all, it returns 422.

Response

200 OK, application/json:

200 OK
{
  "success": true,
  "markdown": "# Title\n\nBody paragraph…\n\n| A | B |\n|---|---|\n| 1 | 2 |",
  "engine": "pymupdf4llm",
  "pages": 5,
  "word_count": 812,
  "headings": 7,
  "credits_charged": 40
}
successbooloptional
Always true on 200.
markdownstringoptional
The full Markdown text.
enginestringoptional
The pipeline that actually ran — pymupdf4llm, ocr, pymupdf4llm+llm, ocr+llm, or vision.
pagesintoptional
Page count.
word_countintoptional
Words in the Markdown.
headingsintoptional
Number of Markdown heading lines.
credits_chargedintoptional
Credits billed. Mirrors X-Credits-Charged.

Examples

# standard tier
curl -X POST https://api.bytefuse.in/api/v1/pdf/to-markdown \
  -H "X-API-Key: dt_live_your_key" \
  -F "file=@paper.pdf" \
  -F "engine=auto"

# premium vision tier (paid plans)
curl -X POST https://api.bytefuse.in/api/v1/pdf/to-markdown \
  -H "X-API-Key: dt_live_your_key" \
  -F "file=@scanned.pdf" \
  -F "engine=vision"

Errors

401Anonymous / not signed in on the standard path — login-only.
403A free-tier (or anonymous) account requested a paid AI path (llm_cleanup=true or engine=vision).
415Missing filename or not a .pdf.
422engine is invalid, the PDF is password-protected, or engine=vision was requested without AI vision configured.
402 / 429 / 503Insufficient credits, rate limited, or capacity/config error.
500Conversion failed unexpectedly.