{
  "name": "Invoice Template",
  "description": "Template for processing invoices",
  "fields": [
    {
      "name": "Invoice Number",
      "key": "invoice_number",
      "data_type": "string",
      "description": "The unique identifier for the invoice"
    },
    {
      "name": "Invoice Date",
      "key": "invoice_date",
      "data_type": "date",
      "description": "The date the invoice was issued"
    },
    {
      "name": "Due Date",
      "key": "due_date",
      "data_type": "date",
      "description": "The date the invoice payment is due"
    },
    {
      "name": "Total Amount",
      "key": "total_amount",
      "data_type": "number",
      "description": "The total amount due on the invoice"
    }
  ],
  "tables": [
    {
      "name": "Line Items",
      "key": "line_items",
      "description": "The list of products or services on the invoice",
      "columns": [
        {
          "name": "Description",
          "key": "description",
          "data_type": "string",
          "description": "The description of the item"
        },
        {
          "name": "Quantity",
          "key": "quantity",
          "data_type": "number",
          "description": "The quantity of the item"
        },
        {
          "name": "Unit Price",
          "key": "unit_price",
          "data_type": "number",
          "description": "The price per unit of the item"
        },
        {
          "name": "Amount",
          "key": "amount",
          "data_type": "number",
          "description": "The total amount for the line item"
        }
      ]
    }
  ]
}

What are Templates?

Templates define what data should be extracted from your documents and how that data should be structured. They act as blueprints that guide the extraction process, ensuring consistent results across multiple documents of the same type. By defining templates once, you can process thousands of similar documents with predictable outcomes.

Parts of a Template

  • Template Description - Contextual information that helps AI models understand the document type and extraction purpose
  • Fields - Individual data points to extract (e.g., invoice number, date, total amount)
  • Tables - Structured collections of related data rows and columns (e.g., line items, transactions)
  • Table Columns - The column definitions that determine what data to extract from each table row

Additional properties that enhance both fields and table columns:

  • Data Types - Define the format of extracted data (string, number, date, boolean, etc.)
  • Validations - Rules that ensure extracted data meets your quality requirements

Creating a Template

To create a new template:

  1. Navigate to the Templates page.
  2. Click New Template.
  3. Provide a name and description.
  4. Add Fields, Tables, and Table Columns.

AI Template Mapping

TableFlow uses AI models to intelligently map data from your documents to the fields and tables in your template. For complex documents like invoices and receipts, this eliminates the need for manual field mapping.

  • Analyzes document structure and content
  • Identifies relevant data based on context and positioning
  • Maps data to appropriate fields and tables
  • Validates data against specified rules

Template Best Practices

For optimal results with Templates:

  1. Be Specific - Use clear, descriptive names for fields and tables
  2. Use Validations - Implement appropriate validations to ensure data quality
  3. Test Thoroughly - Process a variety of document samples to refine your template
  4. Iterate - Adjust your template based on extraction results

Next Steps

Once you’ve defined a template, you’re ready to start creating Extractions for file processing.

{
  "name": "Invoice Template",
  "description": "Template for processing invoices",
  "fields": [
    {
      "name": "Invoice Number",
      "key": "invoice_number",
      "data_type": "string",
      "description": "The unique identifier for the invoice"
    },
    {
      "name": "Invoice Date",
      "key": "invoice_date",
      "data_type": "date",
      "description": "The date the invoice was issued"
    },
    {
      "name": "Due Date",
      "key": "due_date",
      "data_type": "date",
      "description": "The date the invoice payment is due"
    },
    {
      "name": "Total Amount",
      "key": "total_amount",
      "data_type": "number",
      "description": "The total amount due on the invoice"
    }
  ],
  "tables": [
    {
      "name": "Line Items",
      "key": "line_items",
      "description": "The list of products or services on the invoice",
      "columns": [
        {
          "name": "Description",
          "key": "description",
          "data_type": "string",
          "description": "The description of the item"
        },
        {
          "name": "Quantity",
          "key": "quantity",
          "data_type": "number",
          "description": "The quantity of the item"
        },
        {
          "name": "Unit Price",
          "key": "unit_price",
          "data_type": "number",
          "description": "The price per unit of the item"
        },
        {
          "name": "Amount",
          "key": "amount",
          "data_type": "number",
          "description": "The total amount for the line item"
        }
      ]
    }
  ]
}