Skip to main content

Setup

Put them in your environment or .env; Data APIs covers the other ways.

Notes

  • Every call needs project_id (the number in the project’s settings and URL); a project with data views also needs the global view’s workspace_id.
  • Rate limits are tight: the Query API allows 60 queries per hour and 5 concurrent per project; raw export allows 60 per hour, 3 per second and 100 concurrent. 429 when exceeded.
  • Dates are yyyy-mm-dd and inclusive at both ends. Query results use the project’s timezone; raw export reads dates as UTC for projects created from 2023.
  • Several inputs are JSON encoded into one string: event lists (’[“signup”,“purchase”]’), distinct_ids, values and filter_by_cohort. Filters (where, born_where, on) use Mixpanel’s segmentation expression syntax, e.g. properties[“$os”]==“Linux”.
  • The region and export_server settings must name the same residency as the project; a project only answers on its own servers.

Endpoints

Get a saved Insights report

  • series maps each metric to {date: value}; headers says what the nested keys mean.

Query retention

Count events over time

List today’s top events

Break an event down by a property

Query user or group profiles

  • A POST that only reads profiles; the body is form encoded.
  • Pages hold up to page_size (1,000) profiles: send the first answer’s session_id with page 1, 2, … until a page comes back short.

List saved cohorts

  • A POST that only lists cohorts. To get a cohort’s members, query profiles with filter_by_cohort.

Get users’ event activity

  • Mixpanel has put this endpoint in maintenance mode.

Export raw events

  • The answer is newline-delimited JSON, one event per line, not a JSON array. Keep the date range and limit small: a busy project’s day can be gigabytes.
  • Goes to the export server (export_server setting), not the Query API host.