GIve me API to get users data from mixpanel
Hi Abhijeet S., 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
To get user data (user profiles) from Mixpanel via API, you should use the Engage Query API. This API allows you to export user profile data, filter by properties or cohorts, and paginate through results.Sample API Request:Example response::**LBKS```LBKS{ "page":: 0, "page_size": 1000, "results": [ { "$distinct_id": 1, "$properties": { "$created": "2008-12-12T11:20:47", "$email": "example1@mixpanel.com", "$first_name": "Example1", "$last_name": "Name1", "$last_seen": "2008-06-09T23:08:40" } } // ... more profiles ], "session_id": "1234567890-EXAMPLE", "status": "ok", "total": 1 }```- You can filter by cohort using the filter_by_cohort parameter. - For large exports, paginate using session_id and page as described in the API docs.For more details, see the Exporting Profiles documentation and the Engage API reference.Note:** The Query API has a rate limit of 60 queries per hour and a maximum of 5 concurrent queries. Make sure to use the correct API endpoint for your data residency (US, EU, or IN) as described in the Mixpanel API overview.You can also export user profiles as CSV directly from the Mixpanel UI via the Users tab by clicking the “Export” button, but for programmatic access, the Engage Query API is recommendedExporting Profiles Query API Reference.
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.
how to sort by latest, or also how to filter it by date they join , like i want get users whos firstseen was yesterday, kapa.ai
Let me check the knowledge base for you again. One moment! 📚
To get users whose "first seen" date was yesterday using the Mixpanel Engage API, you should use the $mp_first_event_time property, which represents the time of the user’s very first event in Mixpanel. You can filter users by this property using the where parameter in your API request.Example: Filter users whose first seen was yesterdaySuppose yesterday's date is 2024-06-10. You would filter for users whose $mp_first_event_time falls within that day (in ISO 8601 format): 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-urlencode 'where=properties["$mp_first_event_time"] > = "2024-06-10T00:00:00" and properties["$mp_first_event_time"] < "2024-06-11T00:00:00"'LBKSSorting by LatestThe Engage API does not natively support server-side sorting. However, you can retrieve the data and then sort the results client-side by the $mp_first_event_time or any other property you wish.Key Points:
- Use the where parameter to filter by join date ($mp_first_event_time).
- Sorting must be done after fetching the data, as the API does not provide a sort parameter.For more details, see <https://docs.mixpanel.com/docs/export-methods#exporting-profiles|Exporting Profiles> and the reserved properties reference.
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.
