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
| Requests | Permission needed |
|---|---|
| List a project's tables, get a table, its versions, an import and its changes | workflow:read |
| Start an import, confirm its mapping, make it current, discard it | workflow: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:
| Field | What it holds |
|---|---|
table_id | The table's ID. |
name | The table's name, such as Items. |
type, type_name | The table type's ID, such as order_intake.items, and its name, such as Items. |
current_version | The number of the import that is current, or null before the first one. |
records | How many records the current version holds. |
last_import_at | When the current import was made current, in ISO 8601 UTC. |
created_at | When 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:
| Field | What it holds |
|---|---|
key | The name of the column that identifies a record, such as sku. |
columns | The table's columns, each with name, label, type, required, description and choices. A mapping names a column by its name. |
has_saved_mapping | true once an import has been made current: the next file with the same column names, in the same order, gets the same mapping. |
open_import | The 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.
| Status | Code | When |
|---|---|---|
| 409 | IMPORT_IN_PROGRESS | The table already has an import in progress. Get the table: open_import.number names it. Make it current or discard it first. |
| 409 | IDEMPOTENCY_IN_PROGRESS | A request with this Idempotency-Key is still being handled. Try again shortly. |
| 422 | IDEMPOTENCY_KEY_REUSED | The Idempotency-Key was used with another file name, contents or sheet. |
| 413 | FILE_TOO_LARGE | The file is larger than 100 MB. |
| 422 | FILE_EMPTY | The 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.
| Status | In the app | What comes next |
|---|---|---|
reading | Reading | Flow is reading the file. |
mapping | Waiting for mapping | Confirm the mapping. |
staging | Preparing | Flow is checking every row. |
staged | Ready to review | Read the changes, then make it current or discard it. |
current | Current | The version the table holds now. |
superseded | Replaced | A later import was made current. |
discarded | Discarded | Thrown away, by a person or after 24 hours. |
failed | Failed | error 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."
| Field | What it holds |
|---|---|
number, status, filename | The import's number, its status and the uploaded file's name. |
sheet, sheets | The sheet Flow read, and every sheet of a workbook. To read another sheet, discard the import and start one with sheet. |
header_row, rows | The row of the file that holds the column names, counted from 1, and how many rows sit under it. |
headers | The file's column names. |
sample_rows | The first 20 rows, each as {column name: value}. |
detected_formats | For 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_mapping | Flow'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. |
mapping | The mapping confirmed, as columns and formats. |
counts | Once 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. |
problems | The 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_confirmation | true when making it current removes more than a fifth of the table's records. |
error | Why a failed import failed. |
created_at, staged_at, activated_at | When 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.
| Status | Code | When |
|---|---|---|
| 409 | IMPORT_NOT_WAITING_FOR_MAPPING | The import isn't in status mapping. |
| 422 | MAPPING_INVALID | The 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
| Parameter | Meaning |
|---|---|
kind | Required: new, changed, removed or rejected. |
limit | 1 to 200. The default is 50. |
offset | How 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.
| Status | Code | When |
|---|---|---|
| 409 | IMPORT_NOT_READY | The import isn't in status staged. A second request after a success gets this too: GET the import to see it is current. |
| 409 | REMOVAL_NOT_CONFIRMED | The 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.
| Status | Code | When |
|---|---|---|
| 409 | IMPORT_BUSY | Flow is reading the file or checking the rows (reading or staging). Try again when the status moves on. |
| 409 | IMPORT_CLOSED | The 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
- Start an import with the night's file and an
Idempotency-Keythat names the night, so a retried upload starts one import. - Get the import every few seconds until its status is
mapping, orfailed. - Confirm the mapping. With the same column names as the last import,
proposed_mappingis the saved mapping and everysourceissaved: send each column'scolumnandproposed_mapping.formats, as Confirm the mapping shows. - Get the import until its status is
staged, orfailed: a file that lists a key twice fails here, and itsproblemsnames the rows. Whencounts.rejectedis above 0, read therejectedchanges and send them to whoever owns the export. - Make the import current. When
needs_confirmationistrue, the file removes more than a fifth of the table: checkcounts.removedbefore you sendconfirm_name, or discard the import.
- 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.