Skip to main content

Reference tables over the API

Import a file into an Unstract Flow reference table from your own systems, such as a nightly job that sends the item list your ERP exports. An import over the API goes through the steps of the table's Import tab: Flow reads the file, you confirm the column mapping, Flow compares the file with the table, and you make the import current or discard it. Every request acts as the person who created the API key, and every path below starts with /api/v1/external/accounts/<organization-id>. Rate limits and errors gives the limits (30 writes and 120 reads a minute for each key) and the error body, whose details carries the fields named below.

Permissions​

RequestsPermission needed
List a project's tables, get a table, its versions, an import and its changesworkflow:read
Start an import, confirm its mapping, make it current, discard itworkflow:write

The key's creator also needs access to the table's project: a view of it to read, edit access to import. That is a project they own, one shared with them, or any project of the organization when they are an organization admin; Projects explains who has which. A project the creator can't see, or can see but not edit when importing, gets 403 PROJECT_ACCESS_DENIED. A project of another organization, or an ID that names nothing, gets 404 PROJECT_NOT_FOUND.

Tables are created, renamed and deleted in the app. A table's page in the app has the address /projects/<project-id>/tables/<table-id>, which holds both IDs; write them in the path in lower case with hyphens, as the address shows them. Any other spelling gets 404.

List a project's tables​

GET /api/v1/external/accounts/<organization-id>/projects/<project-id>/reference-tables
curl "$FLOW_URL/api/v1/external/accounts/$FLOW_ORG/projects/$PROJECT_ID/reference-tables" \
-H "X-API-Key: $FLOW_API_KEY"

The response is tables, sorted by name. Each table has these fields:

FieldWhat it holds
table_idThe table's ID.
nameThe table's name, such as Items.
type, type_nameThe table type's ID, such as order_intake.items, and its name, such as Items.
current_versionThe number of the import that is current, or null before the first one.
recordsHow many records the current version holds.
last_import_atWhen the current import was made current, in ISO 8601 UTC.
created_atWhen the table was created.

Get a table​

GET /api/v1/external/accounts/<organization-id>/projects/<project-id>/reference-tables/<table-id>

The table's fields above, and these:

FieldWhat it holds
keyThe name of the column that identifies a record, such as sku.
columnsThe table's columns, each with name, label, type, required, description and choices. A mapping names a column by its name.
has_saved_mappingtrue once an import has been made current: the next file with the same column names, in the same order, gets the same mapping.
open_importThe import in progress, with the fields of an import's versions, or null.

A table of another project gets 404 TABLE_NOT_FOUND.

Start an import​

POST /api/v1/external/accounts/<organization-id>/projects/<project-id>/reference-tables/<table-id>/imports

Send the file as multipart/form-data in the field file. A workbook's sheet field, up to 255 characters, names the sheet to read; without it, Flow reads the first sheet that holds anything. Import a file lists the formats Flow reads and the limits a file must keep to.

curl -X POST "$FLOW_URL/api/v1/external/accounts/$FLOW_ORG/projects/$PROJECT_ID/reference-tables/$TABLE_ID/imports" \
-H "X-API-Key: $FLOW_API_KEY" \
-H "Idempotency-Key: items-2026-11-06" \
-F "file=@items.csv"

The response is 201 with the new import, in status reading. Flow reads the file after it answers.

An Idempotency-Key holds up to 255 characters and belongs to the API key that sent it. Within 24 hours, the same key with the same file name, contents and sheet returns the import the first request started, as it was then, with the header Idempotent-Replayed: true; GET the import for its status now. A request that was refused with 409, 413 or 422 leaves the key free, so a retry with it starts an import.

StatusCodeWhen
409IMPORT_IN_PROGRESSThe table already has an import in progress. Get the table: open_import.number names it. Make it current or discard it first.
409IDEMPOTENCY_IN_PROGRESSA request with this Idempotency-Key is still being handled. Try again shortly.
422IDEMPOTENCY_KEY_REUSEDThe Idempotency-Key was used with another file name, contents or sheet.
413FILE_TOO_LARGEThe file is larger than 100 MB.
422FILE_EMPTYThe file is empty.

