# Mixpanel

Mixpanel is a product analytics platform tracking user interactions and engagement, providing cohort analysis, funnels, and A/B testing to improve user experiences

- **Category:** analytics
- **Auth:** BASIC
- **Composio Managed App Available?** N/A
- **Tools:** 50
- **Triggers:** 0
- **Slug:** `MIXPANEL`
- **Version:** 20260323_00

## Tools

### Add Unique Values to Profile List Property

**Slug:** `MIXPANEL_ADD_UNIQUE_TO_PROFILE_LIST_PROPERTY`

Tool to add unique values to list properties on user profiles in Mixpanel using the $union operation. Use when you need to add items to list-type properties without creating duplicates. Unlike $append, $union ensures values are unique in the list. If the property doesn't exist, it creates a new list with the provided values.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `ip` | integer | No | Controls geolocation. Set to 0 to disable geolocation, 1 to enable. Default is 1. |
| `data` | array | Yes | A list of profile update objects. Each object must contain $token, $distinct_id, and $union properties. The $union operation adds values to list properties without creating duplicates. |
| `strict` | integer | No | Enables validation with per-record error messages. Set to 1 to enable strict mode, 0 to disable. When enabled, returns detailed validation errors for each failed record. |
| `verbose` | integer | No | Returns detailed response object. Set to 1 to get JSON response with status and error fields, 0 for plain text status (1 for success, 0 for failure). Default is 0. |
| `callback` | string | No | JSONP callback function name. Used for JSONP requests. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Get Aggregated Event Property Values

**Slug:** `MIXPANEL_AGGREGATED_EVENT_PROPERTY_VALUES`

Get unique, total, or average data for a single event and property over days, weeks, or months. The Query API has a rate limit of 60 queries per hour and a maximum of 5 concurrent queries.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `name` | string | Yes | The name of the property you would like to get data for |
| `type` | string ("general" | "unique" | "average") | Yes | The analysis type you would like to get data for |
| `unit` | string ("minute" | "hour" | "day" | "week" | "month") | Yes | The level of granularity of the data |
| `event` | string | Yes | The event that you wish to get data for. Note: this is a single event name, not an array |
| `limit` | integer | No | The maximum number of values to return |
| `format` | string ("json" | "csv") | No | Data format options for Mixpanel responses. |
| `values` | array | No | The specific property values that you would like to get data for. Example: ['female', 'unknown'] |
| `to_date` | string | No | The date in yyyy-mm-dd format to query to (inclusive) |
| `interval` | integer | No | The number of units to return data for. Specify either interval or from_date and to_date |
| `from_date` | string | No | The date in yyyy-mm-dd format to begin querying from (inclusive) |
| `project_id` | integer | Yes | Required if using service account to authenticate request |
| `workspace_id` | integer | No | The id of the workspace if applicable |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Aggregate Event Counts (Deprecated)

**Slug:** `MIXPANEL_AGGREGATE_EVENT_COUNTS`

DEPRECATED: Use MIXPANEL_AGGREGATE_EVENTS instead. Tool to get unique, total, or average data for events over N days, weeks, or months. Use when analyzing event trends and patterns over time with different aggregation methods.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `type` | string ("general" | "unique" | "average") | Yes | Analysis type - determines the aggregation method for event data Valid values: 'general', 'unique', 'average', 'sum'. Any other value fails validation. |
| `unit` | string ("minute" | "hour" | "day" | "week" | "month") | Yes | Time granularity for data aggregation - determines how data points are grouped |
| `event` | string | Yes | The event or events to get data for, encoded as a JSON array string (e.g., '["Event1", "Event2"]') |
| `format` | string ("json" | "csv") | No | Data format options for Mixpanel responses. |
| `to_date` | string | No | End date in format YYYY-MM-DD (inclusive) - filters events up to and including this date |
| `interval` | integer | No | Number of time units to return data for - limits the number of data points returned |
| `from_date` | string | No | Start date in format YYYY-MM-DD (inclusive) - filters events from this date onwards Strongly recommended; omitting both from_date and to_date may cause missing parameter errors. |
| `project_id` | integer | Yes | Project identifier for authentication and project selection |
| `workspace_id` | integer | No | Workspace identifier if applicable - used for workspace-level queries |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Get Aggregate Events

**Slug:** `MIXPANEL_AGGREGATE_EVENTS`

Get aggregate event counts over time. Supports different types of aggregation: general, unique, average, sum.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `type` | string ("general" | "unique" | "average" | "sum") | No | Type of aggregation |
| `unit` | string ("minute" | "hour" | "day" | "week" | "month") | No | Time unit for grouping results |
| `event` | string | No | Name of the event to analyze At least one of `event` or `events` must be provided per request; omitting both returns a 'Missing required parameter: event' error. |
| `limit` | integer | No | Maximum number of results to return |
| `where` | string | No | Expression to filter events |
| `events` | array | No | List of event names to analyze |
| `to_date` | string | Yes | End date for the query (inclusive) |
| `interval` | integer | No | Time interval for the results in seconds |
| `from_date` | string | Yes | Start date for the query (inclusive) |
| `project_id` | integer | Yes | The ID of the project to query |
| `workspace_id` | integer | No | The ID of the workspace if applicable |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### List Saved Cohorts

**Slug:** `MIXPANEL_COHORTS_LIST`

Tool to list all saved cohorts in a Mixpanel project. Use when you need to retrieve cohort metadata including name, id, count, description, creation date, and visibility. The Query API has a rate limit of 60 queries per hour and a maximum of 5 concurrent queries.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `project_id` | integer | Yes | The ID of the project to query. Required for listing cohorts. |
| `workspace_id` | integer | No | The ID of the workspace if applicable. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Create Annotation Tag

**Slug:** `MIXPANEL_CREATE_ANNOTATION_TAG`

Tool to create a new annotation tag in Mixpanel using the provided name. Use when you need to create tags for organizing and categorizing annotations. Requires a role of at least Analyst.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `name` | string | Yes | The name of the annotation tag to create |
| `project_id` | string | Yes | The project identifier where the annotation tag will be created |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Create Identity

**Slug:** `MIXPANEL_CREATE_IDENTITY`

