inference.eu

POST /v1/documents/convert

Document conversion API: PDF and Office files to Markdown, in the EU

Most company knowledge lives in PDFs, Word documents, slide decks and spreadsheets, and language models work best with clean text. The document conversion endpoint turns those files into Markdown that keeps headings, lists and tables, ready to chunk for search or to paste into a prompt. Contracts and internal reports are often the most sensitive files you have, and they are converted in European data centres.

  1. 01API format: OpenAI
  2. 02EU data centres
  3. 03Covered by one DPA
POST /v1/documents/convert
curl https://api.inference.eu/v1/documents/convert \
  -H "Authorization: Bearer $INFERENCE_EU_API_KEY" \
  -F file="@rahmenvertrag-2026.pdf" \
  -F output_format="markdown" \
  -F ocr="auto"

# {
#   "object": "document",
#   "filename": "rahmenvertrag-2026.pdf",
#   "pages": 14,
#   "output_format": "markdown",
#   "content": "# Rahmenvertrag\n\n## § 1 Vertragsgegenstand\n\n..."
# }

What the endpoint does

POST /v1/documents/convert takes a file as multipart/form-data and returns its content as text. Send the file in file and choose output_format: markdown keeps structure such as headings, numbered clauses, lists and tables, while text returns plain text without markup. The response contains the filename, the number of pages and the converted content.

Supported inputs include PDF, Word (.docx), PowerPoint (.pptx), Excel (.xlsx), HTML and common image formats. Born-digital PDFs are read directly, which is fast and exact. Scanned pages and photos of documents go through optical character recognition.

Key request fields

ocr controls text recognition. auto, the default, detects pages without a text layer and recognises them, while keeping digital text as it is. force runs recognition on every page, which helps with PDFs whose embedded text is broken or garbled. off skips it, which is fastest when you know the files are digital.

Tables are converted to Markdown tables so that rows and columns stay aligned for the model. Headers, footers and page numbers that repeat on every page are removed where they can be detected, because they add noise to retrieval. Spreadsheets become one table per sheet, and slides become one section per slide with the slide title as heading.

A practical pattern for RAG

A retrieval pipeline starts here. Convert each document to Markdown, then split it along its headings rather than at a fixed number of characters, so each chunk is a coherent section: a contract clause, a policy paragraph, a slide. Keep the heading path and the page number with each chunk as metadata, so answers can cite the source.

Embed the chunks with an embedding model, store them in your vector database, and rerank results at query time. For extraction tasks, send the Markdown to a chat model with a JSON schema instead. Converting once and storing the Markdown is cheaper than converting the same file on every question.

Errors and edge cases

Password-protected or encrypted files cannot be read and return a 400 error; remove the protection first. Corrupted files and unsupported formats also return 400 with a message naming the problem. Files above the maximum size return 413; the limit depends on your plan, and we confirm it with you.

Very complex layouts, such as multi-column newsletters, nested tables or text inside diagrams, can come out in an unexpected order. Check a sample of converted files from each source before indexing everything. Handwriting and poor scans reduce recognition quality; for pages where charts or handwriting carry the meaning, send the page image to a vision model as well.

Document conversion: common questions

The questions buyers, developers and legal teams ask us most. Something missing? Ask us directly.

Ask a question

Move your AI workloads to EU infrastructure

Tell us which models you use and roughly how much traffic you have. We reply within one working day with pricing and next steps.

  • Reply within one working day
  • Pricing for your volume
  • DPA ready to sign