Grist Octri Preview
GET/docs/{docId}/sql

Run a read-only SQL query

Runs a read-only SQL SELECT query against a document's SQLite database. Use the q query parameter for a basic query; use the POST SQL endpoint when you need query parameters or custom timeouts.

2 parameters
docIdstringrequired
The UUID of the document whose SQLite database to query.
qstringoptional
The SQL query to run. This endpoint supports read-only SELECT queries without query parameters or options.

1 status code
200Returns the SQL statement and an array of result records, each containing a `fields` object.
recordsarray<object>required
statementstringrequired
A copy of the SQL statement.

Error handling

The docId path parameter must identify the document, and q must contain a read-only SQL SELECT query when supplied. Use the POST SQL endpoint for queries that need parameters or custom timeouts.