Tool to create an identity mapping in Mixpanel by linking an anonymous ID with an identified user ID. Use when you need to connect pre-login anonymous activity with post-login identified user activity. This operation is typically performed after user authentication to associate all previous anonymous events with the user's identified profile.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `token` | string | Yes | Project authentication token for client-side authentication. |
| `strict` | integer ("0" | "1") | No | Validation mode for the request. |
| `anon_id` | string | Yes | The anonymous ID (UUID v4 format) to be linked with the identified user ID. This is typically the ID used before the user authenticated. |
| `distinct_id` | string | No | Optional distinct ID. If provided, this will be used as the post-ID for the identity. |
| `identified_id` | string | Yes | The identified user ID to link with the anonymous ID. This is typically the user's ID after they sign up or log in. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Create Service Account

**Slug:** `MIXPANEL_CREATE_SERVICE_ACCOUNT`

Tool to create a new service account for your organization and optionally add it to projects. Use when you need to generate API credentials for programmatic access. The response includes a token (secret) that cannot be recovered after creation. Requires service account with admin or owner role.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `role` | string ("owner" | "admin" | "analyst" | "consumer") | No | The organization-level role for the service account. If not specified, service account will have no organization-level role. |
| `expires` | string | No | ISO 8601 date-time format string indicating when the service account should expire. If not specified, the service account will have no expiration. |
| `projects` | array | No | List of projects to add the service account to with specified roles. If not specified, the service account will not be added to any projects. |
| `username` | string | Yes | A descriptive name for the service account |
| `organization_id` | string | Yes | The unique identifier for the organization |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Delete Group

**Slug:** `MIXPANEL_DELETE_GROUP`

Tool to permanently delete a group profile from Mixpanel Group Analytics. Use when you need to completely remove a group profile and all of its properties. The deletion is permanent and cannot be undone. Note that group properties on historical events remain intact even after group deletion.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `time` | integer | No | Unix timestamp in milliseconds for when the deletion should be recorded. If not provided, current time is used. |
| `token` | string | Yes | Your Mixpanel project token for authentication. |
| `group_id` | string | Yes | The unique identifier for the specific group to permanently delete. This is the only parameter that determines which group profile is deleted. |
| `group_key` | string | Yes | The group category/type identifier (e.g., 'company', 'organization', 'team'). This identifies the type of group being deleted. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Delete Profile

**Slug:** `MIXPANEL_DELETE_PROFILE`

Tool to permanently delete a user profile from Mixpanel, along with all of its properties. Use when you need to completely remove a profile. The deletion is permanent and cannot be undone. Note that this only deletes the profile, not the associated events. For duplicate profiles, use $ignore_alias: true to avoid deleting the original profile.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `ip` | string | No | IP address for request attribution. Set to '0' to not update geolocation data. |
| `token` | string | Yes | Project authentication token for API authentication. |
| `distinct_id` | string | Yes | Unique identifier for the user profile to permanently delete. This is the only parameter that determines which profile is deleted. |
| `ignore_time` | boolean | No | If true, Mixpanel will not automatically update the 'Last Seen' property before deletion. |
| `ignore_alias` | boolean | No | If true, prevents deletion of the original profile when deleting duplicates using an alias as distinct_id. Important for avoiding unintended deletions of merged profiles. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Delete Multiple Profiles (Batch)

**Slug:** `MIXPANEL_DELETE_PROFILE_BATCH`

Tool to permanently delete multiple user profiles from Mixpanel in a single batch request. Use when you need to delete multiple profiles efficiently. The deletion is permanent and cannot be undone. This only deletes the profiles, not the associated events. For duplicate profiles, use $ignore_alias: true to avoid deleting the original profile.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `profiles` | array | Yes | List of profile delete operations to execute. Each profile must include $token, $distinct_id, and $delete. Maximum 50 deletions per request recommended. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Delete Profile Property

**Slug:** `MIXPANEL_DELETE_PROFILE_PROPERTY`

Tool to permanently delete properties from a Mixpanel user profile using the $unset operation. Use when you need to remove specific properties and their values from a profile. Properties are permanently removed and cannot be recovered. Useful when cleaning up properties or approaching Mixpanel's limit of 2000 properties per profile.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `ip` | string | No | IP address for request attribution. Set to '0' to not update geolocation data. |
| `time` | integer | No | Unix timestamp for when the operation occurred. |
| `token` | string | Yes | Project authentication token for API authentication. |
| `unset` | array | Yes | List of property names to permanently remove from the profile. Properties are permanently deleted and cannot be recovered. |
| `distinct_id` | string | Yes | Unique identifier for the user profile to update. |
| `ignore_time` | boolean | No | If true, Mixpanel will not automatically update the 'Last Seen' property. |
| `ignore_alias` | boolean | No | If true, ignores alias processing and uses the distinct_id directly. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Get All Projects

**Slug:** `MIXPANEL_GET_ALL_PROJECTS`

Get all projects associated with the authenticated Mixpanel account. Returns project details including name, permissions, role, domain, and other configuration details. If a project appears inaccessible, verify the connection region matches the project's cluster before assuming a permissions issue.

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Get Annotation Tags

**Slug:** `MIXPANEL_GET_ANNOTATION_TAGS_ALT1`

Tool to get all annotation tags from a Mixpanel project. Use when you need to retrieve tags that have been added to annotations. Requires a role of at least Analyst.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `project_id` | string | Yes | The unique identifier for the Mixpanel project |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Batch Update Group Profiles

**Slug:** `MIXPANEL_GROUP_BATCH_UPDATE`

Tool to send a batch of group profile updates to Mixpanel. Use when you need to update multiple group profiles in a single request. Supports operations like $set, $set_once, $union, $remove, $unset, and $delete. Note: $add is NOT supported for group profiles.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | array | Yes | A list of group profile update objects. Each object contains the group identifiers and operations to perform. |
| `response_format` | string ("IP" | "Strict" | "Verbose") | No | Controls response format. IP: returns '1' for valid data, Strict: returns error for any invalid records, Verbose: detailed response. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Delete Group Properties

**Slug:** `MIXPANEL_GROUP_DELETE_PROPERTY`

Tool to delete specific properties from a Mixpanel group profile. Use when you need to permanently remove unwanted properties from a group (company, organization, team, etc.). The operation uses the $unset operation to permanently remove the specified properties.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `token` | string | Yes | Your Mixpanel project authentication token |
| `group_id` | string | Yes | The unique identifier for the specific group to update |
| `group_key` | string | Yes | The group category/type identifier (e.g., 'company', 'organization', 'team') |
| `properties` | array | Yes | List of property names to delete/unset from the group profile |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Set Group Properties (Batch) (Deprecated)

