Skip to main content
Workflow tables are shared CSV-backed resources that workflows can query, validate, download, and mount into Function blocks. They are useful for stable reference data such as carrier codes, port mappings, product catalogs, tax rules, country lists, customer aliases, and reconciliation thresholds. Tables are scoped to the current environment. Any workflow in that environment can use the table by ID.

What tables are for

Use workflow tables when your workflow needs external reference data that should be maintained separately from the workflow graph:
  • map extracted names to internal IDs
  • fuzzy-match vendors, ports, products, or locations
  • validate extracted values against an approved list
  • enrich extraction results with metadata from a catalog
  • keep business rules editable without changing Function block code
Tables are designed for lookup and reference data. They are not a row-by-row transactional database. To change table contents, upload a replacement CSV.

Data model

A table stores: Each column has:

CSV upload rules

Create and replace operations accept a multipart/form-data upload with a file field containing CSV bytes. Current upload guardrails: Trailing empty spreadsheet columns are ignored, but unnamed columns with data are rejected because there is no stable column name to expose downstream.

Schema inference

When you upload a CSV without schema overrides, Retab infers each column’s JSON schema from its non-empty values. Inference recognizes: If a column contains blanks, the inferred type becomes nullable, for example:
Long integer-looking values and values with leading zeroes are treated as identifier-like strings instead of numbers. This prevents IDs such as 0012345 or 18-digit account numbers from losing precision or formatting.

Schema overrides

You can override inferred column types during create or replace by sending a column_schema_overrides multipart form field. The value is a JSON array of objects with name and json_schema.
Override rules:
  • supported base types are string, integer, number, boolean, object, and array
  • nullable schemas must be a single base type plus null
  • supported string formats are date, date-time, and time
  • override names must match CSV headers after trimming
  • duplicate overrides are rejected
Rows are coerced to the selected schema. If a value cannot be coerced, the upload fails with a validation error for that column.

Create a table

Use POST /v1/tables to create a table from a CSV:
See Create Table for the full API reference.

Replace table contents

Tables use a CSV-as-database write model. There are no row, column, or cell mutation endpoints. To change data, replace the full CSV:
Replacing a table updates the original CSV, regenerates the internal snapshot, updates the schema and sample rows, and preserves the table ID. See Replace Table CSV for the full API reference.

Update metadata

Use PATCH /v1/tables/{table_id} to rename a table or update metadata. This does not change rows, columns, cells, or the backing CSV.
See Update Table for the full API reference.

Query rows

Use POST /v1/tables/{table_id}/query to read rows. Queries are read-only.
The maximum query limit is 500. Supported filter operators: Query requests also support: See Query Table for the full API reference.

Inspect and validate

Use these endpoints to inspect table shape: Example validation request:
The response contains diagnostics and has_errors.

Mount tables in Function blocks

Function blocks can mount workflow tables as CSV files in the sandbox. Use this when code needs to join, search, or fuzzy-match against table data.
Mount paths must be absolute and should live under /tmp or /data. The format field defaults to csv; csv is the supported table mount format for Function blocks.
Legacy table_refs configs with mount_path are still normalized, but new workflow configs should use mounts.tables with path.

Function lookup example

Once mounted, the table is just a CSV file. You can use duckdb, pandas, the standard csv module, or string matching libraries such as rapidfuzz.

Best practices

  • Keep tables focused on stable reference data.
  • Use clear, unique header names.
  • Prefer string schemas for IDs, postal codes, account numbers, and other identifier-like values.
  • Validate required columns before relying on a table in production workflows.
  • Replace the whole CSV when changing contents, and keep source CSVs in version control when business-critical.
  • Keep mounted paths predictable, for example /tmp/data/carriers.csv.
  • Use profile to check null counts and distinct counts after upload.