Submit an async natural language query
POST /api/v1/{bucket}/ask
POST
/api/v1/{bucket}/ask
Submits a natural language question to be answered by querying the tenant’s warehouse database. Creates a DynamoDB job, invokes the ask_worker Lambda asynchronously, and returns 202 with a job_id.
The worker generates SQL via MotherDuck’s prompt_sql(), validates
it, executes it, and stores the result. Poll via
GET /api/v1/{bucket}/ask/jobs/{jobId}.
Authorizations
Section titled “Authorizations ”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters ” bucket
required
string
Flock bucket ID. The caller must have access to this bucket.
Example
exampleRequest Body required
Section titled “Request Body required ”object
question
required
Natural language question about the tenant’s data.
string
Example
How many active members do we have?Examples
Simple question
{ "question": "How many active members do we have?"}Payment question
{ "question": "Total payments by currency for 2024"}Responses
Section titled “ Responses ”Job submitted successfully
object
data
required
object
job_id
required
string format: uuid
Example
a6220339-7ed3-42cf-b93a-67f78043567a status
required
string
Example
processingInvalid request
object
error
required
object
code
required
Machine-readable error code.
string
Example
unauthorized message
required
Human-readable error message.
string
Example
Authentication requiredExample
{ "error": { "code": "bad_request", "message": "Missing 'sql' field" }}Authentication required
object
error
required
object
code
required
Machine-readable error code.
string
Example
unauthorized message
required
Human-readable error message.
string
Example
Authentication requiredExample
{ "error": { "code": "unauthorized", "message": "Authentication required" }}Access denied to bucket
object
error
required
object
code
required
Machine-readable error code.
string
Example
unauthorized message
required
Human-readable error message.
string
Example
Authentication requiredExample
{ "error": { "code": "forbidden", "message": "Access denied to bucket 'example'" }}