**Slug:** `MIXPANEL_GROUP_SET_PROPERTY`

DEPRECATED: Use MIXPANEL_GROUP_BATCH_UPDATE instead. Tool to send batch group profile updates to Mixpanel. Use when you need to update properties for one or more groups (companies, organizations, teams, etc.). Supports multiple operations: $set (update/add), $set_once (set if not exists), $unset (delete), $remove (remove from list), $union (add to list uniquely).

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `groups` | array | Yes | List of group profile updates to send. Each update must include $token, $group_key, $group_id, and at least one operation ($set, $set_once, $unset, $remove, or $union) |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Create Identity Alias

**Slug:** `MIXPANEL_IDENTITY_CREATE_ALIAS`

Tool to create an alias mapping between two distinct IDs in Mixpanel. Use when you need to link a new identifier with an existing one. This is only available for projects using the Original ID Merge system and Legacy ID Management System; it has no effect in the Simplified ID Merge system. Typically called once during user signup to connect anonymous pre-signup events with post-signup activity. Each alias can only map to one distinct_id.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `alias` | string | Yes | A new distinct_id value that will be interpreted as the existing distinct_id. Each alias can only map to one distinct_id. Typically set during user signup to connect anonymous pre-signup events with post-signup activity. |
| `token` | string | Yes | Project authentication token for client-side authentication. |
| `distinct_id` | string | Yes | The existing distinct ID to be merged with the alias. This is the original identifier that the alias will map to. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Execute JQL Query

**Slug:** `MIXPANEL_JQL_QUERY`

