is there a way to get the user information from a cohort on an api call?
Hi Emanuel F., Please stand by as I search the Mixpanel knowledge base for an AI-powered answer. I normally take about 15 seconds or so. In case AI cannot answer your question, feel free to reach out to Mixpanel support at mixpanel.com/get-support. If you have follow-up questions for this thread, please tag me again with your question: @kapa.ai <follow-up question> đź‘‹
Feel free to ask a follow-up question once I've answered by mentioning me with @kapa.ai
Yes, you can retrieve user information from a Mixpanel cohort using the Engage API. Here's how to do it: You'll need to use the /engage
endpoint with the filter_by_cohort
parameter to query profiles that belong to a specific cohort. First, you can find your cohort ID either in the UI next to your cohort or by using the cohorts-list API which returns all cohorts in your project along with their IDs.Then, make a request to the Engage API like this: LBKScurl --request POST \ --url '[https://mixpanel.com/api/query/engage?project_id=YOUR_PROJECT_ID](https://mixpanel.com/api/query/engage?project_id=YOUR_PROJECT_ID)' \ --header 'accept: application/json' \ --header 'authorization: Basic YOUR_TOKEN' \ --header 'content-type: application/x-www-form-urlencoded' \ --data 'filter_by_cohort={"id":YOUR_COHORT_ID}'LBKS
The response will contain user profiles in the results key, with each profile as an object containing the distinct_id and properties: LBKS{ "page": 0, "page_size": 1000, "results": [ { "$distinct_id": "user1", "$properties": { "$email": "example@​[mixpanel.com](http://mixpanel.com)", "$first_name": "Example", "$last_name": "User", // other properties } }, // more user profiles ], "session_id": "session-id", "status": "ok", "total": 100 }LBKS
You can also specify which profile properties to return using the output_properties
parameter to reduce the amount of data returned: LBKSoutput_properties=["$last_name", "$email", "Total Spent"]LBKS
The API has a rate limit of 60 queries per hour and a maximum of 5 concurrent queries, so plan your requests accordingly.Query API - Engage Cohorts List Engage Query
kapa.ai is still learning and improving, please let me know how I did by reacting below.
ℹ️ Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.