A file Flow can't read, with no rows under its column names, or past a limit on its rows, columns or cells is accepted. The import then fails, and its error says why.

Get an import​

GET /api/v1/external/accounts/<organization-id>/projects/<project-id>/reference-tables/<table-id>/imports/<number>

Get it every few seconds while Flow works on it. Each import has a number, counting up from 1 in each table.

StatusIn the appWhat comes next
readingReadingFlow is reading the file.
mappingWaiting for mappingConfirm the mapping.
stagingPreparingFlow is checking every row.
stagedReady to reviewRead the changes, then make it current or discard it.
currentCurrentThe version the table holds now.
supersededReplacedA later import was made current.
discardedDiscardedThrown away, by a person or after 24 hours.
failedFailederror says why.

An import left in mapping or staged for 24 hours after its last change is discarded. One left in reading or staging for an hour fails with "The import stopped before it finished. Upload the file again."

FieldWhat it holds
number, status, filenameThe import's number, its status and the uploaded file's name.
sheet, sheetsThe sheet Flow read, and every sheet of a workbook. To read another sheet, discard the import and start one with sheet.
header_row, rowsThe row of the file that holds the column names, counted from 1, and how many rows sit under it.
headersThe file's column names.
sample_rowsThe first 20 rows, each as {column name: value}.
detected_formatsFor each column whose values are dates written with digits, such as 12/03/2026, or numbers with a . or , separator: dates (day_first, month_first, ambiguous or mixed) and decimals (dot, comma, ambiguous or mixed).
proposed_mappingFlow's mapping once the file is read: columns, which gives each column of the file a column and a source, and formats, from the saved mapping.
mappingThe mapping confirmed, as columns and formats.
countsOnce the import is staged: rows, totals_rows, current (records before it), new, changed, unchanged, removed, rejected, kept, records (records after it) and problems. A failed import that lists a key twice has duplicates.
problemsThe rejected rows' problems, the first 500, each with row, column and message. A row can have several. On a failed import, the rows that list a key twice.
needs_confirmationtrue when making it current removes more than a fifth of the table's records.
errorWhy a failed import failed.
created_at, staged_at, activated_atWhen it was started, checked and made current.

A mapping's source is the label the Import tab shows: saved is Same as last import, known is Recognised, ai is Suggested, and none means Flow couldn't place the column, which then goes to extra.

Confirm the mapping​

PUT /api/v1/external/accounts/<organization-id>/projects/<project-id>/reference-tables/<table-id>/imports/<number>/mapping

columns gives each column of the file a column name of the table, extra (stored with the record, not matched on) or ignore. formats chooses how a column writes its dates or numbers, where detected_formats gives ambiguous or mixed for a column you map to a date or number column: {"dates": "day_first"} or "month_first", {"decimals": "dot"} or "comma". formats also takes ambiguous and mixed, as detected_formats and a saved mapping give them: as a date column's dates or a number column's decimals they get MAPPING_INVALID, and anywhere else they change nothing.

curl -X PUT "$FLOW_URL/api/v1/external/accounts/$FLOW_ORG/projects/$PROJECT_ID/reference-tables/$TABLE_ID/imports/1/mapping" \
-H "X-API-Key: $FLOW_API_KEY" \
-H "Content-Type: application/json" \
-d '{"columns": {"Item Code": "sku", "Item Name": "name", "Sales Price": "price", "Shelf": "extra"},
"formats": {"Sales Price": {"decimals": "dot"}}}'

To accept Flow's mapping, send each column of proposed_mapping.columns with its column, and proposed_mapping.formats as formats. The response is the import, in status staging; Flow checks the rows after it answers. A field the body doesn't take, or a format value other than these six, gets the 422 VALIDATION_ERROR of Rate limits and errors.