Execute a custom JQL (JavaScript Query Language) query against Mixpanel's Query API. Key Constraints: - 60 queries/hour, max 5 concurrent queries. - 2-minute execution timeout. - 5 GB data processing limit, 2 GB output limit. - No remote network requests (XMLHttpRequest) are allowed inside the JQL script.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `params` | object | No | A JSON-encoded object that will be made available in the script as `params`. Use this to pass dynamic date ranges, event names, or other parameters into your JQL query. |
| `script` | string | Yes | A **fully valid** JavaScript code snippet that defines **`function main() { ... }`** and returns the final dataset. The script is compiled and executed by Mixpanel's JQL engine.  -------------------------------------------------------------------------------------------- ### **COMPLETE JQL REFERENCE**  JQL (JavaScript Query Language) allows you to query Mixpanel's raw event or user (profile) data using standard JavaScript transformations. Below is a comprehensive reference to help you generate queries, including how to:  - **Fetch event data** with `Events()`.  - **Fetch user profiles** with `People()`.  - **Join** events and profiles with `join()`.  - Apply **filters**, **mappers**, and **reducers** (aggregations) with `.filter()`, `.map()`, `.reduce()`, etc.  - Group results with `.groupBy()` or `.groupByUser()`.  - Use built-in reducers like `count()`, `sum()`, `avg()`, etc.  - Pass dynamic parameters via the `params` object.  Your script must have **exactly** one top-level function named `main()`. For example:  ```js function main() {   // 1) Fetch a data source (Events, People, or join(...)).   // 2) Transform/aggregate as needed.   // 3) Return the final results. } ```  -------------------------------------------------------------------------------------------- ## **DATA SOURCES**  1. **Events(params)**    - Fetch raw event data. Each event object typically has:      - `name`: The event name (string).      - `distinct_id`: The user's distinct ID.      - `time`: Timestamp in milliseconds since epoch (project timezone, not UTC).      - `properties`: An object with all event properties.    - **Common arguments** to `Events()`:      ```js      Events({        from_date: "YYYY-MM-DD",        to_date: "YYYY-MM-DD",        event_selectors: [          {            event: "EventName",            selector: "properties[\"country\"] == \"US\"",            label: "Custom Label" // optional label          }        ]        // user_selectors can also be used in People() if needed.      })      ```    - The `selector` field supports **Segmentation Expressions**, e.g.: `"properties[\"app_name\"] == \"gmail\" and properties[\"some_flag\"] == true"`.  2. **People(params)**    - Fetch user profiles. Each user object has:      - `distinct_id`: The user's unique ID.      - `time`: Timestamp of the most recent update.      - `last_seen`: Timestamp of the most recent profile Set() call.      - `properties`: An object of user properties (e.g. `signup_date`, `email`, `country`, etc.).    - **Example**:      ```js      People({        user_selectors: [          { selector: "user[\"$email\"] == \"someone@example.com\"" }        ]      })      // or      People()        .filter(u => u.properties.age > 30);      ```  3. **join(Events(...), People(...), { type, selectors })**    - Combine events with user profiles on the same `distinct_id`.    - Each joined item has `{ distinct_id, event, user }`, where `event` is an event object and `user` is a user object.    - **type** can be `full`, `left`, `right`, or `inner` (defaults to `full`).    - You can use selectors referencing **both** event & user properties.      ```js      join(        Events({ from_date: '2023-01-01', to_date: '2023-01-31' }),        People(),        {          type: 'inner',          selectors: [ { selector: 'properties[\"country\"] == "US" and user[\"age\"] > 30' } ]        }      )      ```  -------------------------------------------------------------------------------------------- ## **TRANSFORMATIONS** (Methods that process collections)  After fetching a data source, you can chain transformations. The final result of your chain is what you `return` in `main()`.  1. **filter(fn)**:    - Keep only items for which `fn(item)` is `true`.    - Example:      ```js      .filter(e => e.name === "Sign Up" && e.properties.country === "US")      ```  2. **map(fn)**:    - Transform each item in the collection.    - Example:      ```js      .map(e => {        return {          originalEventName: e.name,          city: e.properties.$city        };      })      ```  3. **reduce(reducerFn)**:    - Aggregates the entire collection into **one** value.    - Built-in reducers exist (see below), or you can write a custom function with signature      `(accumulators, items) => { ... }`.  4. **groupBy(keys, reducer)**:    - Group items by the specified keys, then apply a reducer to each group.    - Returns an array of objects in the form:      ```js      [ { key: [...], value: <reduced result> }, ... ]      ```    - **Keys** can be property paths like `'properties.$city'` or a function `(item) => item.name`.    - Example:      ```js      .groupBy([        "properties.country",        "properties.browser"      ], mixpanel.reducer.count())      ```  5. **groupByUser([optionalKeys], reducer)**:    - Similar to `groupBy`, but automatically groups all events for each user (`distinct_id`) **in chronological order**.    - Allows analysis of user event sequences, e.g., finding the next event after a `login`.    - The reducer function's signature is `(state, events) => { ... }` where `state` is the previously returned value.    - Example:      ```js      .groupByUser([], function(state, events){        // examine event sequence...        // return an updated state.      });      ```  6. **sortAsc(accessor)** / **sortDesc(accessor)**:    - Sort the collection by an accessor property or function.    - Example:      ```js      .sortDesc("value")      ```  7. **flatten()**:    - Flattens arrays inside the collection into individual items.  -------------------------------------------------------------------------------------------- ## **BUILT-IN REDUCERS**  Reducers turn multiple items into a single value (for `.reduce()` or per-group in `.groupBy()`). Some commonly used:  1. **mixpanel.reducer.count()**    - Count the number of items.  2. **mixpanel.reducer.sum(accessor)** / **mixpanel.reducer.avg(accessor)**    - Sum or average numeric values. `accessor` can be a property string (e.g. 'properties.price') or a function.  3. **mixpanel.reducer.min(accessor)** / **mixpanel.reducer.max(accessor)**    - The min or max numeric value in a collection.  4. **mixpanel.reducer.min_by(accessor)** / **max_by(accessor)**    - Returns the item with the smallest/largest numeric accessor value.  5. **mixpanel.reducer.numeric_percentiles(accessor, [p1, p2, ...])**    - Approximate percentile values (e.g., 50th, 90th, etc.)  6. **mixpanel.reducer.top(N)**    - Returns the top N items by numeric `value`.  7. **mixpanel.reducer.any()** / **mixpanel.reducer.null()** / **mixpanel.reducer.object_merge()**    - `any()`: Returns any one item.    - `null()`: Always returns null.    - `object_merge()`: Merge multiple objects by summing numeric fields.  -------------------------------------------------------------------------------------------- ## **SEGMENTATION EXPRESSIONS**  When using `event_selectors` or `user_selectors`, or the optional `selectors` in `join()`, you can supply **Segmentation Expressions** to filter by properties. Common operators:  - `==`, `!=`, `>`, `>=`, `<`, `<=`, `in`, `and`, `or`, `not`  - Typecasts: `string(...)`, `number(...)`, `boolean(...)`  - Example: `properties["app_name"] == "gmail" and user["age"] > 30`  -------------------------------------------------------------------------------------------- ## **PARAMS**  You can pass a `params` object to the script. It's accessible inside `main()` via the global `params` variable. For example: ```js function main() {   return Events({     from_date: params.start_date,     to_date: params.end_date,     event_selectors: [{ event: params.eventName }]   }); } ``` This makes your query reusable for different date ranges or event names.  -------------------------------------------------------------------------------------------- ## **EXAMPLES**  1. **All events named 'SERVER_EXECUTE_ACTION_END' from last 7 days, filtering on `app_name=gmail`:** ```js function main() {   var now = new Date().getTime();   var sevenDaysAgo = now - (7 * 24 * 60 * 60 * 1000);   return Events()     .filter(e => e.name === 'SERVER_EXECUTE_ACTION_END'                && e.properties.app_name === 'gmail'                && e.time >= sevenDaysAgo); } ```  2. **Getting user profiles who signed up in 2024** ```js function main() {   return People()     .filter(u => {       var signup = new Date(u.properties.signup_date);       return signup.getFullYear() === 2024;     }); } ```  3. **Join users and events (inner join) for a date range, filter by US users over age 30, then group by event name** ```js function main() {   return join(     Events({ from_date: '2024-01-01', to_date: '2024-01-31' }),     People(),     {       type: 'inner',       selectors: [ { selector: 'properties[\"country\"] == "US" and user[\"age\"] > 30' } ]     }   )   .filter(tuple => tuple.event)   .groupBy([ev => ev.event.name], mixpanel.reducer.count()); } ```  4. **Counting events by user using `groupByUser`** ```js function main() {   return Events({     from_date: params.start_date,     to_date: params.end_date   })   .groupByUser(function(state, events) {     // 'state' is the accumulator for this user; 'events' is the next chunk (in time order)     state = state \|\| 0; // init state if undefined     return state + events.length; // increment by number of events in this chunk   }); } ```  5. **Combining transformations** ```js function main() {   return Events({     from_date: '2025-01-01',     to_date:   '2025-01-31',     event_selectors: [{ event: 'purchase' }]   })   .filter(e => e.properties.country === 'CA')   .map(e => e.properties.amount)   .reduce(mixpanel.reducer.sum()); } ```  -------------------------------------------------------------------------------------------- ### **IMPORTANT**: The final result returned by `main()` must be your final data. You can return:   - An array or list of objects.   - A single number (if you used `.reduce()` to a numeric total).   - A nested array if you used `.groupBy(...)`. --------------------------------------------------------------------------------------------  **Include `function main() { ... }` in its entirety** in this field. This ensures the Mixpanel JQL engine runs your code.  |
| `project_id` | integer | Yes | Required if using service account credentials or an API secret for authentication. |
| `workspace_id` | integer | No | The ID of the Mixpanel workspace, if applicable. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### List Saved Cohorts (Deprecated)

**Slug:** `MIXPANEL_LIST_COHORTS`

DEPRECATED: Use MIXPANEL_MIXPANEL_COHORTS_LIST instead. Get list of all cohorts in a Mixpanel project. Returns cohort details including name, id, count, description, creation date, and visibility. The Query API has a rate limit of 60 queries per hour and a maximum of 5 concurrent queries.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `project_id` | integer | Yes | The ID of the project to query. Required if using service account authentication. |
| `workspace_id` | integer | No | The ID of the workspace if applicable |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### List Saved Funnels

**Slug:** `MIXPANEL_LIST_FUNNELS`

Get the names and funnel_ids of your funnels. The Query API has a rate limit of 60 queries per hour and a maximum of 5 concurrent queries.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `project_id` | integer | Yes | Required if using service account to authenticate request |
| `workspace_id` | integer | No | The id of the workspace if applicable |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### List Saved Cohorts (Deprecated)

**Slug:** `MIXPANEL_LIST_SAVED_COHORTS`

DEPRECATED: Use MIXPANEL_MIXPANEL_COHORTS_LIST instead. Tool to list all saved cohorts in a Mixpanel project. Use when you need to retrieve cohort metadata including name, id, count, description, creation date, and visibility for every cohort in the project.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `project_id` | integer | Yes | The ID of the project to query. Required for listing cohorts. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### List Service Accounts

