tools

query_tables

Answer a natural-language question over uploaded table files — one or several.

Cost class: slow.

paths is a list of selection rows — {"path": ...} for a whole file, {"path": ..., "component": <tab>} for one tab of one workbook (repeat the path to select several tabs). Every path must be a table file — a spreadsheet (xlsx, xls, xlsm, xlsb, ods) or record file (csv, tsv, parquet, jsonl, ndjson, json); a document, media, or image path is refused with invalid_request naming qa-file. Every tab is askable whatever its ingestion produced: selections whose tabs all have extracted rows are answered by the SQL engine — the answer keeps full result parquet storage outside the response and returns bounded previews plus authenticated workspace result-file citations — while a selection holding tabs with only a rendered sheet is answered by a QA agent that reads renderings and queries row extractions together (no result previews on that lane; citations quote the sheets).

component names are workbook-local — the same strings file-metadata and filtered-search publish as component, matched exact-name first, then the unambiguous sanitized alias. A name that matches nothing on its own workbook — or any component on a single-table upload (csv/jsonl/parquet), which has no named parts — is invalid_request. A selected tab with no usable content at all is reported in unavailable rather than silently dropped.

Execution survives HTTP disconnects. By default the route waits and returns the original answer shape. Send Prefer: respond-async to return a Job immediately, then poll its Location URL. Idempotency-Key recovers the same job after a lost response. Only explicit job cancellation stops it.

post/v1/workspaces/{workspace_id}/tools/query-tables

Request

Path parameters

workspace_idstring uuid required

Workspace identifier.

Headers

preferstring nullable
Idempotency-Keystring nullable

Replaying a request with the same key returns the original job with 200, never a second job. The key is kept with the job for replay and never cleared, so it must not contain personal data.

Request body

querystring required
include_citationsboolean
output_schemaobject nullable

A JSON Schema (Draft 2020-12, object root, local non-recursive $ref only, no pattern, patternProperties or unevaluated*) the answer must follow. When set, the agent writes answer as JSON text conforming to it, the run checks that and asks the agent to correct a mismatch, and the result carries the parsed value in structured_answer. A field the source does not state comes back null, whatever type the schema gives it. Explanation goes to reasoning where the result has one, and evidences are unchanged. If the answer still misses the schema, the run succeeds with answer as written and structured_answer null. Omit for a prose answer.

Response

Successful Response

OR

Changes

No recorded changes to this operation across all 1 revision of this API.