QueriesRun an embedded insight (public)

Run an embedded insight (public)

Execute a saved insight for an embedded dashboard or insight without a Builder key. Authenticate with a share token in a header:

  • X-Embed-Token — an insight's embed_token (insight must be is_embeddable = true). Runs that insight; insight_id is ignored.

  • X-Dashboard-Token — a dashboard's public_token (dashboard must be is_public = true). Requires insight_id, which must be an insight on that dashboard.

A share token can only ever run its own insight against its own location. Same cache as the authed runner; public traffic is rate-limited on a separate, higher per-location allowance (600/min) so a busy public dashboard can't exhaust a tenant's own Builder calls. The compiled sql is never returned on this endpoint.

curl -X POST "https://mythic-analytics.gulp.workers.dev/builder/public/query" \
  -H "Content-Type: application/json" \
  -H "X-Dashboard-Token: example_string" \
  -H "X-Embed-Token: example_string"
{
  "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"
}
POST
/public/query
POST
Base URLstring

Target server for requests. Edit to use your own host.

Content-Typestring
Required

The media type of the request body

Options: application/json
header
X-Dashboard-Tokenstring

A dashboard's public_token. Required unless X-Embed-Token is supplied.

header
X-Embed-Tokenstring

An insight's embed_token. Required unless X-Dashboard-Token is supplied.

No request body parameters defined
Request Preview
Response

Response will appear here after sending the request

Headers

X-Dashboard-Tokenstring

A dashboard's public_token. Required unless X-Embed-Token is supplied.

X-Embed-Tokenstring

An insight's embed_token. Required unless X-Dashboard-Token is supplied.

Body

application/json
datastring
Required

Raw application/json data

Responses

successboolean
insightobject

The insight's definition (for rendering).

enginestring
Allowed values:tinybird
kindstring
Allowed values:trendfunnel
bucketsstring[]

Trend with interval — ISO bucket labels (UTC).

previous_bucketsstring[]

Trend with interval and compare.

seriesarray

Trend only.

breakdown_valuesstring[]

Trend with breakdown — values in rank order, $$other last.

stepsarray

Funnel only.

breakdownarray

Funnel with breakdown — per-value step rows.

metaobject

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).

configobject

The stored config, echoed.

cachedboolean

True when served from the server-side cache.

sqlstring

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.