**Slug:** `MIXPANEL_LIST_SERVICE_ACCOUNTS`

Tool to list all service accounts for an organization. Use when you need to retrieve service accounts, check when they were last used, or see when they expire. Requires service account with admin or owner role.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `organization_id` | string | Yes | The unique identifier for the organization |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Append to Profile List Property

**Slug:** `MIXPANEL_PROFILE_APPEND_TO_LIST_PROPERTY`

Tool to append values to list properties on user profiles in Mixpanel. Use when you need to add items to list-type properties. Unlike $union, $append allows duplicate values. If the property doesn't exist, it creates a new list with the value as the first element.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | array | Yes | A list of profile update objects. Each object must contain $token, $distinct_id, and $append properties. |
| `verbose` | integer | No | When set to 1, returns detailed JSON response with status and error fields. When set to 0 (default), returns plain text status (1 for success, 0 for failure). |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Update Multiple Profiles (Batch)

**Slug:** `MIXPANEL_PROFILE_BATCH_UPDATE`

Tool to update multiple user profiles in Mixpanel in a single batch request. Use when you need to update properties for multiple users efficiently. Supports operations: $set (update/add), $set_once (set if not exists), $add (increment), $union (add to list uniquely), $append (append to list), $remove (remove from list), $unset (delete property), $delete (delete profile). Maximum 50 updates per request. Always check the response status and failed_records for individual update failures.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `profiles` | array | Yes | List of profile updates to send. Maximum 50 updates per request. Each profile must include $token and either $distinct_id or $user_id, plus at least one operation ($set, $set_once, $add, $union, $append, $remove, $unset, or $delete). |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Delete Profile Property (Deprecated)

**Slug:** `MIXPANEL_PROFILE_DELETE_PROPERTY`

DEPRECATED: Use MIXPANEL_DELETE_PROFILE_PROPERTY instead. Tool to permanently delete properties from a user profile in Mixpanel. Use when you need to remove specific properties and their values from a profile. This operation uses $unset and permanently removes properties that cannot be recovered. Useful when cleaning up properties or approaching Mixpanel's limit of 2000 properties per profile.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `ip` | string | No | IP address for request attribution. Set to '0' to not update geolocation data. |
| `time` | integer | No | Unix timestamp for when the operation occurred. |
| `token` | string | Yes | Project authentication token for API authentication. |
| `unset` | array | Yes | JSON list of property names to permanently remove from the profile. Properties are permanently deleted and cannot be recovered. |
| `distinct_id` | string | Yes | Unique identifier for the user profile to update. |
| `ignore_time` | boolean | No | If true, Mixpanel will not automatically update the 'Last Seen' property. |
| `ignore_alias` | boolean | No | If true, ignores alias processing and uses the distinct_id directly. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Get Profile Event Activity

**Slug:** `MIXPANEL_PROFILE_EVENT_ACTIVITY`

Get event activity feed for specified users from Mixpanel Query API. The Query API has a rate limit of 60 queries per hour and a maximum of 5 concurrent queries.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `to_date` | string | Yes | End date for the query (inclusive, format: YYYY-MM-DD) |
| `from_date` | string | Yes | Start date for the query (inclusive, format: YYYY-MM-DD) |
| `project_id` | integer | Yes | The ID of the project to query. Required if using service account authentication. |
| `distinct_ids` | array | Yes | List of distinct_ids to return activity feeds for |
| `workspace_id` | integer | No | The ID of the workspace if applicable |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Increment Profile Numerical Property

**Slug:** `MIXPANEL_PROFILE_NUMERICAL_ADD`

Tool to increment or decrement numerical properties on user profiles in Mixpanel. Use when you need to add values to existing numerical properties (e.g., login counts, points, credits). Properties are incremented by the specified amount. If a property doesn't exist, the value is added to zero. Use negative values to decrement properties.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `ip` | string | No | IP address for geolocation. Set to 0 or '0' to avoid updating location data. Defaults to the request IP address if not provided. |
| `add` | object | Yes | A JSON object containing property names as keys and numerical increment values. Properties will be incremented by the specified amount. If a property doesn't exist, the value is added to zero. Use negative values to decrement. |
| `time` | integer | No | Unix timestamp to override the time of the update. If not provided, uses current server time. |
| `token` | string | Yes | Your Mixpanel project authentication token |
| `verbose` | integer | No | When set to 1, returns detailed JSON response with status and error fields. When set to 0 (default), returns plain text status (1 for success, 0 for failure). |
| `distinct_id` | string | Yes | The unique identifier for the user profile |
| `ignore_time` | boolean | No | If true, prevents updating the 'Last Seen' property. Defaults to false. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Remove from Profile List Property

**Slug:** `MIXPANEL_PROFILE_REMOVE_FROM_LIST_PROPERTY`

Tool to remove values from list properties on user profiles in Mixpanel. Use when you need to remove specific items from list-type properties. If the value doesn't exist in the list, no updates are made. If the property doesn't exist or is not list-valued, the operation is ignored.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | array | Yes | A list of profile update objects. Each object must contain $token, $distinct_id, and $remove properties. |
| `verbose` | integer | No | When set to 1, returns detailed JSON response with status and error fields. When set to 0 (default), returns plain text status (1 for success, 0 for failure). |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Set Profile Properties

**Slug:** `MIXPANEL_PROFILE_SET`

Tool to set user profile properties in Mixpanel using the $set operation. Use when you need to create or update properties on a user profile. Properties specified will be created if they don't exist, or overwritten if they do. If the profile doesn't exist, it will be created with these properties.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `ip` | string | No | IP address for geolocation enrichment. Set to '0' to prevent updating geolocation data. If not provided, Mixpanel uses the request IP. Geolocation properties ($city, $region, mp_country_code) are derived and the IP is discarded. |
| `time` | integer | No | Unix timestamp (seconds since epoch) indicating when the profile update occurred. Defaults to the current server time if not provided. |
| `token` | string | Yes | Your Mixpanel project authentication token. Required for authenticating the request. |
| `distinct_id` | string | Yes | The unique identifier for the user profile to update. This determines which profile will be modified. |
| `ignore_time` | boolean | No | If true, prevents Mixpanel from automatically updating the 'Last Seen' property. Defaults to false. |
| `set_properties` | object | Yes | A dictionary of properties to set on the user profile. These properties will be created if they don't exist, or overwritten if they do. Common properties include 'name', 'email', 'status', etc. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Query Frequency Report

