Raw DATA EXPORT API parameter to_date and from_date not working as expected. Rather than filtering based on the date range selected it ignores this criteria and just filters and queries the first 100,000 event from the start date. This is not what I expected. This has been observed when pulling data to Power BI and also data platform. What is the solution or fix to this? Also, what is the WHERE parameter used for, can it be used to filter based on date timestamp or just date. What is possible, do not try to please me and let me know what is doable.
Hi event, 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
It sounds like you’re hitting the Raw Event Export API’s default behavior plus its limits: - The API returns events in chronological order starting at from_date. If you set limit (or a client defaults it), it will stop at that many events, which may be before your to_date if volume is high. The API allows limit up to 100,000; if omitted, some clients still apply their own caps. The API itself is rate‑limited to 60 requests/hour, 3 req/s, and 100 concurrent queries (Export API). - from_date and to_date are inclusive. They’re interpreted in UTC for projects created after Jan 1, 2023; for older projects, they’re interpreted in your project’s timezone (Export API, Export Methods, Project timezones).What to do to get the full date range - Remove or raise limit to the max (100,000) and paginate your exports by splitting the date range into smaller windows (e.g., day-by-day or week-by-week) until you cover the full range. This avoids stopping early at the first 100k. Mixpanel provides a sample script pattern for exporting varied date window sizes to stay under limits and adapt to volume (Sample script notes). - Respect API rate limits when batching (60/hour, 3/sec) (Export API). - Ensure you’re using the correct timezone interpretation for from_date/to_date based on your project creation date (Project timezones, Export Methods).About the where parameter - where filters by event properties using Mixpanel’s selector expressions; it is not a date-range control (that’s from_date/to_date). You can filter on numeric or string properties (including a timestamp property if you store one as a property), but the canonical event time window is controlled by from_date/to_date. More info is referenced in the API as “segmentation expressions” (Export API). - If you need sub-day filtering by time (e.g., specific hours), the Export API doesn’t expose hour/minute windows via from_date/to_date. You could:
- Use from_date/to_date for the day(s) and where to filter by a custom timestamp property you send in events (if you have one), or - Page by narrower date windows.Power BI/data platform notes - If Power BI or your platform sets a default limit, you’ll see only the first 100k from the start date. Configure your connector to loop over multiple API calls across your date range with no or higher limit, and consolidate results. The API will not “jump” within a single call to later dates once the limit is hit (Export API).If you need continuous, large-scale export without manual pagination, consider setting up a Raw Data Pipeline to cloud storage (S3/GCS/Azure), which exports JSONL files by day/hour and can run indefinitely; this avoids API pagination and client limits (Project migration: export options).
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.
Let me check the knowledge base for you again. One moment! 📚
Thanks for clarifying. The Raw Event Export API does not “skip ahead” within a single request—it returns events in chronological order starting at from_date and stops when it hits either to_date or the limit, whichever comes first. If your single-day window contains more than 100,000 events, the API will hit the 100,000 limit before reaching the end of that day, which can look like it “pulled more days,” but in reality it’s just returning the first 100,000 events from the start of your window and stopping there (Export API).What to do - Don’t rely on one call with a large limit. Instead, split the export into smaller windows (e.g., hour-by-hour for high-volume days, or multiple day slices) and iterate until the day is fully covered. Mixpanel provides a sample approach for varying window sizes to stay under limits (Sample script). - Ensure the timezone interpretation of from_date/to_date matches your project: UTC for projects created after Jan 1, 2023; project timezone for older projects. A mismatch can make a “day” span a different window than expected (Export API, Export Methods, Project timezones). - Respect rate limits: 60 requests/hour, 3 req/s, 100 concurrent queries when batching (Export API).About the where parameter - where filters by event properties via selector expressions; it does not replace from_date/to_date for the time window. You can only filter by a property you send (including a custom timestamp property if you have one). The canonical export window is still set by from_date/to_date (Export API). - If you need sub-day time filtering and don’t have a custom time property, use narrower from_date/to_date windows (e.g., multiple calls per day).If you want to avoid API pagination entirely, use a Raw Data Pipeline to cloud storage; it exports JSON files by day/hour continuously, which you can load into Power BI or your platform without hitting the API’s per-request limits (Project migration: export options).
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.
If it helps, here is my full python script that you can modify for your needs. I had a whole series of scripts, one to export, one to clean up the records to add/remove stuff from the event properties, and then a script that merged the results into one file, then a script to split the merged file into batches to import into another project (based on limits on the import).
