List and query user cohorts
curl --request POST \
--url https://mixpanel.com/api/query/cohorts/list{
"count": 123,
"is_visible": 123,
"description": "<string>",
"created": "<string>",
"project_id": 123,
"id": 123,
"name": "<string>"
}Documentation Index
Fetch the complete documentation index at: https://mintlify.com/mixpanel/docs/llms.txt
Use this file to discover all available pages before exploring further.
curl "https://mixpanel.com/api/query/cohorts/list?project_id=123" \
-X POST \
-u SERVICE_ACCOUNT_USERNAME:SERVICE_ACCOUNT_SECRET
[
{
"count": 150,
"is_visible": 1,
"description": "Power users who logged in 10+ times",
"created": "2024-01-15 10:30:00",
"project_id": 123,
"id": 1000,
"name": "Power Users"
},
{
"count": 2500,
"is_visible": 1,
"description": "Users who signed up in January",
"created": "2024-01-01 09:00:00",
"project_id": 123,
"id": 1001,
"name": "January Signups"
}
]
/engage endpoint with filter_by_cohort parameter to get users in a cohort:
import requests
from requests.auth import HTTPBasicAuth
response = requests.post(
'https://mixpanel.com/api/query/engage',
auth=HTTPBasicAuth('USERNAME', 'SECRET'),
params={'project_id': 123},
data={
'filter_by_cohort': '{"id": 1000}'
}
)
users = response.json()
print(f"Total users: {users['total']}")
for user in users['results']:
print(f"User: {user['$distinct_id']}")
curl --request POST \
--url https://mixpanel.com/api/query/cohorts/list{
"count": 123,
"is_visible": 123,
"description": "<string>",
"created": "<string>",
"project_id": 123,
"id": 123,
"name": "<string>"
}