**Slug:** `MIXPANEL_QUERY_FREQUENCY_REPORT`

Get data about how frequently users are performing events. The Query API has a rate limit of 60 queries per hour and a maximum of 5 concurrent queries. Example response with unit="day" and addiction_unit="hour": { "2012-01-01": [305, 107, 60, 41, ...], # Users who did event in 1+ hours, 2+ hours, etc. "2012-01-02": [495, 204, 117, 77, ...], "2012-01-03": [671, 324, 176, 122, ...] }

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `on` | string | No | The property expression to segment the second event on |
| `unit` | string ("day" | "week" | "month") | Yes | The overall time period to return frequency of actions for |
| `event` | string | No | The event to generate returning counts for |
| `limit` | integer | No | Return the top limit segmentation values |
| `where` | string | No | An expression to filter the returning events by |
| `to_date` | string | Yes | The date in yyyy-mm-dd format to query to (inclusive) |
| `from_date` | string | Yes | The date in yyyy-mm-dd format to begin querying from (inclusive) |
| `project_id` | integer | Yes | Required if using service account to authenticate request |
| `workspace_id` | integer | No | The id of the workspace if applicable |
| `addiction_unit` | string ("hour" | "day") | Yes | The granularity to return frequency of actions at |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Query Saved Funnel

**Slug:** `MIXPANEL_QUERY_FUNNEL`

Get data for a funnel. The Query API has a rate limit of 60 queries per hour and a maximum of 5 concurrent queries.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `on` | string | No | The property expression to segment the event on |
| `unit` | string ("day" | "week" | "month") | No | Medium range time units for Mixpanel operations. |
| `limit` | integer | No | Return the top property values. Maximum value 10,000 |
| `where` | string | No | An expression to filter events by |
| `length` | integer | No | The number of units each user has to complete the funnel. May not be greater than 90 days |
| `to_date` | string | Yes | The date in yyyy-mm-dd format to query to (inclusive) |
| `interval` | integer | No | The number of days you want each bucket to contain |
| `from_date` | string | Yes | The date in yyyy-mm-dd format to begin querying from (inclusive) |
| `funnel_id` | integer | Yes | The funnel that you wish to get data for |
| `project_id` | integer | Yes | Required if using service account to authenticate request |
| `length_unit` | string ("second" | "minute" | "hour" | "day") | No | Extended time units including seconds for funnel analysis. |
| `workspace_id` | integer | No | The id of the workspace if applicable |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Query Saved Insight

**Slug:** `MIXPANEL_QUERY_INSIGHT`

Get data from your Insights reports. The Query API has a rate limit of 60 queries per hour and a maximum of 5 concurrent queries.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `project_id` | integer | Yes | Required if using service account to authenticate request Must match the configured connection region/cluster; a mismatch returns 'invalid project id for cluster'. |
| `bookmark_id` | integer | Yes | The ID of your Insights report |
| `workspace_id` | integer | No | The id of the workspace if applicable |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Get Top Event Names (Last 31 Days) (Deprecated)

**Slug:** `MIXPANEL_QUERY_MONTHS_TOP_EVENT_NAMES`

DEPRECATED: Use MIXPANEL_TOP_EVENTS instead. Get a list of the most common event names over the last 31 days. The Query API has a rate limit of 60 queries per hour and a maximum of 5 concurrent queries. Use when you need to discover what events are being tracked most frequently in your project.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `type` | string ("general" | "unique" | "average") | Yes | The analysis type for the query - general, unique, or average |
| `limit` | integer | No | Maximum number of event names to return. Default is 255 |
| `project_id` | integer | Yes | The project identifier. Required if using service account to authenticate request |
| `workspace_id` | integer | No | The workspace identifier. Required only for projects with Data Views enabled |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Query Numeric Average Report

**Slug:** `MIXPANEL_QUERY_NUMERIC_AVERAGE`

Averages an expression for events per unit time. The Query API has a rate limit of 60 queries per hour and a maximum of 5 concurrent queries. Example response: { "status": "ok", "results": { "2024-01-01": 25.5, "2024-01-02": 32.75, "2024-01-03": 28.25 } }

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `on` | string | Yes | The numeric expression to average per unit time (should evaluate to a number) |
| `unit` | string ("hour" | "day") | No | Shorter time units for certain Mixpanel operations. |
| `event` | string | Yes | The event to get data for (single event name) |
| `where` | string | No | An expression to filter events by |
| `to_date` | string | Yes | The date in yyyy-mm-dd format to query to (inclusive) |
| `from_date` | string | Yes | The date in yyyy-mm-dd format to begin querying from (inclusive) |
| `project_id` | integer | Yes | Required if using service account to authenticate request |
| `workspace_id` | integer | No | The id of the workspace if applicable |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Query Numeric Sum Report

**Slug:** `MIXPANEL_QUERY_NUMERIC_SUM`

Sums an expression for events per unit time. The Query API has a rate limit of 60 queries per hour and a maximum of 5 concurrent queries. Example response: { "status": "ok", "computed_at": "2024-01-20T12:00:00", "results": { "2024-01-01": 150.5, "2024-01-02": 245.75, "2024-01-03": 198.25 } }

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `on` | string | Yes | The numeric expression to sum per unit time (should evaluate to a number) |
| `unit` | string ("hour" | "day") | No | Shorter time units for certain Mixpanel operations. |
| `event` | string | Yes | The event to get data for (single event name) |
| `where` | string | No | An expression to filter events by |
| `to_date` | string | Yes | The date in yyyy-mm-dd format to query to (inclusive) |
| `from_date` | string | Yes | The date in yyyy-mm-dd format to begin querying from (inclusive) |
| `project_id` | integer | Yes | Required if using service account to authenticate request |
| `workspace_id` | integer | No | The id of the workspace if applicable |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Query Profiles

**Slug:** `MIXPANEL_QUERY_PROFILES`

Query user or group profile data from Mixpanel. Returns list of profiles that match specified parameters. The Query API has a rate limit of 60 queries per hour and a maximum of 5 concurrent queries.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `page` | integer | No | Which page of results to retrieve (starts at 0) |
| `where` | string | No | An expression to filter users (or groups) by |
| `behaviors` | integer | No | Required when using event selector for user profiles |
| `project_id` | integer | Yes | The ID of the project to query. Required if using service account authentication. |
| `session_id` | string | No | Session ID from a previous query for pagination |
| `distinct_id` | string | No | A unique identifier used to distinguish an individual profile |
| `distinct_ids` | array | No | A list of distinct_ids to retrieve profiles for |
| `workspace_id` | integer | No | The ID of the workspace if applicable |
| `data_group_id` | string | No | The ID of the group key, used when querying group profiles |
| `as_of_timestamp` | integer | No | Used with behaviors parameter for large exports |
| `filter_by_cohort` | object | No | Filter by cohort ID. Example: {'id': 12345} |
| `include_all_users` | boolean | No | When using filter_by_cohort, whether to include all distinct_ids even without profiles |
| `output_properties` | array | No | List of property names to return in the response |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Query Retention Report

**Slug:** `MIXPANEL_QUERY_RETENTION_REPORT`

Query cohort analysis showing user retention patterns over time. Tracks how users who performed an initial event (born_event) subsequently perform a target event (event). Use the 'unit' parameter to control cohort interval granularity ('day', 'week', 'month'); defaults to 'day'.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `on` | string | No | Property expression for segmentation (segments results by specified property) |
| `unit` | string ("day" | "week" | "month") | No | Medium range time units for Mixpanel operations. |
| `event` | string | No | The target event to measure retention against |
| `limit` | integer | No | Maximum number of top segmentation values to return (only valid with 'on' parameter) |
| `where` | string | No | Filter expression for event (see Mixpanel expressions documentation) |
| `to_date` | string | Yes | End date for the query range in YYYY-MM-DD format (inclusive) |
| `from_date` | string | Yes | Start date for the query range in YYYY-MM-DD format (inclusive) |
| `born_event` | string | No | The initial event that defines the cohort entry (required when retention_type='birth') |
| `born_where` | string | No | Filter expression for born_event (see Mixpanel expressions documentation) |
| `project_id` | integer | Yes | Project identifier (required when using service account authentication) |
| `workspace_id` | integer | No | Workspace identifier if applicable |
| `interval_count` | integer | No | Number of individual buckets/intervals to return |
| `retention_type` | string ("birth" | "compounded") | No | Type of retention analysis: 'birth' for first-time retention or 'compounded' for recurring retention |
| `unbounded_retention` | boolean | No | When true, uses accumulation method where values accumulate from right to left |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Query Segmentation Report

**Slug:** `MIXPANEL_QUERY_SEGMENTATION`

Get data for an event, segmented and filtered by properties with daily/time-series breakdown. Use the 'unit' parameter to control time bucketing ('minute', 'hour', 'day', 'month'). The Query API has a rate limit of 60 queries per hour and 5 concurrent queries, shared across related tools (e.g., MIXPANEL_JQL_QUERY, MIXPANEL_TOP_EVENT_PROPERTY_VALUES); bursts of concurrent calls return 429.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `on` | string | No | The property expression to segment the event on Properties unset for many events produce 'undefined' segment buckets; interpret as missing instrumentation, not zero traffic. |
| `type` | string ("general" | "unique" | "average") | No | Analysis types for Mixpanel event aggregation. |
| `unit` | string ("minute" | "hour" | "day" | "month") | No | Time units for segmentation queries. |
| `event` | string | Yes | The event to get data for (single event name) |
| `limit` | integer | No | Return the top N property values (max 10000) |
| `where` | string | No | An expression to filter events by |
| `to_date` | string | Yes | The date in yyyy-mm-dd format to query to (inclusive) |
| `from_date` | string | Yes | The date in yyyy-mm-dd format to begin querying from (inclusive) Use project timezone to avoid off-by-one-day range errors; reversed or overly narrow ranges yield empty results. |
| `project_id` | integer | Yes | Required if using service account to authenticate request Region mismatch between the Mixpanel connection and the project's cluster returns 'invalid project id for cluster'; verify region before querying. |
| `workspace_id` | integer | No | The id of the workspace if applicable |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Query Top Events

**Slug:** `MIXPANEL_QUERY_TOP_EVENTS`

Get the top events for today, with their counts and the normalized percent change from yesterday. Use when you need to analyze today's event performance compared to yesterday.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `type` | string ("general" | "unique" | "average") | Yes | The analysis type - general, unique, or average |
| `limit` | integer | No | Maximum number of events to return |
| `project_id` | integer | Yes | The project identifier. Required if using service account to authenticate request |
| `workspace_id` | integer | No | The workspace identifier if applicable |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Remove from Group List Property

**Slug:** `MIXPANEL_REMOVE_FROM_GROUP_LIST_PROPERTY`

Tool to remove values from list properties on group profiles in Mixpanel. Use when you need to remove specific items from list-type properties on groups (companies, organizations, etc.). If the value doesn't exist in the list, no updates are made. If the property doesn't exist or is not list-valued, the operation is ignored.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | array | Yes | A list of group profile update objects. Each object must contain $token, $group_key, $group_id, and $remove properties. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Remove from Profile List Property

**Slug:** `MIXPANEL_REMOVE_FROM_LIST_PROPERTY`

Tool to remove values from list properties on user profiles in Mixpanel using the $remove operation. Use when you need to remove specific items from list-type properties. If the value doesn't exist in the list, no action is taken. The profile will be created if it doesn't exist.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `ip` | string | No | IP address for geolocation enrichment. Set to '0' to prevent updating geolocation data. If not provided, Mixpanel uses the request IP. Geolocation properties ($city, $region, mp_country_code) are derived and the IP is discarded. |
| `time` | integer | No | Unix timestamp (seconds since epoch) indicating when the profile update occurred. Defaults to the current server time if not provided. |
| `token` | string | Yes | Your Mixpanel project authentication token. Required for authenticating the request. |
| `distinct_id` | string | Yes | The unique identifier for the user profile to update. This determines which profile will be modified. |
| `ignore_time` | boolean | No | If true, prevents Mixpanel from automatically updating the 'Last Seen' property. Defaults to false. |
| `remove_properties` | object | Yes | A dictionary of list properties and values to remove. Each key is a property name and each value is the item to remove from that list property. If the value doesn't exist in the list, no action is taken. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Numeric Bucket Segmentation Query

**Slug:** `MIXPANEL_SEGMENTATION_NUMERIC_QUERY`

Tool to get event data numerically bucketed by property values. Use when you need to analyze distributions of numeric properties like revenue, session duration, or counts with automatic bucketing.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `on` | string | Yes | The numeric property expression to bucket by. Use format like 'number(property_name)' or numeric expressions |
| `type` | string ("general" | "unique" | "average") | No | Analysis types for Mixpanel event aggregation. |
| `unit` | string ("hour" | "day" | "week" | "month") | No | Longer time units for certain analytics. |
| `event` | string | Yes | The event name to get data for |
| `where` | string | No | An expression to filter events by (e.g., 'properties["country"] == "US"') |
| `to_date` | string | Yes | The date in yyyy-mm-dd format to query to (inclusive) |
| `from_date` | string | Yes | The date in yyyy-mm-dd format to begin querying from (inclusive) |
| `project_id` | integer | Yes | Required if using service account to authenticate request |
| `bucket_size` | integer | No | Size of numeric buckets for grouping values. If not specified, Mixpanel will automatically determine bucket size |
| `workspace_id` | integer | No | The id of the workspace if applicable |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Set Group Property Once

**Slug:** `MIXPANEL_SET_GROUP_PROPERTY_ONCE`

Tool to set properties on a Mixpanel group profile only if they don't already exist. Use when you need to set initial properties for a group without overwriting existing values. Ideal for setting default values or tracking when a group was first created. Properties that already exist will not be modified.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `token` | string | Yes | Project authentication token for Mixpanel API authentication |
| `group_id` | string | Yes | Unique identifier for the specific group instance |
| `group_key` | string | Yes | Group type identifier (e.g., 'Company', 'Organization', 'Team'). This defines the category of the group. |
| `properties` | object | Yes | Key-value pairs of properties to set on the group profile. Properties will only be set if they don't already exist on the group. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Set Profile Property Once

**Slug:** `MIXPANEL_SET_PROFILE_PROPERTY_ONCE`

Tool to set user profile properties in Mixpanel using the $set_once operation. Use when you need to set properties that should only be recorded on their initial value. Properties specified will be created only if they don't already exist on the profile. If a property already has a value, it will not be overwritten. Ideal for tracking first-time values like signup source, initial referrer, or first login date.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `ip` | string | No | IP address for geolocation enrichment. Set to '0' to prevent updating geolocation data. If not provided, Mixpanel uses the request IP. Geolocation properties ($city, $region, mp_country_code) are derived and the IP is discarded. |
| `time` | integer | No | Unix timestamp (seconds since epoch) indicating when the profile update occurred. Defaults to the current server time if not provided. |
| `token` | string | Yes | Your Mixpanel project authentication token. Required for authenticating the request. |
| `distinct_id` | string | Yes | The unique identifier for the user profile to update. This determines which profile will be modified. |
| `ignore_time` | boolean | No | If true, prevents Mixpanel from automatically updating the 'Last Seen' property. Defaults to false. |
| `set_once_properties` | object | Yes | A dictionary of properties to set on the user profile only if they don't already exist. If a property already has a value, it will not be overwritten. Useful for tracking initial values like 'First Login', 'Signup Source', 'Initial Referrer', etc. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Get Today's Top Events (Deprecated)

**Slug:** `MIXPANEL_TODAYS_TOP_EVENTS`

DEPRECATED: Use MIXPANEL_QUERY_TOP_EVENTS instead. Get the top events for today, with their counts and the normalized percent change from yesterday. The Query API has a rate limit of 60 queries per hour and a maximum of 5 concurrent queries.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `type` | string ("general" | "unique" | "average") | Yes | The analysis type you would like to get data for - such as general, unique, or average events |
| `limit` | integer | No | The maximum number of events to return |
| `project_id` | integer | Yes | Required if using service account to authenticate request |
| `workspace_id` | integer | No | The id of the workspace if applicable |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Get Top Event Properties

**Slug:** `MIXPANEL_TOP_EVENT_PROPERTIES`

Get the top property names for an event. The Query API has a rate limit of 60 queries per hour and a maximum of 5 concurrent queries.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `event` | string | Yes | The event that you wish to get data for. Note: this is a single event name, not an array |
| `limit` | integer | No | The maximum number of properties to return |
| `project_id` | integer | Yes | Required if using service account to authenticate request |
| `workspace_id` | integer | No | The id of the workspace if applicable |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Get Top Event Property Values

**Slug:** `MIXPANEL_TOP_EVENT_PROPERTY_VALUES`

Tool to get the top values for a property ordered by frequency. Use when you need to understand the most common values for a specific property on an event. The Query API has a rate limit of 60 queries per hour and a maximum of 5 concurrent queries. This limit is shared across all Query API tools (e.g., MIXPANEL_QUERY_SEGMENTATION); on a 429 response, apply exponential backoff.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `name` | string | Yes | The name of the property you would like to get data for |
| `event` | string | Yes | The event that you wish to get data for. Note: this is a single event name, not an array |
| `limit` | integer | No | The maximum number of values to return |
| `project_id` | integer | Yes | Required if using service account to authenticate request |
| `workspace_id` | integer | No | The id of the workspace if applicable |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Get Top Events

**Slug:** `MIXPANEL_TOP_EVENTS`

Get a list of the most common events over the last 31 days. The Query API has a rate limit of 60 queries per hour and a maximum of 5 concurrent queries.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `type` | string ("general" | "unique" | "average") | Yes | The analysis type you would like to get data for - such as general, unique, or average events |
| `limit` | integer | No | The maximum number of values to return |
| `project_id` | integer | Yes | Required if using service account to authenticate request |
| `workspace_id` | integer | No | The id of the workspace if applicable |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Union to Group List Property

**Slug:** `MIXPANEL_UPDATE_GROUP_LIST_PROPERTY`

Tool to add unique values to list properties on group profiles in Mixpanel. Use when you need to add items to list-type group properties without creating duplicates. The $union operation ensures that values are only added if they don't already exist in the list.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `ip` | integer | No | Controls geolocation parsing. Set to 0 to disable, 1 to enable. If not provided, defaults to request IP. |
| `data` | array | Yes | A list of group union update objects. Each object must contain $token, $group_key, $group_id, and $union properties. |
| `strict` | integer | No | Enables validation with error messages. Set to 1 to enable strict mode, 0 to disable. |
| `verbose` | integer | No | Returns detailed operation success/failure information. Set to 1 for detailed response, 0 for simple response. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |
