kapa.ai so I want to select a list of meaningful events to export using Mixpanel API and list of properties as well. How do I achieve this? For example if the list of events are page view 1 to page view 30 so 30 page view events and 10 button clicks events (button clicked 1 to 10) And event properties (user ID, device ID, timestamp) How do I achieve this, give me the exact API parameters to use to pull and not push this export data to a data lake for example
To export a specific list of events and their properties from Mixpanel using the Raw Event Export API, you need to use the event and (optionally) the where parameters in your API request. Here’s how you can achieve your example scenario:
1. Specify the List of Events
You can use the event parameter to specify multiple events by passing a JSON array of event names. For your case (e.g., "page view 1" to "page view 30" and "button clicked 1" to "button clicked 10"), your parameter would look like: LBKS["page view 1", "page view 2", ..., "page view 30", "button clicked 1", ..., "button clicked 10"]LBKS
2. Specify the Properties
The Raw Event Export API always returns all event properties for each event, including user ID, device ID, and timestamp. You cannot limit the export to only specific properties at the API level; you will need to filter the properties you want after downloading the data.
3. Example API Request
Here’s an example using curl: LBKScurl --request GET \ --url '[https://data.mixpanel.com/api/2.0/export?from_date=2024-07-23&to_date=2024-07-24&event=["page](https://data.mixpanel.com/api/2.0/export?from_date=2024-07-23&to_date=2024-07-24&event=[%22page) view 1","page view 2","page view 3","button clicked 1","button clicked 2"]' \ --header 'accept: text/plain' \ --header 'authorization: Basic YOUR_AUTH_TOKEN'LBKS- Replace the event array with your full list of event names.
- Set from_date and to_date as needed.
- The response will be in JSONL format, with each line representing an event and all its properties (including user ID, device ID, and timestamp).
4. Filtering Properties
After export, you will need to process the JSONL file to extract only the properties you care about (e.g., user ID, device ID, timestamp). This is typically done with a script or data processing tool after download.
5. Optional: Filtering with where
If you want to further filter events by property values, use the where parameter with a segmentation expression. For example, to only export events where device_id is defined: LBKSwhere=defined(properties["device_id"])LBKS
Key Points
- The API does not support exporting only specific properties; all properties are included for each event.
- You must post-process the exported data to select only the properties you want.
- The event parameter is used to select which events to export.
- The where parameter can be used for property-based filtering at the event level.References:
Raw Event Export API parameters and usage
Exporting specific events and properties
Segmentation expressions for filtering
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.
