Skip to main content
Every processing request in Matil includes one or more documents. A document is the input you want to process — an invoice, a contract, an ID card, or any other file. Matil accepts documents in several formats, so you can integrate regardless of how your files are stored or received.

Supported file types

Matil can process a wide range of document formats:
CategoryFormats
PDF.pdf
Images.jpg, .jpeg, .png, .gif, .webp, .tiff, .bmp
Spreadsheets.xlsx, .xls, .ods, .csv
Text.txt, .html, .xml, .json
The maximum file size is 50 MB.

Input formats

URL

Point to a document hosted online. Matil downloads and processes it automatically. This is the most common way to send documents.
{
  "type": "url",
  "url": "https://example.com/invoice.pdf"
}

Base64 encoded

Send binary files directly in the request body. Useful when you have files in memory.
{
  "type": "base64",
  "content": "JVBERi0xLjQK...",
  "mime_type": "application/pdf"
}
Here’s how to encode a file in Python:
import base64

with open("document.pdf", "rb") as f:
    encoded = base64.b64encode(f.read()).decode("utf-8")

document = {
    "type": "base64",
    "content": encoded,
    "mime_type": "application/pdf"
}

Plain text

Send raw text content directly. Useful when you already have the text extracted.
{
  "type": "text",
  "text": "INVOICE\n\nInvoice Number: INV-2024-001\nDate: January 15, 2024\nTotal: $150.00"
}

Multiple documents

You can send multiple documents in a single request. Matil processes them together as a single unit — useful for multi-page documents that arrive as separate files.
{
  "documents": [
    {"type": "url", "url": "https://example.com/page1.pdf"},
    {"type": "url", "url": "https://example.com/page2.pdf"}
  ]
}

Adding metadata

You can attach custom metadata to any request. This metadata is stored with the result and returned in responses and webhooks — useful for correlating results with your system.
{
  "documents": [
    {"type": "url", "url": "https://example.com/invoice.pdf"}
  ],
  "metadata": {
    "order_id": "ORD-12345",
    "source": "email-inbox",
    "customer_id": "cust_abc"
  }
}
Use metadata to link Matil results back to records in your own database. This makes it easy to match processed entries with their source.

Next steps

Processing modes

Process many documents efficiently with batch mode.

Structures

Learn how to extract structured data from your documents.