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.You can use document processing in two ways:
Call /v1/convert/file directly when you want extracted Markdown back from the document service.
Send a base64-encoded file through the OpenAI-compatible /v1/responses or /v1/chat/completions APIs. Tinfoil will privately convert supported binary documents to text before forwarding the request to the model.
Current scope: OpenAI-compatible file input support currently accepts base64 file_data only. file_id and the /v1/files upload flow are not supported.
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 Markdownconsole.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.
For binary formats such as PDF, DOCX, PPTX, and images, Tinfoil processes the attachment through the private document-processing backend and injects the extracted content into the model request as text.
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.