Execute read-only SQL scoped to a bucket
POST /api/v1/{bucket}/query
Execute a read-only SQL query against the tenant’s warehouse database. Authentication proves the caller has access to the specified bucket. The query runs in the tenant’s database — no bucket filtering needed.
Returns DuckDB error details on SQL failures so callers can self-correct their queries.
Authorizations
Section titled “Authorizations ”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters ”Flock bucket ID. The caller must have access to this bucket.
Example
exampleRequest Body required
Section titled “Request Body required ”object
Read-only SQL statement.
Example
SELECT count(*) FROM personExample
{ "sql": "SELECT count(*) FROM person"}Responses
Section titled “ Responses ”Query results
object
object
Column names from the result set.
Example
[ "uid", "first_name", "last_name"]Result rows. Each row is an array of values matching the columns.
Example
[ [ "abc123", "Jane", "Smith" ]]Invalid SQL or query execution error
object
object
Machine-readable error code.
Example
unauthorizedHuman-readable error message.
Example
Authentication requiredExamples
SQL validation failure
{ "error": { "code": "bad_request", "message": "Only SELECT, PRAGMA, DESCRIBE, SHOW, and WITH statements are allowed (got DROP)" }}DuckDB execution error
{ "error": { "code": "query_error", "message": "SQL error: Table 'foo' does not exist" }}Authentication required
object
object
Machine-readable error code.
Example
unauthorizedHuman-readable error message.
Example
Authentication requiredExample
{ "error": { "code": "unauthorized", "message": "Authentication required" }}Access denied to bucket
object
object
Machine-readable error code.
Example
unauthorizedHuman-readable error message.
Example
Authentication requiredExample
{ "error": { "code": "forbidden", "message": "Access denied to bucket 'example'" }}