Execute a pre-built report
POST /api/v1/{bucket}/reports/{report_id}/run
Runs a pre-built report against the specified bucket. The bucket is injected automatically into the SQL template. Additional parameters (dates, field names, etc.) are passed in the request body and validated before execution.
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
exampleReport identifier.
Example
payment_summaryRequest Body
Section titled “Request Body ”Report parameters. See the report definition for required fields.
object
Examples
No parameters needed
{}Field frequency by country
{ "field": "country"}June birthdays
{ "month": 6}2024 payment summary
{ "year": 2024}Date range report
{ "start_date": "2024-01-01", "end_date": "2025-01-01"}Responses
Section titled “ Responses ”Report 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" ]]object
Invalid request
object
object
Machine-readable error code.
Example
unauthorizedHuman-readable error message.
Example
Authentication requiredExample
{ "error": { "code": "bad_request", "message": "Missing 'sql' field" }}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'" }}Resource not found
object
object
Machine-readable error code.
Example
unauthorizedHuman-readable error message.
Example
Authentication requiredExample
{ "error": { "code": "not_found", "message": "Unknown table: foo" }}