Run a saved insight
Execute a saved insight, optionally overriding its date range and interval for this run. Results are cached server-side — a window that ends before today is reused for hours, one touching today for two minutes — and rate-limited per location (120/min across the authed Builder paths).
Readable with an agency key (ak_, requires ?location_id=) or a viewer key (sk_).
curl -X POST "https://mythic-analytics.gulp.workers.dev/builder/insights/123e4567-e89b-12d3-a456-426614174000/query?location_id=acme-retail" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"dateRange": {
"preset": "24h",
"from": "2024-12-25",
"to": "2024-12-25"
},
"granularity": "hour"
}'
import requests
import json
url = "https://mythic-analytics.gulp.workers.dev/builder/insights/123e4567-e89b-12d3-a456-426614174000/query?location_id=acme-retail"
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_TOKEN"
}
data = {
"dateRange": {
"preset": "24h",
"from": "2024-12-25",
"to": "2024-12-25"
},
"granularity": "hour"
}
response = requests.post(url, headers=headers, json=data)
print(response.json())
const response = await fetch("https://mythic-analytics.gulp.workers.dev/builder/insights/123e4567-e89b-12d3-a456-426614174000/query?location_id=acme-retail", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_TOKEN"
},
body: JSON.stringify({
"dateRange": {
"preset": "24h",
"from": "2024-12-25",
"to": "2024-12-25"
},
"granularity": "hour"
})
});
const data = await response.json();
console.log(data);
package main
import (
"fmt"
"net/http"
"bytes"
"encoding/json"
)
func main() {
data := []byte(`{
"dateRange": {
"preset": "24h",
"from": "2024-12-25",
"to": "2024-12-25"
},
"granularity": "hour"
}`)
req, err := http.NewRequest("POST", "https://mythic-analytics.gulp.workers.dev/builder/insights/123e4567-e89b-12d3-a456-426614174000/query?location_id=acme-retail", bytes.NewBuffer(data))
if err != nil {
panic(err)
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "Bearer YOUR_API_TOKEN")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
fmt.Println("Response Status:", resp.Status)
}
require 'net/http'
require 'json'
uri = URI('https://mythic-analytics.gulp.workers.dev/builder/insights/123e4567-e89b-12d3-a456-426614174000/query?location_id=acme-retail')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri)
request['Content-Type'] = 'application/json'
request['Authorization'] = 'Bearer YOUR_API_TOKEN'
request.body = '{
"dateRange": {
"preset": "24h",
"from": "2024-12-25",
"to": "2024-12-25"
},
"granularity": "hour"
}'
response = http.request(request)
puts response.body
{
"success": true,
"insight": {
"id": "123e4567-e89b-12d3-a456-426614174000",
"name": "John Doe",
"insight_type": "number",
"config": {}
},
"engine": "tinybird",
"kind": "trend",
"buckets": [
"example_string"
],
"previous_buckets": [
"example_string"
],
"series": [
{
"label": "example_string",
"math": "example_string",
"event": "example_string",
"breakdown_value": "example_string",
"data": [
3.14
],
"total": 3.14,
"value": 3.14,
"previous": [
3.14
],
"previous_value": 3.14
}
],
"breakdown_values": [
"example_string"
],
"steps": [
{
"step": 42,
"label": "example_string",
"event": "example_string",
"users": 42,
"conversion_from_first": 3.14,
"conversion_from_previous": 3.14
}
],
"breakdown": [
{
"value": "example_string",
"steps": [
{
"step": 42,
"label": "example_string",
"event": "example_string",
"users": 42,
"conversion_from_first": 3.14,
"conversion_from_previous": 3.14
}
]
}
],
"meta": {},
"config": {},
"cached": true,
"sql": "example_string"
}
{
"error": "Not Found",
"message": "The requested resource was not found",
"code": 404
}
{
"error": "Too Many Requests",
"message": "Rate limit exceeded. Please try again later",
"code": 429,
"retryAfter": 3600
}
{
"error": "Internal Server Error",
"message": "An unexpected error occurred on the server",
"code": 500,
"requestId": "req_1234567890"
}
/insights/{id}/queryTarget server for requests. Edit to use your own host.
Builder key as a bearer token. Use an agency key (Bearer ak_...) or a viewer key (Bearer sk_...). Scoped keys (mcp_) with insights:read are accepted too.
Bearer ak_...) or a viewer key (Bearer sk_...). Scoped keys (mcp_) with insights:read are accepted too.Insight UUID (must belong to the resolved location).
Client location to scope the request to. Required when authenticating with an agency key (ak_). Ignored for viewer keys (sk_).
The media type of the request body
Date range override, applied onto config.query.date_range for this run only. An unknown preset leaves the stored range in place.
Bucket interval override, applied onto config.query.interval. Trends only — a funnel never gains an interval.
Request Preview
Response
Response will appear here after sending the request
Authentication
Bearer token. Builder key as a bearer token. Use an agency key (Bearer ak_...) or a viewer key (Bearer sk_...). Scoped keys (mcp_) with insights:read are accepted too.
Path Parameters
Insight UUID (must belong to the resolved location).
Query Parameters
Client location to scope the request to. Required when authenticating with an agency key (ak_). Ignored for viewer keys (sk_).
acme-retailBody
Date range override, applied onto config.query.date_range for this run only. An unknown preset leaves the stored range in place.
Bucket interval override, applied onto config.query.interval. Trends only — a funnel never gains an interval.
hourdayweekmonthResponses
The insight's definition (for rendering).
tinybirdtrendfunnelTrend with interval — ISO bucket labels (UTC).
Trend with interval and compare.
Trend only.
Trend with breakdown — values in rank order, $$other last.
Funnel only.
Funnel with breakdown — per-value step rows.
Resolved from/to, to_exclusive (where a window that includes today actually stopped), the previous window (truncated to the same time of day), interval, window_seconds, grain (funnels: what a step counted), breakdown settings, and query statistics (sql_ms, rows_read, bytes_read).
The stored config, echoed.
True when served from the server-side cache.
The compiled query. Returned on the key-authed POST /insights/{id}/query runner and /insights/preview, but NOT on the anonymous POST /public/query endpoint.