Hi Team,
As, there are many distinct_id created for a profile in mixpanel. So, Can i able to fetch all distinct_id through any api ?
Using "/api/query/engage" api through array of distinct_id and for few records in response i got different distinct_id of that record, Is there any way i can get the same distinct_id which I'm passing?
Hi Jatin, This is Varsha from Mixpanel Support! 1. To answer your first question, it's currently not possible to directly fetch all distinct_ids for a user profile within Mixpanel through libraries, JQL, or the API. However, there is an undocumented endpoint with the Query API /engage, which we call the aliases endpoint, that can retrieve the distinct_ids in a cluster (programmatically). Please note that this endpoint can only query one alias/distinct_id at a time and is subject to the rate limits with the Query API. Essentially you pass in any ID tied to the user in the 'distinct_id' parameter and the response will return all other IDs tied to that distinct ID. Here's an example curl request:
curl --request POST \
--url '[https://mixpanel.com/api/2.0/engage/aliases?project_id=YOURPROJECTID](https://mixpanel.com/api/2.0/engage/aliases?project_id=YOURPROJECTID)' \
--header 'Accept: application/json' \
--header 'Authorization: Basic BASE_64_ENCODED_API_SECRET' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data distinct_id=YOURDISTINCTID
If you needed to run this for a large number of users it may be possible that your developers could programmatically create a way to pass a list of distinct IDs into this request one at a time so you would not need to manually enter them each time. 2. For your second question, when you query the API /engage, it only returns the canonical (main) distinct_id for a user. The canonical distinct_id is chosen in a non-deterministic manner and you are not able to choose which distinct_id you've sent in the past is considered the canonical distinct_id. Let me know if this makes sense. I hope this answered your questions! Best, Varsha
