kapa.ai how can i query user profiles, who do an event in a period of time, example query people has event open_app yesterday
To query user profiles who performed a specific event (e.g., "open_app") within a certain period (e.g., yesterday), you have a few options in Mixpanel, depending on your preferred method and data access:
1. Using JQL (JavaScript Query Language)
You can combine events and profiles using the join() function in JQL. Here’s an example that fetches user profiles who did the "open_app" event yesterday: LBKSfunction main() { return join( Events({ from_date: "2024-06-10", // replace with yesterday's date to_date: "2024-06-10", // replace with yesterday's date event_selectors: [{event: "open_app"}] }), People(), { type: "inner" } ); }LBKSThis query returns joined records of users and their "open_app" events for the specified date. You can adjust the date range as needed. Note: JQL is deprecated and will be removed after December 31, 2025, so consider alternate methods for long-term use [JQL: Combining Events and Profiles].
2. Using the Engage Query API
You can use the Engage Query API to filter user profiles based on behaviors (events performed in a time window). You would use the behaviors parameter to specify the event and time window. However, the knowledge sources do not provide a full example of the behaviors parameter usage, so if you need a precise payload, please refer to the Engage Query API documentation or contact Mixpanel support [Engage Query API].
3. Using Data Pipelines (SQL in BigQuery or Snowflake)
If your data is exported to a warehouse, you can write a SQL query to select distinct user IDs who performed the event in the desired period, then join with the profiles table to get user properties. Example for BigQuery: LBKSSELECT DISTINCT p.** FROM `<your_project> .<your_dataset> .mp_master_event` e JOIN `<your_project> .<your_dataset> .mp_people` p ON e.distinct_id = p.distinct_id WHERE e.event_name = 'open_app' AND DATE(e._PARTITIONTIME) = "2024-06-10" -- replace with yesterday's dateLBKSAdjust table names and date as needed [BigQuery Integration].---**Summary:*
- For in-app or API queries, use JQL with join(Events(), People()) and filter by event and date.
- For data warehouse, use SQL to join events and profiles on distinct_id and filter by event and date.
- The Engage Query API also supports this, but the exact behaviors parameter usage is not fully detailed in the provided sources.If you need a specific example for the Engage Query API or further help with JQL, let me know!
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! 📚
To query user profiles who performed a specific event (e.g., open_app) during a certain period (e.g., yesterday) using the Engage Query API, you need to use the /engage endpoint. The API allows you to filter user profiles based on various parameters, including behaviors (events performed in a time window). However, the knowledge sources do not provide a detailed example of the exact payload for the behaviors parameter.Here’s what is confirmed from the knowledge sources: - The Engage Query API endpoint is:
POST [https://mixpanel.com/api/query/engage](https://mixpanel.com/api/query/engage)- You can filter profiles using parameters such as where, distinct_id, distinct_ids, and behaviors.
- The behaviors parameter is specifically for exporting user profiles using an event selector, but the exact structure for filtering by event and date is not fully detailed in the sources.Sample Request Structure:Pagination:
If your query returns more results than the page size, use the session_id and page parameters from the response to fetch additional pages (source).Filtering by Cohort:
Alternatively, you can use the filter_by_cohort parameter to export profiles belonging to a specific cohort, which you can define in the Mixpanel UI (source).---Limitations:
I'm sorry, but the knowledge sources do not provide a concrete example of how to structure the behaviors parameter to filter for users who performed a specific event (like open_app) within a specific date range. For the most accurate and up-to-date usage, please refer to the official Engage Query API documentation or contact Mixpanel support.Summary:
- Use the Engage Query API /engage endpoint.
- Use the behaviors parameter to filter by event and date, but the exact format is not detailed in the provided sources.
- Use pagination if needed.
- For more details, consult the official documentation or support.If you need help with another method or have more details, let me know!
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 https://mixpanel.com/api/query/retention?project_id=<my_id>&from_date=2025-08-24&to_date=2025-08-25&retention_type=birth&born_event=splash_to_main_menu&unbounded_retention=false what will it query?
Let me check the knowledge base for you again. One moment! 📚
The query you provided: LBKS[https://mixpanel.com/api/query/retention?project_id=<my_id](https://mixpanel.com/api/query/retention?project_id=<my_id) &from_date=2025-08-24&to_date=2025-08-25&retention_type=birth&born_event=splash_to_main_menu&unbounded_retention=false>LBKSwill return a retention report for your Mixpanel project with the following parameters: - project_id: The ID of your Mixpanel project.
- from_date=2025-08-24 and to_date=2025-08-25: The report will consider users who triggered the splash_to_main_menu event on either August 24 or August 25, 2025 (inclusive).
- retention_type=birth: This means the report will use "first time" (birth) retention, i.e., it will look at users who did the born_event (here, splash_to_main_menu) for the first time in the specified date range.
- born_event=splash_to_main_menu: The event that defines the cohort of users to track for retention.
- unbounded_retention=false: The report will use standard (not unbounded) retention, so it will only count users who return and perform the tracked event in each specific interval, not in any interval after.What does this query do?
It will return, for each day in the specified range (2025-08-24 and 2025-08-25), the number of users who performed the splash_to_main_menu event (the "birth" event) and, for subsequent intervals (by default, days), how many of those users returned and performed the tracked event again in each interval after their initial event. The response will include counts for each interval, showing how many users were retained on each day after their first splash_to_main_menu event Query Retention Report Query API - Retention.If you do not specify an event parameter, Mixpanel will look across all events for the return action. The default interval is 1 day, and the default unit is "day" unless otherwise specified.**Example response structure::**LBKS```LBKS{
"2025-08-24":: {
"counts": [X, Y, Z],
"first": N
},
"2025-08-25": {
"counts": [A, B, C],
"first": M
}
}```Where first is the number of users who did the splash_to_main_menu event on that day, and counts shows how many of those users returned in each subsequent interval Query Retention Report.If you need to track retention for a specific return event, you can add the event parameter to the query.
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! 📚
There are several reasons why you might see different values for the number of users who performed an event in a day when comparing results from the Mixpanel API and the Mixpanel dashboard: 1. Different Counting Methods Mixpanel reports can calculate data in different ways. For example, the Insights report may count total event occurrences, while a Funnel report may count unique users or conversions. Make sure you are comparing the same metric (e.g., unique users vs. total events) in both the API and the dashboard Debugging: Data Discrepancies.2. Filters and Query Parameters Differences in filters, time frames, or event properties between your API query and the dashboard report can lead to discrepancies. Ensure both are using the same filters, date ranges, and event definitions Debugging Discrepancies.3. Timezones Mixpanel records events in UTC, but the dashboard may display times in your project’s timezone. If your API query and dashboard are not aligned on timezone, the counts for a given day may differ Debugging: Data Discrepancies.4. Delayed Ingestion Events sent late (e.g., from offline devices) may be ingested after the fact. The dashboard and API may show different numbers if one includes late-arriving data and the other does not Delayed Ingestion.5. ID Management Issues If the unique user count differs but the total event count matches, it may indicate an issue with how user identities are managed or merged Debugging Discrepancies.6. Hidden Events Mixpanel exports all events to destinations, even those hidden in the UI. If you are comparing exported data to dashboard data, hidden events may cause discrepancies Data Pipelines FAQ.Recommendation: To debug, ensure you are: - Comparing the same metric (unique users vs. total events) - Using the same filters, time frames, and timezones - Checking for late-arriving data or ingestion delays - Reviewing ID management and event definitionsIf discrepancies persist, try removing all filters and breakdowns to compare the raw data, then re-add them to identify where the difference occurs Debugging: Data Discrepancies.
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! 📚
Yes, you can select whether to query by unique users or total events via the Mixpanel API.When using endpoints such as /events, /events/properties, or /segmentation, you can specify the type parameter to control the aggregation: - Use type=unique to get the count of unique users who performed the event.
- Use type=general to get the total number of event occurrences (total events).
- Use type=average for average calculations.**Example for the /events endpoint:** http GET /events?project_id=YOUR_PROJECT_ID&event=["open_app"]&type=unique&unit=day&from_date=2024-06-10&to_date=2024-06-10LBKSThis will return the number of unique users who performed the open_app event on June 10, 2024.If you change type=unique to type=general, it will return the total number of open_app events for that day (Query API - Event Breakdown).This approach applies similarly to other relevant endpoints, such as /segmentation and /events/properties, where the type parameter controls whether you get unique user counts or total event counts.
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.
