{
  "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": "Total Amount",
      "key": "total_amount",
      "data_type": "number",
      "description": "The total amount due on the invoice"
    },
    {
      "name": "Is Paid",
      "key": "is_paid",
      "data_type": "boolean",
      "description": "Whether the invoice has been paid"
    }
  ],
  "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"
        },
        {
          "name": "Quantity",
          "key": "quantity",
          "data_type": "number"
        },
        {
          "name": "Unit Price",
          "key": "unit_price",
          "data_type": "number"
        },
        {
          "name": "Amount",
          "key": "amount",
          "data_type": "number"
        }
      ]
    }
  ]
}

Data types define the expected format of data extracted from your documents. TableFlow supports multiple data types to ensure data is correctly formatted and validated during extraction.

Data types can be set on:

  • Template fields
  • Table columns

If no data type is specified, the field or column will default to the string type.

Available Data Types

String

The most flexible data type, accepting any text value.

Accepts: Any text value
Output: The extracted value as a string

{
  "name": "Customer Name",
  "key": "customer_name",
  "data_type": "string"
}

Number

For numeric values, such as amounts, quantities, and measurements.

Accepts: Integers and decimal numbers of any size
Output: The extracted value as a number, or null if blank
Validation: Non-numeric values are flagged for review

{
  "name": "Total Amount",
  "key": "total_amount",
  "data_type": "number"
}

Date

For date and datetime values, supporting various formats.

Accepts: Date strings in various formats (e.g., “2023-04-15”, “Apr 15, 2023”, “15/04/2023”)
Output: The extracted value as an RFC 3339 datetime (e.g., “2023-04-15T00:00:00Z”), or null if blank
Validation: Invalid date formats are flagged for review

{
  "name": "Invoice Date",
  "key": "invoice_date",
  "data_type": "date"
}

Boolean

For true/false values.

Accepts: “true”, “t”, “1”, “yes”, “y” for true; “false”, “f”, “0”, “no”, “n” for false (case-insensitive)
Output: The extracted value as a boolean (true/false), or null if blank
Validation: Non-boolean values are flagged for review

{
  "name": "Is Paid",
  "key": "is_paid",
  "data_type": "boolean"
}

Table

For defining a nested table structure within a template. This is particularly useful for complex documents that have multiple tables or nested data.

Output: A structured array of rows with column values

{
  "name": "Line Items",
  "key": "line_items",
  "data_type": "table"
}

How Data Types Affect Extraction

When you specify a data type:

  1. Format Guidance - The AI uses the data type to identify the correct format when extracting
  2. Validation - Extracted data is validated against the expected format
  3. Transformation - Data is converted to the proper format (e.g., parsing dates)
  4. Error Flagging - Values that don’t match the expected format are flagged for review

Data Type Examples

Here’s how to define different data types in a template:

{
  "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": "Total Amount",
      "key": "total_amount",
      "data_type": "number",
      "description": "The total amount due on the invoice"
    },
    {
      "name": "Is Paid",
      "key": "is_paid",
      "data_type": "boolean",
      "description": "Whether the invoice has been paid"
    }
  ],
  "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"
        },
        {
          "name": "Quantity",
          "key": "quantity",
          "data_type": "number"
        },
        {
          "name": "Unit Price",
          "key": "unit_price",
          "data_type": "number"
        },
        {
          "name": "Amount",
          "key": "amount",
          "data_type": "number"
        }
      ]
    }
  ]
}

Best Practices

For optimal results:

  1. Choose Appropriate Types - Select the most specific data type that matches your expected data
  2. Add Validations - Combine data types with validations for more precise data quality control
  3. Consider Format Variations - Be aware that dates and numbers can appear in different formats in documents
  4. Test with Sample Documents - Process representative documents to verify data type handling

Next Steps

Learn about validations to ensure the quality and integrity of your extracted data.