kapa.ai in mixpanel raw export api how can apply where attribute ? i want to fetch evets past perticular timesampt
Please stand by Abhishek C. as I search the knowledge base. I normally take about 15 seconds or so. 👋
Feel free to ask a follow-up question once I've answered by mentioning me with @kapa.ai
To use the Mixpanel Raw Event Export API and filter events based on a specific timestamp, you can use the where parameter. The where parameter allows you to specify a segmentation expression to filter events, including by event properties such as time.For example, to fetch events that occurred after a particular Unix timestamp (in seconds), you can use a where clause like this: LBKSwhere=properties["time"] > 1700000000LBKSHere’s how you might structure your API request: LBKScurl --request GET \ --url '[https://data.mixpanel.com/api/2.0/export?from_date=2024-07-01&to_date=2024-07-10&where=properties["time"]%20%3E%201700000000](https://data.mixpanel.com/api/2.0/export?from_date=2024-07-01&to_date=2024-07-10&where=properties[%22time%22]%20%3E%201700000000)' \ --header 'accept: text/plain' \ --header 'authorization: Basic YOUR_TOKEN'LBKS- Replace 1700000000 with your desired Unix timestamp (in seconds).
- The where parameter must be URL-encoded (e.g., > becomes %3E, spaces become %20).The time property in the exported data is in seconds since the Unix epoch. If you want millisecond precision, you can add the time_in_ms=true parameter to your request.For more details on the where parameter and the export API, see the official documentation: Event Export API - Export and Export Methods.
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.
when doing it via a script or postman do i need to include the spaces ?
when doing it via a script or postman do i need to include the spaces ? kapa.ai
Let me check the knowledge base for you again. One moment! 📚
When using the where parameter in the Mixpanel Raw Event Export API, you do need to include spaces in the expression (e.g., properties["time"] > 1700000000). However, when making the request via a script or Postman, these spaces (and other special characters) must be URL-encoded. For example, a space becomes %20, and > becomes %3E.So, your where clause in the URL should look like this: LBKSwhere=properties["time"]%20%3E%201700000000LBKSIf you use Postman, it will often handle URL encoding for you if you enter the value in the query parameters section. If you are building the URL manually in a script, you must ensure the parameter is properly URL-encoded.This requirement is confirmed in the API documentation, which describes the use of the where parameter and notes that it should be URL-encoded when included in the request URL Event Export API - Export.
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.
as soon as i specify the where query i get nothing in response kapa.ai here is is value properties["time"] > 1715449195830
Let me check the knowledge base for you again. One moment! 📚
If you are not getting any results when using a where query like properties["time"] > 1715449195830, there are a few important things to check based on the Mixpanel documentation: 1. Time Format (Seconds vs. Milliseconds):
- The time property in Mixpanel's raw export is typically in seconds since the Unix epoch, not milliseconds. If you use a value like 1715449195830 (which is in milliseconds), it will not match any events, since event times are much smaller numbers (e.g., 1715449195).
- Try dividing your timestamp by 1000 to convert milliseconds to seconds. For example:
```LBKSLBKS2. **Parameter Encoding:**
- Ensure your where clause is URL-encoded. For example:
```LBKS where=properties["time"]%20%3E%201715449195
```LBKSLBKS3. **Date Range:**
- Make sure your `from_date` and `to_date` parameters cover the range you expect. The where clause only filters events within the date range specified by these parameters.LBKS4. **Project Timezone:**
- For projects created before 1 Jan 2023, the `from_date` and `to_date` parameters are interpreted in your project’s timezone, not UTC. For newer projects, they are in UTC. This can affect which events are included in your export [Manage Timezones for Projects](https://docs.mixpanel.com/docs/orgs-and-projects/managing-projects#manage-timezones-for-projects).LBKS**Summary:**
You are likely not seeing results because you are filtering on a millisecond timestamp, but Mixpanel stores and filters on seconds by default in the raw export API. Adjust your query to use seconds, and you should see results if events exist in that range.LBKSReferences:
- [Export Methods](https://docs.mixpanel.com/docs/export-methods)
- [Event Export API - Export](https://github.com/mixpanel/docs/blob/main/openapi/src/export.openapi.yaml)
- [Manage Timezones for Projects](https://docs.mixpanel.com/docs/orgs-and-projects/managing-projects#manage-timezones-for-projects)
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.
kapa.ai didn't work I tried with properties["time"] < 1715449195 properties["time"] > 1715449195
Let me check the knowledge base for you again. One moment! 📚
If you are not getting any results when using the where parameter with queries like properties["time"] < 1715449195 or properties["time"] > 1715449195, here are the key points from the official Mixpanel documentation to consider: 1. Time Property Format:
The time property in the raw export API is in seconds since the Unix epoch by default. If you want to filter using milliseconds, you must set the time_in_ms=true parameter in your request. Otherwise, your filter should use seconds (Export Methods).2. Date Range Parameters:
The from_date and to_date parameters define the window of events returned. The where filter only applies to events within this window. If your date range does not include any events that match your where clause, you will get an empty response (Export Methods).3. URL Encoding:
The where clause must be URL-encoded. For example, a space is %20 and > is %3E (Event Export API - Export).4. Project Timezone:
For projects created before 1 Jan 2023, the from_date and to_date parameters are interpreted in your project’s timezone. For newer projects, they are in UTC (Manage Timezones for Projects).Troubleshooting Steps:
- Double-check that your from_date and to_date cover the period you expect.
- Make sure your where clause matches the time format (seconds or milliseconds) used in your export.
- Try running the export without the where clause to confirm that events exist in the date range.
- If you want to use milliseconds, add time_in_ms=true to your request and use a millisecond timestamp in your where clause.**Example Request (seconds):curl --request GET \ --url '[https://data.mixpanel.com/api/2.0/export?from_date=2024-05-01&to_date=2024-05-10&where=properties["time"]%20%3E%201715449195](https://data.mixpanel.com/api/2.0/export?from_date=2024-05-01&to_date=2024-05-10&where=properties[%22time%22]%20%3E%201715449195)' \ --header 'accept: text/plain' \ --header 'authorization: Basic YOUR_TOKEN'Example Request (milliseconds):**LBKScurl --request GET \ --url '[https://data.mixpanel.com/api/2.0/export?from_date=2024-05-01&to_date=2024-05-10&time_in_ms=true&where=properties["time"]%20%3E%201715449195000](https://data.mixpanel.com/api/2.0/export?from_date=2024-05-01&to_date=2024-05-10&time_in_ms=true&where=properties[%22time%22]%20%3E%201715449195000)' \ --header 'accept: text/plain' \ --header 'authorization: Basic YOUR_TOKEN'LBKS
If you have confirmed all of the above and still receive no results, the knowledge sources do not provide further troubleshooting steps for this specific issue. You may want to verify that events actually exist in the specified time range and that your project settings (such as timezone) are correct (Export Methods; Event Export API - Export).
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.
NO the where query doesn't work at all
kapa.ai NO the where query doesn't work at all
Let me check the knowledge base for you again. One moment! 📚
