Is there a way to use the export data api to return the last n events ? or the last events since a specific date , i can return events by days but i need something more precise
Hi Jose M., 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 use the Raw Event Export API to retrieve events since a specific date or within a specific time range, which allows for more precise data retrieval. Here's how you can achieve this:1. Using a specific date range:
You can use the from_date
and to_date
parameters to specify a precise date range. These parameters accept dates in the format "YYYY-MM-DD". For example:LBKScurl --request GET \ --url '[https://data.mixpanel.com/api/2.0/export?from_date=2024-01-01&to_date=2024-01-02](https://data.mixpanel.com/api/2.0/export?from_date=2024-01-01&to_date=2024-01-02)' \ --header 'accept: text/plain' \ --header 'authorization: Basic YOUR_TOKEN'LBKS
This will return events from January 1, 2024, to January 2, 2024 Raw Event Export API.2. For more precise timing:
The API also supports a time_in_ms
parameter. When set to true
, it exports event timestamps with millisecond precision, allowing for more granular time-based filtering Export Methods.3. Limiting the number of events:
You can use the limit
parameter to specify the maximum number of events to return. For example, to get the last 100 events:LBKScurl --request GET \ --url '[https://data.mixpanel.com/api/2.0/export?from_date=2024-01-01&to_date=2024-01-02&limit=100](https://data.mixpanel.com/api/2.0/export?from_date=2024-01-01&to_date=2024-01-02&limit=100)' \ --header 'accept: text/plain' \ --header 'authorization: Basic YOUR_TOKEN'LBKS
However, please note that the API doesn't have a built-in "last n events" functionality. To get the most recent events, you'd typically set the to_date
to the current date and adjust the from_date
accordingly.Remember that the Raw Event Export API has rate limits: 60 queries per hour, 3 queries per second, and a maximum of 100 concurrent queries Raw Event Export API.For even more precise control, you might consider using JQL (JavaScript Query Language) which allows for more complex queries, although it's worth noting that JQL is in maintenance mode and not receiving further investment from Mixpanel JQL Documentation.
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.