Skip to main content
POST
/
api
/
query
/
cohorts
/
list
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>"
}

Query Cohorts

List saved cohorts and retrieve cohort membership information.

List Saved Cohorts

project_id
integer
required
Your Mixpanel project ID
workspace_id
integer
The workspace ID

Example Request

curl "https://mixpanel.com/api/query/cohorts/list?project_id=123" \
  -X POST \
  -u SERVICE_ACCOUNT_USERNAME:SERVICE_ACCOUNT_SECRET

Response

count
integer
Number of users currently in the cohort
is_visible
integer
Visibility status (0 = not visible, 1 = visible)
description
string
Cohort description
created
string
Creation timestamp
project_id
integer
Project ID
id
integer
Cohort ID
name
string
Cohort name
[
  {
    "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"
  }
]

Query Cohort Members

Use the /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']}")
See the Engage documentation for more details on querying profiles.

Build docs developers (and LLMs) love