Product Benefits Pricing Guides Docs About Contact us Try it out
Analytics tools

Mixpanel Custom Insights Query API Tracking

Mixpanel Custom Insights Query API (beta): run ad hoc analytics queries from code without saved reports, and track which queries your team relies on.

· 3 min read

On 28 October 2026 Mixpanel added a beta Custom Insights Query API. You describe an Insights query in the request body and get results back, without first building and saving a report in the Mixpanel UI. For product teams, that turns analytics into something scripts, dashboards and AI agents can call directly.

The risk is predictable. Once anyone can run queries from code, numbers appear in places with no owner, no definition and no record of how they were produced. Two teams then quote different “weekly active users” with both sides sure they are right.

What the Beta Supports

According to Mixpanel’s changelog, a query can combine event, funnel, retention, cohort or formula metrics with a time range and optional time unit. You can compare against an earlier period or show change from a baseline, and receive JSON or CSV. It allows up to 10 filters and up to three breakdowns, by property value or cohort membership. It authenticates with a service account and the endpoint is versioned with the Mixpanel-Version header. It is a beta, so expect the shape to change.

Data Points to Track

Log every programmatic query in your own system so results stay explainable:

  • query_id: your own stable ID for the query definition
  • metric_type: event, funnel, retention, cohort or formula
  • time_range and time_unit
  • filter_count and breakdown_count (watch the 10 and 3 limits)
  • comparison_mode: none, previous period or baseline change
  • output_format: JSON or CSV
  • caller: the service, dashboard or agent that made the request
  • api_version: the Mixpanel-Version value sent
  • latency_ms and status_code
  • owner: the person responsible for the query’s definition

Setup Steps

  1. Create a dedicated service account for query access with the narrowest project permissions available. Never reuse the account that sends events.
  2. Store the credentials in your secrets manager, not in app code or a client bundle.
  3. Write each query as a versioned definition in your repository, with a plain-English description of the metric.
  4. Pin the Mixpanel-Version header in your client so a server-side change does not shift your numbers silently.
  5. Wrap calls in a small function that records the fields above to your logging system.
  6. Add a daily check that re-runs a handful of reference queries and alerts if results move beyond a tolerance you set.
  7. Cache results for dashboards. Hammering the API for every page view wastes quota and slows pages.
  8. Review the list of queries monthly and retire any with no caller.

Actionable Insights

Start with the callers. If one automated job accounts for most requests, check whether it needs live data or a nightly refresh.

Look at breakdown and filter counts. Queries bumping against the limits usually mean a metric that should be modelled as a cohort or a dedicated property instead.

Compare API results with the equivalent saved report once a week. A mismatch means either a definition drift or a time zone mistake, and both are far cheaper to catch early.

Finally, treat beta status seriously. Keep business-critical numbers on saved reports until the endpoint is stable, and use the API for exploration, internal tools and prototypes.