Run an arbitrary timeseries query against your events
insights_queryExecute ad-hoc analytics queries on event data to answer specific business questions like signup counts or error rates over time. Returns time-series data with optional filtering and breakdowns.
Instructions
Execute a one-shot InsightsQuery without saving it as a widget. Use this to answer questions like 'how many signups yesterday?' / 'errors-per-hour by app version this week?' / 'which utm_source converted best in the last 30 days?'. Input envelope: { environment_id?: uuid, query: { kind, event, interval, range, filters?, breakdownProperty?, aggregation? } }. query.kind is always 'timeseries' (the v1 surface). query.event is an event name from event_catalog_canonical. query.interval is one of 'minute'|'hour'|'day'|'week'. query.range is either {kind: 'relative', last: '1h'|'24h'|'7d'|'30d'|'90d'} or {kind: 'absolute', fromIso: iso, toIso: iso} (note: the absolute keys are fromIso/toIso, both full ISO-8601 datetimes). query.filters is an array of {field, op, value}; field names are dot-paths under event_properties / event_context (e.g. 'event_properties.course_slug'). query.breakdownProperty is a single property path that splits the series (caps at 20 distinct values). query.aggregation is {kind: 'count'} (default) or {kind: 'count_distinct', field: 'user_id'}. Returns gap-filled buckets; a missing time bucket is rendered as 0.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| environment_id | No | ||
| query | Yes |