StatusCodeWhen
409IMPORT_NOT_WAITING_FOR_MAPPINGThe import isn't in status mapping.
422MAPPING_INVALIDThe mapping can't be used. details.problems lists each reason, such as "Name must come from a column of the file.", "'Shelf' needs a choice." or "Choose how 'Sales Price' writes its numbers."

Read the changes​

GET /api/v1/external/accounts/<organization-id>/projects/<project-id>/reference-tables/<table-id>/imports/<number>/changes?kind=new
ParameterMeaning
kindRequired: new, changed, removed or rejected.
limit1 to 200. The default is 50.
offsetHow many to skip, for paging.

The response is kind, items, total, limit and offset, records sorted by key, ignoring capitals and spaces around it. Each new or removed item is key, data (its columns) and extras (the columns kept as extra). A changed item is key, before and after, each with data and extras. A rejected item is row, column and message. For rejected, total counts every problem but only the first 500 are listed. What an import changes says which rows land in each list.

Make an import current​

POST /api/v1/external/accounts/<organization-id>/projects/<project-id>/reference-tables/<table-id>/imports/<number>/activate

The table then holds the import's records. A run that has already read the table goes on reading the version it first read; a run that reads it for the first time after this reads the new one. Flow saves the mapping for the next import. The body is optional; when needs_confirmation is true, send the table's name in confirm_name, in any capitals:

curl -X POST "$FLOW_URL/api/v1/external/accounts/$FLOW_ORG/projects/$PROJECT_ID/reference-tables/$TABLE_ID/imports/2/activate" \
-H "X-API-Key: $FLOW_API_KEY" \
-H "Content-Type: application/json" \
-d '{"confirm_name": "Items"}'

The response is the import, in status current. The import it replaces becomes superseded, and Flow deletes that import's file.

StatusCodeWhen
409IMPORT_NOT_READYThe import isn't in status staged. A second request after a success gets this too: GET the import to see it is current.
409REMOVAL_NOT_CONFIRMEDThe import removes more than a fifth of the records and confirm_name isn't the table's name. details.removed and details.current give the counts.

Discard an import​

POST /api/v1/external/accounts/<organization-id>/projects/<project-id>/reference-tables/<table-id>/imports/<number>/discard

The table stays as it was, and Flow deletes the uploaded file. The response is the import, in status discarded.

StatusCodeWhen
409IMPORT_BUSYFlow is reading the file or checking the rows (reading or staging). Try again when the status moves on.
409IMPORT_CLOSEDThe import is no longer in progress.

List a table's versions​

GET /api/v1/external/accounts/<organization-id>/projects/<project-id>/reference-tables/<table-id>/versions

The response is versions, every import of the table, newest first, as the History tab lists them. Each one has number, status, filename, sheet, counts, error, created_at, staged_at and activated_at.

An import number the table doesn't have gets 404 IMPORT_NOT_FOUND on every import endpoint.

Run a nightly import​

  1. Start an import with the night's file and an Idempotency-Key that names the night, so a retried upload starts one import.
  2. Get the import every few seconds until its status is mapping, or failed.
  3. Confirm the mapping. With the same column names as the last import, proposed_mapping is the saved mapping and every source is saved: send each column's column and proposed_mapping.formats, as Confirm the mapping shows.
  4. Get the import until its status is staged, or failed: a file that lists a key twice fails here, and its problems names the rows. When counts.rejected is above 0, read the rejected changes and send them to whoever owns the export.
  5. Make the import current. When needs_confirmation is true, the file removes more than a fifth of the table: check counts.removed before you send confirm_name, or discard the import.
Limitations
  • An import always stops in mapping, even when Flow fills it from the saved mapping.
  • The API doesn't create, rename or delete tables, change Matching, reset the saved mapping, or read a table's records or what it has learned. Do those in the app.