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 powerful and accurate document parsing.

API Examples

The document processing endpoint accepts multipart/form-data requests at /v1/convert/file. Upload a file along with processing parameters to convert documents into structured formats like Markdown.
Tinfoil’s document processing service is compatible with the Docling API and supports all Docling parameters.See the Docling reference for the full list of options.
import { SecureClient } from 'tinfoil'
import fs from 'fs'

const client = new SecureClient()

const formData = new FormData()
formData.append('files', fs.createReadStream('doc.pdf'))
formData.append('model', 'doc-upload')

// Output format (md, json, yaml, html, text, doctags)
formData.append('to_formats', 'md')
// Input format (pdf, docx, pptx, xlsx, html, image, asciidoc, md, csv)
formData.append('from_formats', 'pdf')
formData.append('pipeline', 'standard')

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)

Parameters

ParameterDescription
filesThe document file to process
modelModel identifier (doc-upload)
to_formatsOutput format: md, json, yaml, html, text, doctags
from_formatsInput format: pdf, docx, pptx, xlsx, html, image, asciidoc, md, csv
pipelineProcessing pipeline (standard)
do_ocrEnable OCR for scanned documents
include_imagesInclude images in output
image_export_modeImage handling: placeholder, embedded, referenced
See the Docling reference for additional parameters like do_table_structure, do_formula_enrichment, and ocr_engine.

Attestation

The document upload API uses the same attestation mechanism as our other services. See our attestation architecture and predicate documentation for more details.