Skip to main content

Document Processing API

Tinfoil’s document processing service simplifies parsing diverse document formats — including PDFs, DOCX, PPTX, XLSX, HTML, and images — with sophisticated understanding of document structure, layout, tables, and formulas. Under the hood, Tinfoil uses Docling for document parsing.

API Examples

The document processing endpoint accepts multipart/form-data requests at /v1/convert/file. Upload a file and the server automatically selects the correct processing pipeline, formats, and OCR settings.
import { SecureClient } from 'tinfoil'
import fs from 'fs'

const client = new SecureClient()

const fileBuffer = fs.readFileSync('doc.pdf')
const blob = new Blob([fileBuffer], { type: 'application/pdf' })

const formData = new FormData()
formData.append('files', blob, 'doc.pdf')

const response = await client.fetch('/v1/convert/file', {
  method: 'POST',
  body: formData,
})

const result = await response.json()
// result.document.md_content contains the converted Markdown
console.log(result.document.md_content)
The server-side router infers the input format, output format, pipeline, and image/OCR handling from the uploaded file. No additional parameters are required.

Attestation

The document upload API uses the same attestation mechanism as other Tinfoil services. Use SecureClient (as shown above) to verify attestation automatically.

Try Private Chat

Experience document upload in our private chat interface with real-time privacy verification.

Docling Project

Learn more about the Docling project and its capabilities for document processing.