Pular para o conteúdo principal

Tables API

Create document tables, define extraction columns, connect collections, and query or export results.

📄️Create table from CSV

Create a table with managed record storage from a CSV and import every row in the same request. Call previewTableFromCsv first to see the proposed columns, types and key, then pass only what you want to change in columns (by the label from the preview: a new name, a type, or skip) and keyColumn when the proposed key is wrong or missing. Types are text unless every value is a number without a leading zero, a YYYY-MM-DD date or true/false, so codes like an NCM 01012100 keep their leading zero; the key column is text unless you change it. Each row’s externalKey is its key column value and must be unique in the file. Values follow the same rules as importTableRows, nothing is classified, and the import is upsert. If any write fails no table is created. Up to 20,000 rows and 8 MB of CSV. Omit applicationId for a personal table; an application table needs membership of the application, the same as createTable.

📄️Propose table columns for CSV

Read a CSV and propose one column per CSV column with a name, a type and up to three sample values, plus a key column and the first five rows. Nothing is written. Use it before createTableFromCsv, or to check the headers before importTableRows. Repeated headers get labels like 'valor (2)' and blank ones 'Column N'; refer to columns by those labels. Types are text unless every value is a number without a leading zero, a YYYY-MM-DD date or true/false; the proposed key is the first column whose values are all present and unique, typed as text.

📄️Keep table updated from collection

Creates or updates one persistent subscription per table/collection. Imports existing ready documents by default and automatically extracts new or changed documents. Source retries reuse the existing row. Set enabled=false to prepare or pause a connection and receive watch.discoveryPreview with a bounded count of ready versions awaiting discovery. Reconnecting retries scheduling failures. Uses the caller’s current access and usage limits. Generated Insights CSVs are excluded. Enabled connections start billable extraction in the background. Employee authoring tools default to paused; direct API callers retain the enabled default.

📄️Delete document table

Removes the table from lists and reads and stops its automatic work: the extraction in progress is cancelled, and collection connections, deliveries, classifications and conversation Insights no longer run for it. Rows, extracted values, source documents and history are kept. Deleting a table that is already deleted answers 404. The conversation-insights table of an agent that still exists cannot be deleted: that answers 409 with code `tables/linked-to-agent` and the agent in `details`.

📄️Import CSV rows into table

Import a CSV into an existing table with managed record storage. First read listTableColumns, then map CSV headers to column IDs and pick the header whose value becomes each row’s externalKey. Values are checked against the column types like saveTableRecord: text is kept exactly (leading zeros too), decimals stay exact strings (a decimal comma is accepted in ;-separated files), dates are YYYY-MM-DD, timestamps ISO with a timezone, and empty cells stay absent. upsert inserts new keys and updates changed ones; re-running the same file changes nothing. replace also removes earlier imported rows whose key is missing from the file, in the same transaction. Rows with an empty key or a bad value are skipped and listed in errors; a key that repeats in the file rejects the whole import. Imported rows are not classified unless classify is true, which queues new and changed rows for the table’s automatic classification columns (one model call per row and column). Up to 20,000 rows and 8 MB of CSV run synchronously; larger files answer 413 until background imports ship. Requests over 10 MB in total are refused before they reach the API, so keep the CSV under 8 MB. Requires the same table access as saving a record.

📄️Read, filter, and sort table records as JSON

Read authorized live rows with columns, source references, values and cellStatus keyed by column ID. Non-completed values are null. Start with no page or cursor, then follow pagination.type: page uses nextPage; cursor uses nextCursor and omits total unless count=exact. Cursor tables support source-name q, sourceType/externalKey, typed AND filters, id/createdAt/updatedAt/source or columnId:value sorts. Numbered tables support q over names and cell values, and source/columnId:value/columnId:score sorts. Unsupported options return 400. Both use 1–100 rows; sort ties are stable. Preserve the selection between cursor requests; 409 means restart. Table, owner and source permissions apply on every read. No CSV or warehouse load is required. These live pages are not frozen export snapshots. Source-name substring search, typed column filters and sorts, and exact counts may scan the full authorized table. Prefer indexed id, createdAt, updatedAt or source ordering for large tables.

📄️Save record directly to table

Save supplied JSON values without document extraction. First read listTableColumns and key values by column ID. Supply a stable idempotencyKey for each business record and reuse it on retries: the same payload returns the original row; different values or a deleted row return 409. Missing columns are blank. Rows are immediately available through listTableRows; CSV and BigQuery publication is asynchronous. The API records the authenticated caller and external reference; native Docana agents attach their execution identity automatically. Requires the same table access as the UI.

📄️Run or stop table extraction

Run with scope 'all' (the default) starts a new extraction of every cell, including completed ones. Run with scope 'missing' keeps the current run and queues only cells that are empty, failed or still queued; use it to fill gaps or recover stuck cells without paying for completed ones. Stop cancels queued work and keeps the last completed value of cells that were only re-queued. Poll table rows for results. Run is billable; inspect state before retrying after a timeout.