Result Types¶
Explore on DeepWiki
Ask questions about result structures, DataFrame conversion, or type usage patterns.
All result types are immutable frozen dataclasses with:
- Lazy DataFrame conversion via the
.dfproperty - JSON serialization via the
.to_dict()method - Full type hints for IDE/mypy support
App API Types¶
Types for the Mixpanel App API infrastructure.
mixpanel_data.PublicWorkspace
¶
Bases: BaseModel
A workspace within a Mixpanel project.
Represents a workspace as returned by the Mixpanel App API
GET /api/app/projects/{pid}/workspaces/public endpoint.
Extra fields from the API response are preserved via extra="allow".
| ATTRIBUTE | DESCRIPTION |
|---|---|
id |
Workspace identifier.
TYPE:
|
name |
Human-readable workspace name.
TYPE:
|
project_id |
Parent project identifier.
TYPE:
|
is_default |
Whether this is the default workspace.
TYPE:
|
description |
Workspace description, if set.
TYPE:
|
is_global |
Whether workspace is global.
TYPE:
|
is_restricted |
Whether workspace has restrictions.
TYPE:
|
is_visible |
Whether workspace is visible.
TYPE:
|
created_iso |
ISO 8601 creation timestamp.
TYPE:
|
creator_name |
Name of workspace creator.
TYPE:
|
Example
description
class-attribute
instance-attribute
¶
Workspace description, if set.
is_global
class-attribute
instance-attribute
¶
Whether workspace is global.
is_restricted
class-attribute
instance-attribute
¶
Whether workspace has restrictions.
is_visible
class-attribute
instance-attribute
¶
Whether workspace is visible.
created_iso
class-attribute
instance-attribute
¶
ISO 8601 creation timestamp.
creator_name
class-attribute
instance-attribute
¶
Name of workspace creator.
mixpanel_data.CursorPagination
¶
Bases: BaseModel
Cursor-based pagination metadata from App API responses.
| ATTRIBUTE | DESCRIPTION |
|---|---|
page_size |
Number of items per page.
TYPE:
|
next_cursor |
Cursor for next page, or None if last page.
TYPE:
|
previous_cursor |
Cursor for previous page.
TYPE:
|
Example
mixpanel_data.PaginatedResponse
¶
Bases: BaseModel, Generic[T]
Paginated App API response wrapper.
Generic wrapper for paginated responses from the Mixpanel App API. Contains the results list, status, and optional pagination metadata.
| ATTRIBUTE | DESCRIPTION |
|---|---|
status |
Response status (typically "ok").
TYPE:
|
results |
Page of results.
TYPE:
|
pagination |
Pagination metadata, or None for single-page responses.
TYPE:
|
Example
Insights Query Types¶
Types for Workspace.query() — typed Insights engine queries with composable metrics, filters, and breakdowns.
mixpanel_data.Metric
dataclass
¶
Metric(
event: str,
math: MathType = "total",
property: str | CustomPropertyRef | InlineCustomProperty | None = None,
per_user: PerUserAggregation | None = None,
percentile_value: int | float | None = None,
filters: list[Filter] | None = None,
filters_combinator: FiltersCombinator = "all",
segment_method: SegmentMethod | None = None,
)
Encapsulates a single event to query with its aggregation settings.
Used with Workspace.query() to specify per-event math, property,
per-user aggregation, and filters. Plain event name strings inherit
top-level query defaults; Metric objects override them.
| ATTRIBUTE | DESCRIPTION |
|---|---|
event |
Mixpanel event name.
TYPE:
|
math |
Aggregation function. Default:
TYPE:
|
property |
Property for property-based math types (name, ref, or inline).
TYPE:
|
per_user |
Per-user pre-aggregation (average, total, min, max).
TYPE:
|
filters |
Per-metric filters (applied in addition to global
TYPE:
|
filters_combinator |
How per-metric filters combine.
TYPE:
|
Example
property
class-attribute
instance-attribute
¶
Property for property-based math types (name, ref, or inline).
per_user
class-attribute
instance-attribute
¶
Per-user pre-aggregation type.
percentile_value
class-attribute
instance-attribute
¶
Custom percentile value (e.g. 95 for p95).
Required when math="percentile". Ignored for other math types.
Maps to percentile in bookmark JSON.
filters
class-attribute
instance-attribute
¶
Per-metric filters (list of Filter objects).
filters_combinator
class-attribute
instance-attribute
¶
How per-metric filters combine ("all" = AND, "any" = OR).
segment_method
class-attribute
instance-attribute
¶
Segment method for counting qualifying events.
Controls how events are counted per user: "all" counts every
qualifying event (default server behavior), "first" counts
only the first qualifying event per user.
Maps to segmentMethod in the bookmark measurement block.
__post_init__
¶
Validate construction arguments.
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If event is empty or contains control characters (M1), math requires a property but none is set (M2), or math="percentile" but percentile_value is missing (M3). |
Source code in src/mixpanel_data/types.py
mixpanel_data.Formula
dataclass
¶
A formula expression referencing events by position letter (A, B, C...).
Letters map to event positions in the list passed to
Workspace.query(). A is the first event, B the second, etc.
Can be passed as an element of the events list alongside strings
and Metric objects, or use the top-level formula parameter
for single-formula convenience.
| ATTRIBUTE | DESCRIPTION |
|---|---|
expression |
Formula expression, e.g.
TYPE:
|
label |
Optional display label for the formula result.
TYPE:
|
Example
from mixpanel_data import Formula, Metric
# Formula in the events list
result = ws.query(
[Metric("Signup", math="unique"),
Metric("Purchase", math="unique"),
Formula("(B / A) * 100", label="Conversion %")],
)
# Equivalent using top-level parameter
result = ws.query(
[Metric("Signup", math="unique"),
Metric("Purchase", math="unique")],
formula="(B / A) * 100",
formula_label="Conversion %",
)
mixpanel_data.Filter
dataclass
¶
Filter(
_property: str | CustomPropertyRef | InlineCustomProperty,
_operator: FilterOperator,
_value: str
| int
| float
| list[str]
| list[int | float]
| list[dict[str, Any]]
| None,
_property_type: FilterPropertyType = "string",
_resource_type: Literal["events", "people"] = "events",
_date_unit: FilterDateUnit | None = None,
_list_item_filters: tuple[Filter, ...] | None = None,
_list_item_quantifier: Literal["any", "all"] | None = None,
)
Represents a typed filter condition on a property.
Constructed exclusively via class methods — never instantiated directly. Each class method maps to specific filterType, filterOperator, and filterValue format in the bookmark JSON.
Example
__post_init__
¶
Validate Filter mode invariants.
Only validates the list_contains mode today. Other operator
modes rely on classmethod-only validation; expanding this
coverage is a separate concern from this PR's list_contains
feature.
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If |
Source code in src/mixpanel_data/types.py
equals
classmethod
¶
equals(
property: str | CustomPropertyRef | InlineCustomProperty,
value: str | list[str],
*,
resource_type: Literal["events", "people"] = "events",
) -> Filter
Create an equality filter.
| PARAMETER | DESCRIPTION |
|---|---|
property
|
Property name, CustomPropertyRef, or InlineCustomProperty.
TYPE:
|
value
|
Value or list of values.
TYPE:
|
resource_type
|
Resource type. Default:
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Filter
|
Filter for string equality. |
Source code in src/mixpanel_data/types.py
not_equals
classmethod
¶
not_equals(
property: str | CustomPropertyRef | InlineCustomProperty,
value: str | list[str],
*,
resource_type: Literal["events", "people"] = "events",
) -> Filter
Create a not-equals filter.
| PARAMETER | DESCRIPTION |
|---|---|
property
|
Property name, CustomPropertyRef, or InlineCustomProperty.
TYPE:
|
value
|
Value or list of values.
TYPE:
|
resource_type
|
Resource type. Default:
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Filter
|
Filter for string inequality. |
Source code in src/mixpanel_data/types.py
contains
classmethod
¶
contains(
property: str | CustomPropertyRef | InlineCustomProperty,
value: str,
*,
resource_type: Literal["events", "people"] = "events",
) -> Filter
Create a contains (substring) filter.
| PARAMETER | DESCRIPTION |
|---|---|
property
|
Property name, CustomPropertyRef, or InlineCustomProperty.
TYPE:
|
value
|
Substring to match.
TYPE:
|
resource_type
|
Resource type. Default:
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Filter
|
Filter for substring containment. |
Source code in src/mixpanel_data/types.py
not_contains
classmethod
¶
not_contains(
property: str | CustomPropertyRef | InlineCustomProperty,
value: str,
*,
resource_type: Literal["events", "people"] = "events",
) -> Filter
Create a not-contains filter.
| PARAMETER | DESCRIPTION |
|---|---|
property
|
Property name, CustomPropertyRef, or InlineCustomProperty.
TYPE:
|
value
|
Substring that must not match.
TYPE:
|
resource_type
|
Resource type. Default:
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Filter
|
Filter for substring non-containment. |
Source code in src/mixpanel_data/types.py
greater_than
classmethod
¶
greater_than(
property: str | CustomPropertyRef | InlineCustomProperty,
value: int | float,
*,
resource_type: Literal["events", "people"] = "events",
) -> Filter
Create a greater-than filter.
| PARAMETER | DESCRIPTION |
|---|---|
property
|
Property name, CustomPropertyRef, or InlineCustomProperty.
TYPE:
|
value
|
Numeric threshold.
TYPE:
|
resource_type
|
Resource type. Default:
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Filter
|
Filter for numeric greater-than. |
Source code in src/mixpanel_data/types.py
less_than
classmethod
¶
less_than(
property: str | CustomPropertyRef | InlineCustomProperty,
value: int | float,
*,
resource_type: Literal["events", "people"] = "events",
) -> Filter
Create a less-than filter.
| PARAMETER | DESCRIPTION |
|---|---|
property
|
Property name, CustomPropertyRef, or InlineCustomProperty.
TYPE:
|
value
|
Numeric threshold.
TYPE:
|
resource_type
|
Resource type. Default:
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Filter
|
Filter for numeric less-than. |
Source code in src/mixpanel_data/types.py
between
classmethod
¶
between(
property: str | CustomPropertyRef | InlineCustomProperty,
min_val: int | float,
max_val: int | float,
*,
resource_type: Literal["events", "people"] = "events",
) -> Filter
Create a between (inclusive range) filter.
| PARAMETER | DESCRIPTION |
|---|---|
property
|
Property name, CustomPropertyRef, or InlineCustomProperty.
TYPE:
|
min_val
|
Minimum value (inclusive).
TYPE:
|
max_val
|
Maximum value (inclusive).
TYPE:
|
resource_type
|
Resource type. Default:
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Filter
|
Filter for numeric range. |
Source code in src/mixpanel_data/types.py
not_between
classmethod
¶
not_between(
property: str | CustomPropertyRef | InlineCustomProperty,
min_val: int | float,
max_val: int | float,
*,
resource_type: Literal["events", "people"] = "events",
) -> Filter
Create a not-between (exclusive range) filter.
| PARAMETER | DESCRIPTION |
|---|---|
property
|
Property name, CustomPropertyRef, or InlineCustomProperty.
TYPE:
|
min_val
|
Minimum value (exclusive).
TYPE:
|
max_val
|
Maximum value (exclusive).
TYPE:
|
resource_type
|
Resource type. Default:
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Filter
|
Filter for numeric values outside the range. |
Source code in src/mixpanel_data/types.py
at_least
classmethod
¶
at_least(
property: str | CustomPropertyRef | InlineCustomProperty,
value: int | float,
*,
resource_type: Literal["events", "people"] = "events",
) -> Filter
Create a greater-than-or-equal filter.
| PARAMETER | DESCRIPTION |
|---|---|
property
|
Property name, CustomPropertyRef, or InlineCustomProperty.
TYPE:
|
value
|
Numeric threshold (inclusive).
TYPE:
|
resource_type
|
Resource type. Default:
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Filter
|
Filter for numeric greater-than-or-equal. |
Source code in src/mixpanel_data/types.py
at_most
classmethod
¶
at_most(
property: str | CustomPropertyRef | InlineCustomProperty,
value: int | float,
*,
resource_type: Literal["events", "people"] = "events",
) -> Filter
Create a less-than-or-equal filter.
| PARAMETER | DESCRIPTION |
|---|---|
property
|
Property name, CustomPropertyRef, or InlineCustomProperty.
TYPE:
|
value
|
Numeric threshold (inclusive).
TYPE:
|
resource_type
|
Resource type. Default:
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Filter
|
Filter for numeric less-than-or-equal. |
Source code in src/mixpanel_data/types.py
is_set
classmethod
¶
is_set(
property: str | CustomPropertyRef | InlineCustomProperty,
*,
resource_type: Literal["events", "people"] = "events",
) -> Filter
Create a property-existence filter.
| PARAMETER | DESCRIPTION |
|---|---|
property
|
Property name, CustomPropertyRef, or InlineCustomProperty.
TYPE:
|
resource_type
|
Resource type. Default:
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Filter
|
Filter for property existence. |
Source code in src/mixpanel_data/types.py
is_not_set
classmethod
¶
is_not_set(
property: str | CustomPropertyRef | InlineCustomProperty,
*,
resource_type: Literal["events", "people"] = "events",
) -> Filter
Create a property-nonexistence filter.
| PARAMETER | DESCRIPTION |
|---|---|
property
|
Property name, CustomPropertyRef, or InlineCustomProperty.
TYPE:
|
resource_type
|
Resource type. Default:
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Filter
|
Filter for property non-existence. |
Source code in src/mixpanel_data/types.py
starts_with
classmethod
¶
starts_with(
property: str | CustomPropertyRef | InlineCustomProperty,
prefix: str,
*,
resource_type: Literal["events", "people"] = "events",
) -> Filter
Create a starts-with (prefix match) filter.
| PARAMETER | DESCRIPTION |
|---|---|
property
|
Property name, CustomPropertyRef, or InlineCustomProperty.
TYPE:
|
prefix
|
String prefix to match.
TYPE:
|
resource_type
|
Resource type. Default:
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Filter
|
Filter for string prefix matching. |
Source code in src/mixpanel_data/types.py
ends_with
classmethod
¶
ends_with(
property: str | CustomPropertyRef | InlineCustomProperty,
suffix: str,
*,
resource_type: Literal["events", "people"] = "events",
) -> Filter
Create an ends-with (suffix match) filter.
| PARAMETER | DESCRIPTION |
|---|---|
property
|
Property name, CustomPropertyRef, or InlineCustomProperty.
TYPE:
|
suffix
|
String suffix to match.
TYPE:
|
resource_type
|
Resource type. Default:
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Filter
|
Filter for string suffix matching. |
Source code in src/mixpanel_data/types.py
is_true
classmethod
¶
is_true(
property: str | CustomPropertyRef | InlineCustomProperty,
*,
resource_type: Literal["events", "people"] = "events",
) -> Filter
Create a boolean true filter.
| PARAMETER | DESCRIPTION |
|---|---|
property
|
Property name, CustomPropertyRef, or InlineCustomProperty.
TYPE:
|
resource_type
|
Resource type. Default:
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Filter
|
Filter for boolean true. |
Source code in src/mixpanel_data/types.py
is_false
classmethod
¶
is_false(
property: str | CustomPropertyRef | InlineCustomProperty,
*,
resource_type: Literal["events", "people"] = "events",
) -> Filter
Create a boolean false filter.
| PARAMETER | DESCRIPTION |
|---|---|
property
|
Property name, CustomPropertyRef, or InlineCustomProperty.
TYPE:
|
resource_type
|
Resource type. Default:
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Filter
|
Filter for boolean false. |
Source code in src/mixpanel_data/types.py
in_cohort
classmethod
¶
Create a filter restricting to users in a cohort.
Accepts either a saved cohort ID (int) or an inline
CohortDefinition. The filter can be passed to where=
on any query method (query, query_funnel,
query_retention, query_flow).
| PARAMETER | DESCRIPTION |
|---|---|
cohort
|
Saved cohort ID (positive integer) or inline
TYPE:
|
name
|
Display name for the cohort. Optional for saved cohorts; recommended for inline definitions.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Filter
|
Filter for cohort membership (contains). |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If cohort ID is not positive (CF1) or name is empty when provided (CF2). |
Example
Source code in src/mixpanel_data/types.py
not_in_cohort
classmethod
¶
Create a filter excluding users in a cohort.
Accepts either a saved cohort ID (int) or an inline
CohortDefinition. The filter can be passed to where=
on any query method.
| PARAMETER | DESCRIPTION |
|---|---|
cohort
|
Saved cohort ID (positive integer) or inline
TYPE:
|
name
|
Display name for the cohort. Optional for saved cohorts; recommended for inline definitions.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Filter
|
Filter for cohort exclusion (does not contain). |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If cohort ID is not positive (CF1) or name is empty when provided (CF2). |
Source code in src/mixpanel_data/types.py
on
classmethod
¶
on(
property: str | CustomPropertyRef | InlineCustomProperty,
date: str,
*,
resource_type: Literal["events", "people"] = "events",
) -> Filter
Create a date equality filter (exact date match).
| PARAMETER | DESCRIPTION |
|---|---|
property
|
Property name, CustomPropertyRef, or InlineCustomProperty (e.g.
TYPE:
|
date
|
Date in YYYY-MM-DD format.
TYPE:
|
resource_type
|
Resource type. Default:
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Filter
|
Filter for exact date match. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If date is not valid YYYY-MM-DD. |
Source code in src/mixpanel_data/types.py
not_on
classmethod
¶
not_on(
property: str | CustomPropertyRef | InlineCustomProperty,
date: str,
*,
resource_type: Literal["events", "people"] = "events",
) -> Filter
Create a date inequality filter (not on date).
| PARAMETER | DESCRIPTION |
|---|---|
property
|
Property name, CustomPropertyRef, or InlineCustomProperty.
TYPE:
|
date
|
Date in YYYY-MM-DD format.
TYPE:
|
resource_type
|
Resource type. Default:
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Filter
|
Filter for date inequality. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If date is not valid YYYY-MM-DD. |
Source code in src/mixpanel_data/types.py
before
classmethod
¶
before(
property: str | CustomPropertyRef | InlineCustomProperty,
date: str,
*,
resource_type: Literal["events", "people"] = "events",
) -> Filter
Create a date before filter.
| PARAMETER | DESCRIPTION |
|---|---|
property
|
Property name, CustomPropertyRef, or InlineCustomProperty.
TYPE:
|
date
|
Date in YYYY-MM-DD format.
TYPE:
|
resource_type
|
Resource type. Default:
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Filter
|
Filter for dates before the specified date. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If date is not valid YYYY-MM-DD. |
Source code in src/mixpanel_data/types.py
since
classmethod
¶
since(
property: str | CustomPropertyRef | InlineCustomProperty,
date: str,
*,
resource_type: Literal["events", "people"] = "events",
) -> Filter
Create a date since filter (from date onward).
| PARAMETER | DESCRIPTION |
|---|---|
property
|
Property name, CustomPropertyRef, or InlineCustomProperty.
TYPE:
|
date
|
Date in YYYY-MM-DD format.
TYPE:
|
resource_type
|
Resource type. Default:
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Filter
|
Filter for dates on or after the specified date. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If date is not valid YYYY-MM-DD. |
Source code in src/mixpanel_data/types.py
in_the_last
classmethod
¶
in_the_last(
property: str | CustomPropertyRef | InlineCustomProperty,
quantity: int,
date_unit: FilterDateUnit,
*,
resource_type: Literal["events", "people"] = "events",
) -> Filter
Create a relative date filter (in the last N units).
| PARAMETER | DESCRIPTION |
|---|---|
property
|
Property name, CustomPropertyRef, or InlineCustomProperty.
TYPE:
|
quantity
|
Number of time units (must be positive).
TYPE:
|
date_unit
|
Time unit (
TYPE:
|
resource_type
|
Resource type. Default:
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Filter
|
Filter for events within the last N units. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If quantity is not positive. |
Source code in src/mixpanel_data/types.py
not_in_the_last
classmethod
¶
not_in_the_last(
property: str | CustomPropertyRef | InlineCustomProperty,
quantity: int,
date_unit: FilterDateUnit,
*,
resource_type: Literal["events", "people"] = "events",
) -> Filter
Create a relative date exclusion filter (not in the last N units).
| PARAMETER | DESCRIPTION |
|---|---|
property
|
Property name, CustomPropertyRef, or InlineCustomProperty.
TYPE:
|
quantity
|
Number of time units (must be positive).
TYPE:
|
date_unit
|
Time unit (
TYPE:
|
resource_type
|
Resource type. Default:
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Filter
|
Filter for events NOT within the last N units. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If quantity is not positive. |
Source code in src/mixpanel_data/types.py
date_between
classmethod
¶
date_between(
property: str | CustomPropertyRef | InlineCustomProperty,
from_date: str,
to_date: str,
*,
resource_type: Literal["events", "people"] = "events",
) -> Filter
Create a date range filter (between two dates, inclusive).
| PARAMETER | DESCRIPTION |
|---|---|
property
|
Property name, CustomPropertyRef, or InlineCustomProperty.
TYPE:
|
from_date
|
Start date in YYYY-MM-DD format.
TYPE:
|
to_date
|
End date in YYYY-MM-DD format.
TYPE:
|
resource_type
|
Resource type. Default:
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Filter
|
Filter for dates within the range. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If dates are not valid YYYY-MM-DD or from_date is after to_date. |
Source code in src/mixpanel_data/types.py
date_not_between
classmethod
¶
date_not_between(
property: str | CustomPropertyRef | InlineCustomProperty,
from_date: str,
to_date: str,
*,
resource_type: Literal["events", "people"] = "events",
) -> Filter
Create a date exclusion range filter (not between two dates).
| PARAMETER | DESCRIPTION |
|---|---|
property
|
Property name, CustomPropertyRef, or InlineCustomProperty.
TYPE:
|
from_date
|
Start date in YYYY-MM-DD format.
TYPE:
|
to_date
|
End date in YYYY-MM-DD format.
TYPE:
|
resource_type
|
Resource type. Default:
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Filter
|
Filter for dates outside the range. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If dates are not valid YYYY-MM-DD or from_date is after to_date. |
Source code in src/mixpanel_data/types.py
in_the_next
classmethod
¶
in_the_next(
property: str | CustomPropertyRef | InlineCustomProperty,
quantity: int,
date_unit: FilterDateUnit,
*,
resource_type: Literal["events", "people"] = "events",
) -> Filter
Create a relative date filter (in the next N units).
| PARAMETER | DESCRIPTION |
|---|---|
property
|
Property name, CustomPropertyRef, or InlineCustomProperty.
TYPE:
|
quantity
|
Number of time units (must be positive).
TYPE:
|
date_unit
|
Time unit (
TYPE:
|
resource_type
|
Resource type. Default:
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Filter
|
Filter for events within the next N units. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If quantity is not positive. |
Source code in src/mixpanel_data/types.py
list_contains
classmethod
¶
list_contains(
property: str,
*item_filters: Filter,
quantifier: Literal["any", "all"] = "any",
resource_type: Literal["events", "people"] = "events",
**equals: str | list[str],
) -> Filter
Match events whose list-of-object property contains items satisfying inner conditions.
Used to filter on subproperties of objects nested inside a list
property (e.g. cart is a list of {"Brand": str, "Category":
str, "Price": int}). Each inner condition is evaluated
per-item; the quantifier controls whether at least one item
("any", the default) or every item ("all") must satisfy
all inner conditions.
Two ways to specify inner conditions:
- Keyword shorthand for the common equality case:
Filter.list_contains("cart", Brand="nike", Category="hats"). Inner equality filters inherit the outerresource_type. - Explicit Filter instances for any wire-format operator:
Filter.list_contains("cart", Filter.equals("Brand", "nike"), Filter.greater_than("Price", 50)). Each inner Filter carries its ownresource_typefrom its own factory call — passresource_type=explicitly on each inner factory if you want them to match the outer.
Mixing the two shapes in one call raises ValueError.
| PARAMETER | DESCRIPTION |
|---|---|
property
|
Name of the list-of-object property to filter on.
TYPE:
|
*item_filters
|
Inner
TYPE:
|
quantifier
|
TYPE:
|
resource_type
|
Resource type. Default:
TYPE:
|
**equals
|
Keyword shorthand — each
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Filter
|
Filter that emits the |
Filter
|
on serialization. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If both |
TypeError
|
If a |
Example
Source code in src/mixpanel_data/types.py
8666 8667 8668 8669 8670 8671 8672 8673 8674 8675 8676 8677 8678 8679 8680 8681 8682 8683 8684 8685 8686 8687 8688 8689 8690 8691 8692 8693 8694 8695 8696 8697 8698 8699 8700 8701 8702 8703 8704 8705 8706 8707 8708 8709 8710 8711 8712 8713 8714 8715 8716 8717 8718 8719 8720 8721 8722 8723 8724 8725 8726 8727 8728 8729 8730 8731 8732 8733 8734 8735 8736 8737 8738 8739 8740 8741 8742 8743 8744 8745 8746 8747 8748 8749 8750 8751 8752 8753 8754 8755 8756 8757 8758 8759 8760 8761 8762 8763 8764 8765 8766 8767 8768 8769 8770 8771 8772 8773 8774 8775 8776 8777 8778 8779 8780 8781 8782 8783 8784 8785 8786 | |
mixpanel_data.GroupBy
dataclass
¶
GroupBy(
property: str | CustomPropertyRef | InlineCustomProperty,
property_type: CustomPropertyType = "string",
bucket_size: int | float | None = None,
bucket_min: int | float | None = None,
bucket_max: int | float | None = None,
_list_item_mode: ListItemGroupMode | None = None,
)
Specifies a property breakdown with optional numeric bucketing.
Used with Workspace.query() to break down results by property values.
String properties are broken down by distinct values; numeric properties
can be bucketed into ranges.
| ATTRIBUTE | DESCRIPTION |
|---|---|
property |
Property to break down by (name, ref, or inline).
TYPE:
|
property_type |
Data type of the property. Default:
TYPE:
|
bucket_size |
Bucket width for numeric properties.
TYPE:
|
bucket_min |
Minimum value for numeric buckets.
TYPE:
|
bucket_max |
Maximum value for numeric buckets.
TYPE:
|
Example
property
instance-attribute
¶
Property to break down by (name, ref, or inline).
property_type
class-attribute
instance-attribute
¶
Data type of the property. One of the four scalar types.
Note: list-item breakdowns set _list_item_mode instead — the
wire builder hardcodes propertyType: "object" for that branch
independently of this field.
bucket_size
class-attribute
instance-attribute
¶
Bucket width for numeric properties.
bucket_min
class-attribute
instance-attribute
¶
Minimum value for numeric buckets.
bucket_max
class-attribute
instance-attribute
¶
Maximum value for numeric buckets.
__post_init__
¶
Validate construction arguments.
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If property is an empty string (GB1),
bucket_size is not positive (GB2),
bucket_min >= bucket_max (GB3),
|
Source code in src/mixpanel_data/types.py
list_item
classmethod
¶
Break down by a subproperty of objects inside a list property.
Mirrors the Mixpanel UI's cart.Brand / cart.Category
breakdown for list-of-object properties (e.g. cart is a
list of {"Brand": str, "Category": str, "Price": int}
items). Each list item contributes one count per distinct
subproperty value it carries.
| PARAMETER | DESCRIPTION |
|---|---|
property
|
Name of the list-of-object property.
TYPE:
|
sub
|
Subproperty name to break down by.
TYPE:
|
sub_type
|
Data type of the subproperty. Default:
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
GroupBy
|
|
GroupBy
|
structure in the bookmark JSON. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If |
Example
Source code in src/mixpanel_data/types.py
mixpanel_data.ListItemGroupMode
dataclass
¶
Discriminator for GroupBy.list_item — sub-property name + scalar type.
Pairs the subproperty name with its inferred scalar type so they
cannot be set independently. Used as the optional _list_item_mode
field on GroupBy; presence of this field marks a GroupBy as a
list-item breakdown.
| ATTRIBUTE | DESCRIPTION |
|---|---|
sub |
Subproperty name (must be non-empty after stripping).
TYPE:
|
sub_type |
Subproperty data type. One of the four
TYPE:
|
Example
sub_type
instance-attribute
¶
Subproperty data type, matching :data:CustomPropertyType.
__post_init__
¶
Validate sub is non-empty and sub_type is a known scalar type.
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If |
Source code in src/mixpanel_data/types.py
mixpanel_data.QueryResult
dataclass
¶
QueryResult(
computed_at: str,
from_date: str,
to_date: str,
headers: list[str] = list(),
series: dict[str, Any] = dict(),
params: dict[str, Any] = dict(),
meta: dict[str, Any] = dict(),
*,
_df_cache: DataFrame | None = None,
)
Bases: ResultWithDataFrame
Structured output from a Workspace.query() execution.
Contains the query response data with lazy DataFrame conversion. The series structure varies by query mode:
- Timeseries:
{metric_name: {date_string: value}} - Total:
{metric_name: {"all": value}}
| ATTRIBUTE | DESCRIPTION |
|---|---|
computed_at |
When the query was computed (ISO format).
TYPE:
|
from_date |
Effective start date from response.
TYPE:
|
to_date |
Effective end date from response.
TYPE:
|
headers |
Column headers from the insights response.
TYPE:
|
series |
Query result data (structure varies by mode).
TYPE:
|
params |
Generated bookmark params sent to API (for debugging/persistence).
TYPE:
|
meta |
Response metadata (sampling factor, limits hit).
TYPE:
|
Example
headers
class-attribute
instance-attribute
¶
Column headers from the insights response.
series
class-attribute
instance-attribute
¶
Query result data.
For timeseries: {metric_name: {date_string: value}}
For total: {metric_name: {"all": value}}
params
class-attribute
instance-attribute
¶
Generated bookmark params sent to API (for debugging/persistence).
meta
class-attribute
instance-attribute
¶
Response metadata. Conforms to :class:QueryMeta
(sampling_factor, is_cached, computation_time, query_id).
df
property
¶
Convert to DataFrame.
For timeseries mode: columns are date, event, count.
For total mode: columns are event, count.
For segmented timeseries (with group_by): columns are
date, event, segment, count.
For segmented total (with group_by): columns are
event, segment, count.
| RETURNS | DESCRIPTION |
|---|---|
DataFrame
|
Normalized DataFrame with one row per (date, metric, segment) |
DataFrame
|
combination. Segmented responses are detected automatically |
DataFrame
|
by checking whether inner values are dicts (segment nesting) |
DataFrame
|
or scalars (flat response). |
to_dict
¶
Serialize for JSON output.
| RETURNS | DESCRIPTION |
|---|---|
dict[str, Any]
|
Dictionary with all QueryResult fields. |
Source code in src/mixpanel_data/types.py
Cohort Query Types¶
Types for cohort-scoped queries — filter by cohort, break down by cohort membership, or track cohort size as a metric across all query engines.
mixpanel_data.CohortBreakdown
dataclass
¶
CohortBreakdown(
cohort: int | CohortDefinition,
name: str | None = None,
include_negated: bool = True,
)
Break down query results by cohort membership.
Represents a cohort-based breakdown dimension for use in the
group_by= parameter of query(), query_funnel(),
and query_retention().
Accepts either a saved cohort ID (int) or an inline
CohortDefinition. When include_negated=True (default),
both "In Cohort" and "Not In Cohort" segments are shown.
| ATTRIBUTE | DESCRIPTION |
|---|---|
cohort |
Saved cohort ID (positive integer) or inline
TYPE:
|
name |
Display name. Optional for saved cohorts; recommended for inline definitions.
TYPE:
|
include_negated |
Whether to include a "Not In" segment.
Default:
TYPE:
|
Example
mixpanel_data.CohortMetric
dataclass
¶
Track cohort size over time as an event metric.
Represents a cohort size metric for use in the events=
parameter of query() (insights only). Produces a show clause
with behavior.type: "cohort" in the bookmark JSON.
Cannot be used with query_funnel(), query_retention(),
or query_flow() (CM4 — insights only).
Inline CohortDefinition is not supported (CM5 — server returns
500). Use a saved cohort ID instead. This is enforced at construction.
| ATTRIBUTE | DESCRIPTION |
|---|---|
cohort |
Saved cohort ID (positive integer) or inline
TYPE:
|
name |
Display name / series label. Optional for saved cohorts; recommended for inline definitions.
TYPE:
|
Example
from mixpanel_data import CohortMetric, Metric, Formula
# Track cohort growth
result = ws.query(CohortMetric(123, "Power Users"), last=90, unit="week")
# Mix with event metrics and formulas
result = ws.query(
[Metric("Login", math="unique"), CohortMetric(123, "Power Users")],
formula="(B / A) * 100",
formula_label="Power User %",
)
__post_init__
¶
Validate construction arguments.
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If cohort ID is not positive (CM1), name
is empty when provided (CM2), or cohort is an inline
|
Source code in src/mixpanel_data/types.py
Custom Property Query Types¶
Types for using saved or inline custom properties as property references in query breakdowns, filters, and metric measurement. See Custom Properties in Queries for usage guide.
mixpanel_data.CustomPropertyRef
dataclass
¶
A reference to a persisted custom property by its integer ID.
Used in GroupBy.property, Filter class methods, and
Metric.property to reference a custom property that was
previously created and saved in Mixpanel.
| ATTRIBUTE | DESCRIPTION |
|---|---|
id |
The custom property's server-assigned ID (must be positive).
TYPE:
|
Example
mixpanel_data.InlineCustomProperty
dataclass
¶
InlineCustomProperty(
formula: str,
inputs: dict[str, PropertyInput],
property_type: Literal["string", "number", "boolean", "datetime"]
| None = None,
resource_type: Literal["events", "people"] = "events",
)
An ephemeral computed property defined by a formula and input references.
Defines a custom property inline at query time without persisting it
to Mixpanel. The formula uses variables (A-Z) that map to concrete
properties via the inputs dict.
Can be used in GroupBy.property, Filter class methods, and
Metric.property to compute derived values on the fly.
| ATTRIBUTE | DESCRIPTION |
|---|---|
formula |
Expression in Mixpanel's formula language (max 20,000 chars).
TYPE:
|
inputs |
Mapping from single uppercase letters (A-Z) to property references.
TYPE:
|
property_type |
Result type of the formula.
TYPE:
|
resource_type |
Data domain —
TYPE:
|
Example
from mixpanel_data import InlineCustomProperty, PropertyInput
# Explicit construction
icp = InlineCustomProperty(
formula="A * B",
inputs={
"A": PropertyInput("price", type="number"),
"B": PropertyInput("quantity", type="number"),
},
property_type="number",
)
# Convenience constructor for all-numeric inputs
icp = InlineCustomProperty.numeric("A * B", A="price", B="quantity")
inputs
instance-attribute
¶
Mapping from single uppercase letters (A-Z) to property references.
property_type
class-attribute
instance-attribute
¶
Result type of the formula; None defers to containing type.
resource_type
class-attribute
instance-attribute
¶
Data domain (plural form for top-level customProperty schema).
numeric
classmethod
¶
Create an all-numeric-input inline custom property.
Convenience constructor that creates PropertyInput entries
with type="number" and resource_type="event" for each
keyword argument, and sets property_type="number".
| PARAMETER | DESCRIPTION |
|---|---|
formula
|
Expression in Mixpanel's formula language.
TYPE:
|
**properties
|
Mapping of variable letters to property names. Each key becomes an input key, each value becomes the property name.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
InlineCustomProperty
|
InlineCustomProperty with all-numeric inputs and |
InlineCustomProperty
|
|
Example
Source code in src/mixpanel_data/types.py
mixpanel_data.PropertyInput
dataclass
¶
PropertyInput(
name: str,
type: Literal["string", "number", "boolean", "datetime", "list"] = "string",
resource_type: Literal["event", "user"] = "event",
)
A raw property reference mapping a formula variable to a named property.
Used as an entry in :attr:InlineCustomProperty.inputs to bind a
formula variable (A-Z) to a concrete Mixpanel event or user property.
| ATTRIBUTE | DESCRIPTION |
|---|---|
name |
The raw property name (e.g.,
TYPE:
|
type |
Property data type. Default:
TYPE:
|
resource_type |
Property domain —
TYPE:
|
Example
Advanced Query Types¶
Types for advanced query features — period-over-period comparison, frequency analysis, and frequency filtering across query engines.
mixpanel_data.TimeComparison
dataclass
¶
TimeComparison(
type: TimeComparisonType,
unit: TimeComparisonUnit | None = None,
date: str | None = None,
)
Overlay a comparison time period on insights, funnel, or retention queries.
Enables period-over-period analysis by specifying how the comparison window is determined. Three modes are supported:
- relative: Compare against a prior period offset by
unit(e.g. previous month, previous week). - absolute-start: Compare against a window starting on a fixed
date (
date), running the same duration as the primary range. - absolute-end: Compare against a window ending on a fixed date.
Use the factory class methods rather than constructing directly:
TimeComparison.relative(unit)TimeComparison.absolute_start(date)TimeComparison.absolute_end(date)
| ATTRIBUTE | DESCRIPTION |
|---|---|
type |
Discriminant —
TYPE:
|
unit |
Time unit for relative comparison. Required when
TYPE:
|
date |
ISO date (YYYY-MM-DD) for absolute comparison. Required
when
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If validation rules TC1-TC3 are violated during construction. |
Example
from mixpanel_data.types import TimeComparison
# Compare against previous month
tc = TimeComparison.relative("month")
# Compare against window starting on a fixed date
tc = TimeComparison.absolute_start("2026-01-01")
# Compare against window ending on a fixed date
tc = TimeComparison.absolute_end("2026-12-31")
type
instance-attribute
¶
Discriminant — "relative", "absolute-start", or "absolute-end".
unit
class-attribute
instance-attribute
¶
Time unit for relative comparison (day, week, month, quarter, year).
date
class-attribute
instance-attribute
¶
ISO date (YYYY-MM-DD) for absolute comparison.
__post_init__
¶
Validate construction arguments (rules TC1-TC3).
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If type="relative" and unit is None (TC1), or type="relative" and date is set (TC1), or type is absolute and date is None (TC2), or type is absolute and unit is set (TC2), or date does not match YYYY-MM-DD format (TC3). |
Source code in src/mixpanel_data/types.py
7405 7406 7407 7408 7409 7410 7411 7412 7413 7414 7415 7416 7417 7418 7419 7420 7421 7422 7423 7424 7425 7426 7427 7428 7429 7430 7431 7432 7433 7434 7435 7436 7437 7438 7439 7440 7441 7442 7443 7444 7445 7446 7447 7448 7449 7450 7451 7452 7453 7454 7455 7456 7457 7458 7459 7460 7461 7462 7463 7464 7465 7466 7467 | |
relative
classmethod
¶
Create a relative time comparison.
Compares against a prior period offset by the given unit (e.g. previous month, previous week).
| PARAMETER | DESCRIPTION |
|---|---|
unit
|
Time unit for the comparison offset. One of
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
TimeComparison
|
A |
TimeComparison
|
specified |
Source code in src/mixpanel_data/types.py
absolute_start
classmethod
¶
Create an absolute-start time comparison.
Compares against a window that starts on the given date, running the same duration as the primary query range.
| PARAMETER | DESCRIPTION |
|---|---|
date
|
Start date in YYYY-MM-DD format.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
TimeComparison
|
A |
TimeComparison
|
the specified |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If date is not in YYYY-MM-DD format (TC3). |
Example
Source code in src/mixpanel_data/types.py
absolute_end
classmethod
¶
Create an absolute-end time comparison.
Compares against a window that ends on the given date, running the same duration as the primary query range.
| PARAMETER | DESCRIPTION |
|---|---|
date
|
End date in YYYY-MM-DD format.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
TimeComparison
|
A |
TimeComparison
|
the specified |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If date is not in YYYY-MM-DD format (TC3). |
Example
Source code in src/mixpanel_data/types.py
mixpanel_data.FrequencyBreakdown
dataclass
¶
FrequencyBreakdown(
event: str,
bucket_size: int = 1,
bucket_min: int = 0,
bucket_max: int = 10,
label: str | None = None,
)
Break down query results by how often users performed an event.
Used with Workspace.query() / build_params() in the
group_by= parameter to segment users by event frequency.
| ATTRIBUTE | DESCRIPTION |
|---|---|
event |
Event name to count frequency for.
TYPE:
|
bucket_size |
Width of each frequency bucket. Default:
TYPE:
|
bucket_min |
Minimum frequency value. Default:
TYPE:
|
bucket_max |
Maximum frequency value. Default:
TYPE:
|
label |
Display label for the breakdown.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If validation rules FB1-FB4 are violated. |
Example
from mixpanel_data import FrequencyBreakdown
# How often users purchased (0-10 in increments of 1)
result = ws.query("Login", group_by=FrequencyBreakdown("Purchase"))
# Custom buckets: 0-50 in increments of 5
result = ws.query(
"Login",
group_by=FrequencyBreakdown(
"Purchase", bucket_size=5, bucket_min=0, bucket_max=50
),
)
bucket_size
class-attribute
instance-attribute
¶
Width of each frequency bucket.
label
class-attribute
instance-attribute
¶
Display label for the breakdown.
__post_init__
¶
Validate construction arguments (rules FB1-FB4).
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If event is empty (FB1), bucket_size is not positive (FB2), bucket_min >= bucket_max (FB3), or bucket_min is negative (FB4). |
Source code in src/mixpanel_data/types.py
mixpanel_data.FrequencyFilter
dataclass
¶
FrequencyFilter(
event: str,
value: int | float,
operator: FrequencyFilterOperator = "is at least",
date_range_value: int | None = None,
date_range_unit: Literal["day", "week", "month"] | None = None,
event_filters: list[Filter] | None = None,
label: str | None = None,
)
Filter query results by how often users performed an event.
Used with Workspace.query() / build_params() in the
where= parameter to restrict results to users meeting a
frequency threshold.
| ATTRIBUTE | DESCRIPTION |
|---|---|
event |
Event name to count frequency for.
TYPE:
|
operator |
Comparison operator. Default:
TYPE:
|
value |
Threshold value for the comparison.
TYPE:
|
date_range_value |
Lookback window size. Must be paired with
TYPE:
|
date_range_unit |
Lookback window unit (
TYPE:
|
event_filters |
Property filters applied to the frequency event before counting.
TYPE:
|
label |
Display label for the filter.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If validation rules FF1-FF5 are violated. |
Example
from mixpanel_data import FrequencyFilter
# Users who logged in at least 5 times
result = ws.query("Purchase", where=FrequencyFilter("Login", value=5))
# Users who purchased 3+ times in the last 30 days
result = ws.query(
"Login",
where=FrequencyFilter(
"Purchase",
value=3,
date_range_value=30,
date_range_unit="day",
),
)
operator
class-attribute
instance-attribute
¶
Comparison operator.
date_range_value
class-attribute
instance-attribute
¶
Lookback window size.
date_range_unit
class-attribute
instance-attribute
¶
Lookback window unit.
event_filters
class-attribute
instance-attribute
¶
Property filters applied to the frequency event.
__post_init__
¶
Validate construction arguments (rules FF1-FF5).
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If event is empty (FF1), operator is invalid (FF2), value is negative (FF3), date_range_value and date_range_unit are not both set or both None (FF4), or date_range_value is not positive when set (FF5). |
Source code in src/mixpanel_data/types.py
Cohort Definition Types¶
Types for building inline cohort definitions programmatically — used with Filter.in_cohort(), CohortBreakdown, and CohortMetric.
mixpanel_data.CohortDefinition
dataclass
¶
A composed set of criteria combined with AND/OR logic.
Produces valid Mixpanel cohort definition JSON (legacy selector +
behaviors format) via to_dict(). Behavior keys are globally
re-indexed to ensure uniqueness across arbitrary nesting.
Example
Create a definition combining criteria with AND logic.
Equivalent to CohortDefinition.all_of(*criteria).
| PARAMETER | DESCRIPTION |
|---|---|
*criteria
|
One or more criteria or nested definitions.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If no criteria are provided (CD9). |
Source code in src/mixpanel_data/types.py
all_of
classmethod
¶
Combine criteria and/or definitions with AND logic.
| PARAMETER | DESCRIPTION |
|---|---|
*criteria
|
One or more criteria or nested definitions.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
CohortDefinition
|
CohortDefinition with AND combinator. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If no criteria are provided (CD9). |
Source code in src/mixpanel_data/types.py
any_of
classmethod
¶
Combine criteria and/or definitions with OR logic.
| PARAMETER | DESCRIPTION |
|---|---|
*criteria
|
One or more criteria or nested definitions.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
CohortDefinition
|
CohortDefinition with OR combinator. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If no criteria are provided (CD9). |
Source code in src/mixpanel_data/types.py
to_dict
¶
Serialize to Mixpanel cohort definition format.
Produces {"selector": {...}, "behaviors": {...}} with globally
re-indexed behavior keys (bhvr_0, bhvr_1, ...) ensuring
uniqueness across arbitrary nesting depth.
| RETURNS | DESCRIPTION |
|---|---|
dict[str, Any]
|
Dict with |
Example
cohort = CohortDefinition.all_of(
CohortCriteria.has_property("plan", "premium"),
CohortCriteria.did_event("Purchase", at_least=3, within_days=30),
)
data = cohort.to_dict()
# {"selector": {"operator": "and", "children": [...]},
# "behaviors": {"bhvr_0": {...}}}
# Pass directly to cohort CRUD:
ws.create_cohort(CreateCohortParams(
name="Premium Purchasers",
definition=data,
))
Source code in src/mixpanel_data/types.py
9699 9700 9701 9702 9703 9704 9705 9706 9707 9708 9709 9710 9711 9712 9713 9714 9715 9716 9717 9718 9719 9720 9721 9722 9723 9724 9725 9726 9727 9728 9729 9730 9731 9732 9733 9734 9735 9736 9737 9738 9739 9740 9741 9742 9743 9744 9745 9746 9747 9748 9749 9750 9751 9752 9753 9754 9755 9756 9757 9758 9759 9760 | |
mixpanel_data.CohortCriteria
dataclass
¶
CohortCriteria(
_selector_node: dict[str, Any],
_behavior_key: str | None,
_behavior: dict[str, Any] | None,
)
A single atomic condition for cohort membership.
Constructed exclusively via class methods — never instantiate directly.
Produces selector nodes and behavior entries for the Mixpanel cohort
definition format (legacy selector + behaviors JSON).
Example
did_event
classmethod
¶
did_event(
event: str,
*,
at_least: int | None = None,
at_most: int | None = None,
exactly: int | None = None,
within_days: int | None = None,
within_weeks: int | None = None,
within_months: int | None = None,
from_date: str | None = None,
to_date: str | None = None,
where: Filter | list[Filter] | None = None,
aggregation: CohortAggregationType | None = None,
aggregation_property: str | None = None,
) -> CohortCriteria
Create a behavioral criterion based on event frequency.
| PARAMETER | DESCRIPTION |
|---|---|
event
|
Event name (must be non-empty).
TYPE:
|
at_least
|
Minimum event count (
TYPE:
|
at_most
|
Maximum event count (
TYPE:
|
exactly
|
Exact event count (
TYPE:
|
within_days
|
Rolling window in days.
TYPE:
|
within_weeks
|
Rolling window in weeks.
TYPE:
|
within_months
|
Rolling window in months.
TYPE:
|
from_date
|
Absolute start date (YYYY-MM-DD).
TYPE:
|
to_date
|
Absolute end date (YYYY-MM-DD).
TYPE:
|
where
|
Event property filter(s). |
aggregation
|
Aggregation operator for property-based thresholds
(total, unique, average, min, max, median). Must be paired
with
TYPE:
|
aggregation_property
|
Event property to aggregate (e.g.,
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
CohortCriteria
|
CohortCriteria with behavioral selector node and behavior entry. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If no frequency param or multiple are set, frequency is negative, event name is empty/whitespace, time constraints are missing or conflicting, dates are malformed/misordered, or aggregation and aggregation_property are not both set or both None (CA1/CA2). |
Source code in src/mixpanel_data/types.py
9146 9147 9148 9149 9150 9151 9152 9153 9154 9155 9156 9157 9158 9159 9160 9161 9162 9163 9164 9165 9166 9167 9168 9169 9170 9171 9172 9173 9174 9175 9176 9177 9178 9179 9180 9181 9182 9183 9184 9185 9186 9187 9188 9189 9190 9191 9192 9193 9194 9195 9196 9197 9198 9199 9200 9201 9202 9203 9204 9205 9206 9207 9208 9209 9210 9211 9212 9213 9214 9215 9216 9217 9218 9219 9220 9221 9222 9223 9224 9225 9226 9227 9228 9229 9230 9231 9232 9233 9234 9235 9236 9237 9238 9239 9240 9241 9242 9243 9244 9245 9246 9247 9248 9249 9250 9251 9252 9253 9254 9255 9256 9257 9258 9259 9260 9261 9262 9263 9264 9265 9266 9267 9268 9269 9270 9271 9272 9273 9274 9275 9276 9277 9278 9279 9280 9281 9282 9283 9284 9285 9286 9287 9288 9289 9290 9291 9292 9293 9294 9295 9296 9297 9298 9299 9300 9301 9302 9303 9304 9305 9306 9307 9308 9309 9310 9311 9312 9313 9314 9315 9316 9317 9318 9319 9320 9321 9322 9323 9324 9325 9326 9327 9328 | |
did_not_do_event
classmethod
¶
did_not_do_event(
event: str,
*,
within_days: int | None = None,
within_weeks: int | None = None,
within_months: int | None = None,
from_date: str | None = None,
to_date: str | None = None,
) -> CohortCriteria
Create a criterion for users who did NOT perform an event.
Shorthand for did_event(event, exactly=0, ...).
| PARAMETER | DESCRIPTION |
|---|---|
event
|
Event name.
TYPE:
|
within_days
|
Rolling window in days.
TYPE:
|
within_weeks
|
Rolling window in weeks.
TYPE:
|
within_months
|
Rolling window in months.
TYPE:
|
from_date
|
Absolute start date (YYYY-MM-DD).
TYPE:
|
to_date
|
Absolute end date (YYYY-MM-DD).
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
CohortCriteria
|
CohortCriteria equivalent to |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
On constraint violations. |
Source code in src/mixpanel_data/types.py
has_property
classmethod
¶
has_property(
property: str,
value: str | int | float | bool | list[str],
*,
operator: Literal[
"equals",
"not_equals",
"contains",
"not_contains",
"greater_than",
"less_than",
"is_set",
"is_not_set",
] = "equals",
property_type: Literal[
"string", "number", "boolean", "datetime", "list"
] = "string",
) -> CohortCriteria
Create a property-based criterion.
| PARAMETER | DESCRIPTION |
|---|---|
property
|
Property name (must be non-empty).
TYPE:
|
value
|
Value to compare against.
TYPE:
|
operator
|
Comparison operator. Default:
TYPE:
|
property_type
|
Data type of the property. Default:
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
CohortCriteria
|
CohortCriteria with property selector node. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If property name is empty (CD7). |
Source code in src/mixpanel_data/types.py
property_is_set
classmethod
¶
Check if a user property exists.
Shorthand for has_property(property, "", operator="is_set").
| PARAMETER | DESCRIPTION |
|---|---|
property
|
Property name.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
CohortCriteria
|
CohortCriteria checking property existence. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If property name is empty (CD7). |
Source code in src/mixpanel_data/types.py
property_is_not_set
classmethod
¶
Check if a user property does not exist.
Shorthand for has_property(property, "", operator="is_not_set").
| PARAMETER | DESCRIPTION |
|---|---|
property
|
Property name.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
CohortCriteria
|
CohortCriteria checking property non-existence. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If property name is empty (CD7). |
Source code in src/mixpanel_data/types.py
in_cohort
classmethod
¶
Create a criterion for membership in a saved cohort.
| PARAMETER | DESCRIPTION |
|---|---|
cohort_id
|
Cohort ID (must be positive integer).
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
CohortCriteria
|
CohortCriteria with cohort reference selector node. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If cohort_id is not a positive integer (CD8). |
Source code in src/mixpanel_data/types.py
not_in_cohort
classmethod
¶
Create a criterion for non-membership in a saved cohort.
| PARAMETER | DESCRIPTION |
|---|---|
cohort_id
|
Cohort ID (must be positive integer).
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
CohortCriteria
|
CohortCriteria with cohort exclusion selector node. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If cohort_id is not a positive integer (CD8). |
Source code in src/mixpanel_data/types.py
Funnel Query Types¶
Types for Workspace.query_funnel() — typed funnel conversion analysis with step definitions, exclusions, and conversion windows.
mixpanel_data.FunnelStep
dataclass
¶
FunnelStep(
event: str,
label: str | None = None,
filters: list[Filter] | None = None,
filters_combinator: FiltersCombinator = "all",
order: FunnelOrder | None = None,
)
A single step in a funnel query.
Use plain event-name strings for simple funnels. Use FunnelStep
objects when you need per-step filters, labels, or ordering overrides.
| ATTRIBUTE | DESCRIPTION |
|---|---|
event |
Mixpanel event name for this funnel step.
TYPE:
|
label |
Display label for this step. Defaults to the event name
when
TYPE:
|
filters |
Per-step filter conditions. Each
TYPE:
|
filters_combinator |
How per-step filters combine.
TYPE:
|
order |
Per-step ordering override. Only meaningful when the
top-level funnel
TYPE:
|
Example
from mixpanel_data import FunnelStep, Filter
# Simple step (equivalent to just using "Signup" string)
step1 = FunnelStep("Signup")
# Step with per-step filter and label
step2 = FunnelStep(
"Purchase",
label="High-Value Purchase",
filters=[Filter.greater_than("amount", 50)],
)
ws.query_funnel([step1, step2])
label
class-attribute
instance-attribute
¶
Display label for this step (defaults to event name).
filters
class-attribute
instance-attribute
¶
Per-step filter conditions.
filters_combinator
class-attribute
instance-attribute
¶
How per-step filters combine (AND/OR).
order
class-attribute
instance-attribute
¶
Per-step ordering override (only meaningful with top-level order='any').
__post_init__
¶
Validate construction arguments.
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If event is empty or contains control characters (FS1). |
mixpanel_data.Exclusion
dataclass
¶
An event to exclude between funnel steps.
Users who perform the excluded event within the specified step range
are removed from the funnel. Use plain strings for full-range
exclusions; use Exclusion objects when you need to target
specific step ranges.
| ATTRIBUTE | DESCRIPTION |
|---|---|
event |
Event name to exclude between steps.
TYPE:
|
from_step |
Start of exclusion range (0-indexed, inclusive). Defaults to 0 (first step).
TYPE:
|
to_step |
End of exclusion range (0-indexed, inclusive).
TYPE:
|
Example
from_step
class-attribute
instance-attribute
¶
Start of exclusion range (0-indexed, inclusive).
to_step
class-attribute
instance-attribute
¶
End of exclusion range (0-indexed, inclusive). None = last step.
__post_init__
¶
Validate construction arguments.
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If event is empty (EX1), from_step is negative (EX2), or to_step < from_step (EX3). |
Source code in src/mixpanel_data/types.py
mixpanel_data.HoldingConstant
dataclass
¶
A property to hold constant across all funnel steps.
When a property is held constant, only users whose property value
is the same at every funnel step are counted as converting. For
example, holding "platform" constant means a user who signed up
on iOS but purchased on web is not counted as converting.
| ATTRIBUTE | DESCRIPTION |
|---|---|
property |
Property name to hold constant across steps.
TYPE:
|
resource_type |
Whether this is an event property or a
user-profile property. Defaults to
TYPE:
|
Example
mixpanel_data.FunnelQueryResult
dataclass
¶
FunnelQueryResult(
computed_at: str,
from_date: str,
to_date: str,
steps_data: list[dict[str, Any]] = list(),
series: dict[str, Any] = dict(),
params: dict[str, Any] = dict(),
meta: dict[str, Any] = dict(),
*,
_df_cache: DataFrame | None = None,
)
Bases: ResultWithDataFrame
Result of a funnel query via the insights API.
Contains step-level conversion data, timing information, the generated bookmark params (for debugging or persisting as a saved report), and a lazy DataFrame conversion.
Unlike FunnelResult (which wraps the legacy funnel API), this
type wraps the richer bookmark-based insights API response and
provides additional fields like avg_time, avg_time_from_start,
and the params dict.
| ATTRIBUTE | DESCRIPTION |
|---|---|
computed_at |
When the query was computed (ISO format).
TYPE:
|
from_date |
Effective start date from the response.
TYPE:
|
to_date |
Effective end date from the response.
TYPE:
|
steps_data |
Step-level results. Each dict contains keys:
TYPE:
|
series |
Raw series data from the API (for advanced use).
TYPE:
|
params |
Generated bookmark params sent to the API
(for debugging or persistence via
TYPE:
|
meta |
Response metadata (e.g.
TYPE:
|
Example
result = ws.query_funnel(["Signup", "Purchase"])
# Overall conversion
print(result.overall_conversion_rate) # e.g. 0.12
# DataFrame view
print(result.df)
# step event count step_conv_ratio overall_conv_ratio ...
# Save as a report
ws.create_bookmark(CreateBookmarkParams(
name="Signup → Purchase Funnel",
bookmark_type="funnels",
params=result.params,
))
steps_data
class-attribute
instance-attribute
¶
Step-level results. Each dict conforms to :class:FunnelStepData
(event, count, step_conv_ratio, overall_conv_ratio, avg_time,
avg_time_from_start).
series
class-attribute
instance-attribute
¶
Raw series data from the API.
params
class-attribute
instance-attribute
¶
Generated bookmark params sent to API.
meta
class-attribute
instance-attribute
¶
Response metadata. Conforms to :class:QueryMeta
(sampling_factor, is_cached, computation_time, query_id).
overall_conversion_rate
property
¶
End-to-end conversion rate from first to last step.
| RETURNS | DESCRIPTION |
|---|---|
float
|
Float between 0.0 and 1.0 representing the fraction of |
float
|
users who completed all funnel steps. Returns 0.0 if |
float
|
|
df
property
¶
Convert to DataFrame with one row per funnel step.
Columns: step, event, count, step_conv_ratio,
overall_conv_ratio, avg_time, avg_time_from_start.
| RETURNS | DESCRIPTION |
|---|---|
DataFrame
|
Normalized DataFrame with one row per step. |
to_dict
¶
Serialize for JSON output.
| RETURNS | DESCRIPTION |
|---|---|
dict[str, Any]
|
Dictionary with all FunnelQueryResult fields. |
Source code in src/mixpanel_data/types.py
Retention Query Types¶
Types for Workspace.query_retention() — typed retention analysis with event pairs, custom buckets, alignment modes, and segmentation.
mixpanel_data.RetentionEvent
dataclass
¶
RetentionEvent(
event: str,
filters: list[Filter] | None = None,
filters_combinator: FiltersCombinator = "all",
)
An event specification for retention queries.
Wraps an event name with optional per-event filters. Use plain
event-name strings for simple retention queries. Use RetentionEvent
objects when you need per-event filter conditions.
| ATTRIBUTE | DESCRIPTION |
|---|---|
event |
Mixpanel event name.
TYPE:
|
filters |
Per-event filter conditions. Each
TYPE:
|
filters_combinator |
How per-event filters combine.
TYPE:
|
Example
filters
class-attribute
instance-attribute
¶
Per-event filter conditions.
filters_combinator
class-attribute
instance-attribute
¶
How per-event filters combine (AND/OR).
__post_init__
¶
Validate construction arguments.
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If event is empty or contains control characters (RE1). |
mixpanel_data.RetentionAlignment
module-attribute
¶
Retention alignment mode.
+------------------+----------------------------------------------+ | Value | Meaning | +==================+==============================================+ | birth | Align to each cohort's born date (default) | +------------------+----------------------------------------------+ | interval_start | Align all cohorts to the same start date | +------------------+----------------------------------------------+
mixpanel_data.RetentionMode
module-attribute
¶
Display mode for retention query results.
+--------+----------------------------------------------+ | Value | Meaning | +========+==============================================+ | curve | Retention curve (default) | +--------+----------------------------------------------+ | trends | Trend lines over time | +--------+----------------------------------------------+ | table | Tabular cohort x bucket grid | +--------+----------------------------------------------+
mixpanel_data.RetentionMathType
module-attribute
¶
Aggregation function for retention query metrics.
+----------------+----------------------------------------------+ | Value | Meaning | +================+==============================================+ | retention_rate | Percentage of users retained (default) | +----------------+----------------------------------------------+ | unique | Raw count of retained users | +----------------+----------------------------------------------+ | total | Total event count per retention bucket | +----------------+----------------------------------------------+ | average | Average of a numeric property per bucket | +----------------+----------------------------------------------+
Maps directly to the measurement.math field in bookmark JSON.
mixpanel_data.RetentionQueryResult
dataclass
¶
RetentionQueryResult(
computed_at: str,
from_date: str,
to_date: str,
cohorts: dict[str, dict[str, Any]] = dict(),
average: dict[str, Any] = dict(),
params: dict[str, Any] = dict(),
meta: dict[str, Any] = dict(),
segments: dict[str, dict[str, dict[str, Any]]] = dict(),
segment_averages: dict[str, dict[str, Any]] = dict(),
*,
_df_cache: DataFrame | None = None,
)
Bases: ResultWithDataFrame
Result of a retention query via the insights API.
Contains cohort-level retention data, the generated bookmark params
(for debugging or persisting as a saved report), and a lazy
DataFrame conversion. Supports both unsegmented and segmented
(group_by) queries.
| ATTRIBUTE | DESCRIPTION |
|---|---|
computed_at |
When the query was computed (ISO format).
TYPE:
|
from_date |
Effective start date from the response.
TYPE:
|
to_date |
Effective end date from the response.
TYPE:
|
cohorts |
Aggregate cohort-level retention data. Keys are cohort
date strings (
TYPE:
|
average |
Synthetic
TYPE:
|
params |
Generated bookmark params sent to the API
(for debugging or persistence via
TYPE:
|
meta |
Response metadata (e.g.
TYPE:
|
segments |
Per-segment cohort data. Maps segment name to a dict of cohort_date → {first, counts, rates}. Empty for unsegmented queries.
TYPE:
|
segment_averages |
Per-segment
TYPE:
|
Example
# Unsegmented retention
result = ws.query_retention("Signup", "Login")
print(result.df)
# cohort_date bucket count rate
# Segmented retention
result = ws.query_retention(
"Signup", "Login", group_by="platform"
)
print(result.df)
# segment cohort_date bucket count rate
for name, cohorts in result.segments.items():
print(f"{name}: {len(cohorts)} cohorts")
cohorts
class-attribute
instance-attribute
¶
Cohort-level retention data. Each value conforms to
:class:RetentionCohortData (first, counts, rates).
For segmented queries, this contains the $overall aggregate.
average
class-attribute
instance-attribute
¶
Synthetic $average cohort data. Conforms to :class:RetentionCohortData.
params
class-attribute
instance-attribute
¶
Generated bookmark params sent to API.
meta
class-attribute
instance-attribute
¶
Response metadata. Conforms to :class:QueryMeta.
segments
class-attribute
instance-attribute
¶
Per-segment cohort data. Each inner value conforms to
:class:RetentionCohortData (first, counts, rates).
Empty for unsegmented queries. Populated when group_by is used
and the API returns breakdown segments alongside $overall.
segment_averages
class-attribute
instance-attribute
¶
Per-segment $average cohort data. Each value conforms to
:class:RetentionCohortData.
Empty for unsegmented queries.
df
property
¶
Convert to DataFrame with one row per (cohort_date, bucket) pair.
For unsegmented queries, columns are:
cohort_date, bucket, count, rate.
For segmented queries (when segments is non-empty), columns are:
segment, cohort_date, bucket, count, rate.
| RETURNS | DESCRIPTION |
|---|---|
DataFrame
|
Normalized DataFrame. Empty DataFrame with correct columns |
DataFrame
|
if data is empty. |
to_dict
¶
Serialize for JSON output.
| RETURNS | DESCRIPTION |
|---|---|
dict[str, Any]
|
Dictionary with all RetentionQueryResult fields. |
dict[str, Any]
|
Includes |
dict[str, Any]
|
when non-empty. |
Source code in src/mixpanel_data/types.py
Flow Query Types¶
Types for Workspace.query_flow() — typed flow path analysis with step definitions, direction controls, and visualization modes.
mixpanel_data.FlowStep
dataclass
¶
FlowStep(
event: str,
forward: int | None = None,
reverse: int | None = None,
label: str | None = None,
filters: list[Filter] | None = None,
filters_combinator: FiltersCombinator = "all",
session_event: FlowSessionEvent | None = None,
)
An anchor event in a flow query with per-step configuration.
Each flow step identifies a specific event and optional constraints (forward/reverse step counts, filters) that define a node in the flow analysis.
| ATTRIBUTE | DESCRIPTION |
|---|---|
event |
The event name to anchor this step on.
TYPE:
|
forward |
Maximum number of forward steps to trace from this event.
TYPE:
|
reverse |
Maximum number of reverse steps to trace from this event.
TYPE:
|
label |
Optional display label for this step. If
TYPE:
|
filters |
Optional list of
TYPE:
|
filters_combinator |
How to combine multiple filters —
TYPE:
|
session_event |
Optional session anchor type —
TYPE:
|
Example
__post_init__
¶
Validate construction arguments.
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If event is empty or contains control characters (FL1), forward/reverse is outside 0-5 range (FL2), or session_event conflicts with event name (FS1). |
Source code in src/mixpanel_data/types.py
mixpanel_data.FlowTreeNode
dataclass
¶
FlowTreeNode(
event: str,
type: FlowNodeType,
step_number: int,
total_count: int,
drop_off_count: int = 0,
converted_count: int = 0,
anchor_type: FlowAnchorType = "NORMAL",
is_computed: bool = False,
children: tuple[FlowTreeNode, ...] = (),
time_percentiles_from_start: dict[str, Any] = dict(),
time_percentiles_from_prev: dict[str, Any] = dict(),
)
A node in a recursive flow prefix tree.
Represents a single event in a flow path tree returned by the Mixpanel
Flows API when using mode="tree". Each node tracks aggregate counts
(total, drop-off, converted) and optionally timing percentiles. Children
represent subsequent events in the flow.
The tree preserves full path context — unlike the sankey graph which merges nodes at the same step position, each tree node is unique to its specific path from root.
| ATTRIBUTE | DESCRIPTION |
|---|---|
event |
The event name at this position in the flow.
TYPE:
|
type |
Node type —
TYPE:
|
step_number |
Zero-based step index in the flow.
TYPE:
|
total_count |
Total number of users reaching this node.
TYPE:
|
drop_off_count |
Number of users who dropped off at this node.
TYPE:
|
converted_count |
Number of users who continued past this node.
TYPE:
|
anchor_type |
Anchor classification —
TYPE:
|
is_computed |
Whether this is a computed/custom event.
TYPE:
|
children |
Child nodes representing subsequent events. Defaults to an empty tuple.
TYPE:
|
time_percentiles_from_start |
Timing percentile data from flow start to this node. Empty dict if timing data is not enabled.
TYPE:
|
time_percentiles_from_prev |
Timing percentile data from the previous node to this node. Empty dict if timing data is not enabled.
TYPE:
|
Example
root = FlowTreeNode(
event="Login", type="ANCHOR", step_number=0,
total_count=1000, drop_off_count=50, converted_count=950,
children=(
FlowTreeNode(
event="Search", type="NORMAL", step_number=1,
total_count=600,
),
),
)
root.depth # 1
root.conversion_rate # 0.95
root.all_paths() # [[root, search_node]]
depth
property
¶
Maximum depth of the subtree rooted at this node.
A leaf node has depth 0. A node with one level of children has depth 1, and so on.
| RETURNS | DESCRIPTION |
|---|---|
int
|
Non-negative integer representing the longest path from |
int
|
this node to any leaf descendant. |
node_count
property
¶
leaf_count
property
¶
conversion_rate
property
¶
drop_off_rate
property
¶
all_paths
¶
Return all root-to-leaf paths through this subtree.
Each path is a list of FlowTreeNode objects from this node
down to a leaf, preserving the full node chain so callers can
inspect counts, rates, and timing along each path.
| RETURNS | DESCRIPTION |
|---|---|
list[list[FlowTreeNode]]
|
List of paths, where each path is a list of nodes. The |
list[list[FlowTreeNode]]
|
number of paths equals |
Example
Source code in src/mixpanel_data/types.py
find
¶
Find all nodes matching an event name via depth-first search.
| PARAMETER | DESCRIPTION |
|---|---|
event
|
The event name to search for.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[FlowTreeNode]
|
List of matching |
list[FlowTreeNode]
|
no nodes match. |
Source code in src/mixpanel_data/types.py
flatten
¶
Return all nodes in pre-order (depth-first) traversal.
The root node appears first, followed by its children's subtrees in order.
| RETURNS | DESCRIPTION |
|---|---|
list[FlowTreeNode]
|
List of all nodes in the subtree. Length equals |
list[FlowTreeNode]
|
|
Source code in src/mixpanel_data/types.py
to_dict
¶
Serialize the tree node recursively to a dictionary.
| RETURNS | DESCRIPTION |
|---|---|
dict[str, Any]
|
Dictionary with all node attributes and recursively |
dict[str, Any]
|
serialized children. Suitable for JSON serialization. |
Source code in src/mixpanel_data/types.py
render
¶
Render the tree as an ASCII string for debugging.
Uses box-drawing characters (├──, └──, │) to display
the tree hierarchy with event names and counts.
| PARAMETER | DESCRIPTION |
|---|---|
_prefix
|
Internal prefix for recursive indentation. Do not pass this argument directly.
TYPE:
|
_is_last
|
Internal flag for connector selection. Do not pass this argument directly.
TYPE:
|
_is_root
|
Internal flag distinguishing the root call from recursive children. Do not pass directly.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str
|
Multi-line string representation of the tree. |
Example
Source code in src/mixpanel_data/types.py
to_anytree
¶
Convert to an anytree.AnyNode tree with parent references.
Creates a parallel anytree representation of this subtree. Each anytree node carries the same attributes (event, type, counts, etc.) and gains parent references, path resolution, and rendering capabilities from the anytree library.
| RETURNS | DESCRIPTION |
|---|---|
Any
|
An |
Any
|
Use |
Any
|
and |
Example
Source code in src/mixpanel_data/types.py
mixpanel_data.FlowQueryResult
dataclass
¶
FlowQueryResult(
computed_at: str,
steps: list[dict[str, Any]] = list(),
flows: list[dict[str, Any]] = list(),
breakdowns: list[dict[str, Any]] = list(),
overall_conversion_rate: float = 0.0,
params: dict[str, Any] = dict(),
meta: dict[str, Any] = dict(),
mode: Literal["sankey", "paths", "tree"] = "sankey",
trees: list[FlowTreeNode] = list(),
*,
_df_cache: DataFrame | None = None,
_nodes_df_cache: DataFrame | None = None,
_edges_df_cache: DataFrame | None = None,
_graph_cache: DiGraph[str] | None = None,
_trees_df_cache: DataFrame | None = None,
_anytree_cache: list[object] | None = None,
)
Bases: ResultWithDataFrame
Result of an ad-hoc flow query.
Holds the raw flow analysis data returned by the Mixpanel API, including step nodes, flow edges, breakdowns, and overall conversion.
| ATTRIBUTE | DESCRIPTION |
|---|---|
computed_at |
ISO-8601 timestamp when the query was computed.
TYPE:
|
steps |
List of step-node dicts from the API response.
TYPE:
|
flows |
List of flow-edge dicts describing transitions between steps.
TYPE:
|
breakdowns |
List of breakdown dicts when a breakdown property is used.
TYPE:
|
overall_conversion_rate |
Overall conversion rate across the flow (0.0 to 1.0).
TYPE:
|
params |
The query parameters that produced this result.
TYPE:
|
meta |
API metadata (sampling factor, request timing, etc.).
TYPE:
|
mode |
The flow visualization mode —
TYPE:
|
Example
steps
class-attribute
instance-attribute
¶
Step-node dicts. Each conforms to :class:FlowStepNode.
flows
class-attribute
instance-attribute
¶
Flow-edge dicts. Each conforms to :class:FlowEdge.
meta
class-attribute
instance-attribute
¶
Response metadata. Conforms to :class:QueryMeta.
nodes_df
property
¶
Extract a flat DataFrame of nodes from sankey step data.
Each row represents a single node in the flow graph, with columns for step index, event name, node type, count, anchor type, custom event flag, and conversion rate change.
The totalCount field in the API response is a string and is
parsed to int here.
| RETURNS | DESCRIPTION |
|---|---|
DataFrame
|
DataFrame with columns: |
DataFrame
|
|
DataFrame
|
|
DataFrame
|
the correct columns when |
edges_df
property
¶
Extract a flat DataFrame of edges from sankey step data.
Each row represents a directed edge between two nodes in the flow graph, with columns for source step/event, target step/event, edge count, and target node type.
The totalCount field in the API response is a string and is
parsed to int here.
| RETURNS | DESCRIPTION |
|---|---|
DataFrame
|
DataFrame with columns: |
DataFrame
|
|
DataFrame
|
Returns an empty DataFrame with the correct columns when |
DataFrame
|
|
graph
property
¶
Build a networkx directed graph from sankey step data.
Nodes are keyed as "{event}@{step}" to distinguish the same
event appearing at different steps (e.g. "Login@0" vs
"Login@2"). Each node carries step, event, type,
count, and anchor_type attributes. Each edge carries
count and type attributes.
The graph is lazily constructed on first access and cached for subsequent calls.
| RETURNS | DESCRIPTION |
|---|---|
DiGraph
|
A |
DiGraph
|
empty graph when |
df
property
¶
Mode-aware DataFrame from flow data.
For sankey mode, returns the same DataFrame as nodes_df
(one row per node with step, event, type, count, etc.).
For paths mode, returns a tabular DataFrame with one row per
step in each flow path, including path_index, step,
event, type, and count columns.
| RETURNS | DESCRIPTION |
|---|---|
DataFrame
|
DataFrame built from nodes (sankey) or flow paths (paths). |
DataFrame
|
Returns an empty DataFrame if no data is available. |
anytree
property
¶
Lazily-cached list of anytree.AnyNode roots from tree data.
Each FlowTreeNode in trees is converted to an anytree
node tree via to_anytree(), enabling parent references,
path resolution, and RenderTree display.
| RETURNS | DESCRIPTION |
|---|---|
list[Any]
|
List of |
list[Any]
|
|
top_transitions
¶
Return the N highest-traffic transitions between events.
Uses the edges DataFrame to find the most common transitions, sorted by count descending.
| PARAMETER | DESCRIPTION |
|---|---|
n
|
Maximum number of transitions to return. Default: 10.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[tuple[str, str, int]]
|
List of (source_node, target_node, count) tuples sorted |
list[tuple[str, str, int]]
|
by count descending, where each node is formatted as |
list[tuple[str, str, int]]
|
|
list[tuple[str, str, int]]
|
list if no edges exist. |
Example
Source code in src/mixpanel_data/types.py
drop_off_summary
¶
Per-step drop-off counts and rates.
Analyzes each step to identify drop-off nodes (type == "DROPOFF") and calculates the drop-off rate relative to total traffic at that step.
| RETURNS | DESCRIPTION |
|---|---|
dict[str, Any]
|
Dict mapping step keys (e.g., "step_0") to dicts with: |
dict[str, Any]
|
|
dict[str, Any]
|
|
dict[str, Any]
|
|
dict[str, Any]
|
Returns empty dict if no steps exist. |
Example
Source code in src/mixpanel_data/types.py
to_dict
¶
Serialize the flow query result for JSON output.
| RETURNS | DESCRIPTION |
|---|---|
dict[str, Any]
|
Dictionary with all FlowQueryResult fields suitable for |
dict[str, Any]
|
JSON serialization. |
Source code in src/mixpanel_data/types.py
Legacy Query Results¶
mixpanel_data.SegmentationResult
dataclass
¶
SegmentationResult(
event: str,
from_date: str,
to_date: str,
unit: Literal["day", "week", "month"],
segment_property: str | None,
total: int,
series: dict[str, dict[str, int]] = dict(),
*,
_df_cache: DataFrame | None = None,
)
Bases: ResultWithDataFrame
Result of a segmentation query.
Contains time-series data for an event, optionally segmented by a property.
Inherits from ResultWithDataFrame to provide: - Lazy DataFrame caching via _df_cache field - Normalized table output via to_table_dict() method
segment_property
instance-attribute
¶
Property used for segmentation (None if total only).
series
class-attribute
instance-attribute
¶
Time series data by segment.
Structure: {segment_name: {date_string: count}} Example: {"US": {"2024-01-01": 150, "2024-01-02": 200}, "EU": {...}} For unsegmented queries, segment_name is "total".
df
property
¶
Convert to DataFrame with columns: date, segment, count.
For unsegmented queries, segment column is 'total'.
to_dict
¶
Serialize for JSON output.
Source code in src/mixpanel_data/types.py
mixpanel_data.FunnelResult
dataclass
¶
FunnelResult(
funnel_id: int,
funnel_name: str,
from_date: str,
to_date: str,
conversion_rate: float,
steps: list[FunnelResultStep] = list(),
*,
_df_cache: DataFrame | None = None,
)
Bases: ResultWithDataFrame
Result of a funnel query.
Contains step-by-step conversion data for a funnel.
Inherits from ResultWithDataFrame to provide: - Lazy DataFrame caching via _df_cache field - Normalized table output via to_table_dict() method
mixpanel_data.FunnelResultStep
dataclass
¶
Single step result in a legacy funnel query response.
conversion_rate
instance-attribute
¶
Conversion rate from previous step (0.0 to 1.0).
mixpanel_data.RetentionResult
dataclass
¶
RetentionResult(
born_event: str,
return_event: str,
from_date: str,
to_date: str,
unit: Literal["day", "week", "month"],
cohorts: list[CohortInfo] = list(),
*,
_df_cache: DataFrame | None = None,
)
Bases: ResultWithDataFrame
Result of a retention query.
Contains cohort-based retention data.
Inherits from ResultWithDataFrame to provide: - Lazy DataFrame caching via _df_cache field - Normalized table output via to_table_dict() method
mixpanel_data.CohortInfo
dataclass
¶
Retention data for a single cohort.
retention
class-attribute
instance-attribute
¶
Retention percentages by period (0.0 to 1.0).
mixpanel_data.JQLResult
dataclass
¶
Bases: ResultWithDataFrame
Result of a JQL query.
JQL (JavaScript Query Language) allows custom queries against Mixpanel data.
Inherits from ResultWithDataFrame to provide: - Lazy DataFrame caching via _df_cache field - Normalized table output via to_table_dict() method
The df property intelligently detects JQL result patterns (groupBy, percentiles, simple dicts) and converts them to clean tabular format.
df
property
¶
Convert result to DataFrame with intelligent structure detection.
The conversion strategy depends on the detected JQL result pattern:
groupBy results (detected by {key: [...], value: X} structure): - Keys expanded to columns: key_0, key_1, key_2, ... - Single value: "value" column - Multiple reducers (value array): value_0, value_1, value_2, ... - Additional fields (from .map()): preserved as-is - Example: {"key": ["US"], "value": 100, "name": "USA"} -> columns: key_0, value, name
Nested percentile results ([[{percentile: X, value: Y}, ...]]): - Outer list unwrapped, inner dicts converted directly
Simple list of dicts (already well-structured): - Converted directly to DataFrame preserving all fields
Fallback for other structures (scalars, mixed types, incompatible dicts): - Safely wrapped in single "value" column to prevent data loss - Used when structure doesn't match known patterns
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If groupBy structure has inconsistent value types across rows (some scalar, some array) which indicates malformed query results. |
| RETURNS | DESCRIPTION |
|---|---|
DataFrame
|
DataFrame representation, cached after first access. |
Discovery Types¶
mixpanel_data.FunnelInfo
dataclass
¶
A saved funnel definition.
Represents a funnel saved in Mixpanel that can be queried using the funnel() method.
mixpanel_data.SavedCohort
dataclass
¶
A saved cohort definition.
Represents a user cohort saved in Mixpanel for profile filtering.
to_dict
¶
Serialize for JSON output.
Source code in src/mixpanel_data/types.py
mixpanel_data.TopEvent
dataclass
¶
Today's event activity data.
Represents an event's current activity including count and trend.
| ATTRIBUTE | DESCRIPTION |
|---|---|
event |
Event name.
TYPE:
|
count |
Today's event count.
TYPE:
|
percent_change |
Change vs yesterday (-1.0 to +infinity).
TYPE:
|
Example
Subproperty Discovery Types¶
Types for Workspace.subproperties() — schema discovery for list-of-object event properties. See Subproperties for usage.
mixpanel_data.SubPropertyInfo
dataclass
¶
SubPropertyInfo(
name: str,
type: CustomPropertyType,
sample_values: tuple[str | int | float | bool, ...],
)
Discovered subproperty of a list-of-object event property.
Returned by :meth:Workspace.subproperties to describe the inner
structure of properties whose values are lists of objects (e.g.
cart is a list of {"Brand": str, "Category": str, "Price":
int} items). Use the name and type to construct
:meth:GroupBy.list_item and :meth:Filter.list_contains calls.
| ATTRIBUTE | DESCRIPTION |
|---|---|
name |
Subproperty name as it appears inside each object.
TYPE:
|
type |
Inferred data type. Mixed sub-value types collapse to
TYPE:
|
sample_values |
Up to 5 distinct sample values observed across the sampled rows.
TYPE:
|
Example
type
instance-attribute
¶
Inferred data type, suitable for GroupBy.list_item(sub_type=...).
sample_values
instance-attribute
¶
Up to 5 distinct sample values observed across the sampled rows.
to_dict
¶
Serialize the subproperty info as a plain dict for JSON output.
| RETURNS | DESCRIPTION |
|---|---|
dict[str, Any]
|
Dict with |
dict[str, Any]
|
|
dict[str, Any]
|
JSON serialization. |
Source code in src/mixpanel_data/types.py
Lexicon Types¶
mixpanel_data.LexiconSchema
dataclass
¶
Complete schema definition from Mixpanel Lexicon.
Represents a documented event or profile property definition from the Mixpanel data dictionary.
mixpanel_data.LexiconDefinition
dataclass
¶
LexiconDefinition(
description: str | None,
properties: dict[str, LexiconProperty],
metadata: LexiconMetadata | None,
)
Full schema definition for an event or profile property in Lexicon.
Contains the structural definition including description, properties, and platform-specific metadata.
properties
instance-attribute
¶
Property definitions keyed by property name.
metadata
instance-attribute
¶
Optional Mixpanel-specific metadata for the entity.
to_dict
¶
Serialize for JSON output.
| RETURNS | DESCRIPTION |
|---|---|
dict[str, Any]
|
Dictionary with properties, and optionally description and metadata. |
Source code in src/mixpanel_data/types.py
mixpanel_data.LexiconProperty
dataclass
¶
Schema definition for a single property in a Lexicon schema.
Describes the type and metadata for an event or profile property.
type
instance-attribute
¶
JSON Schema type (string, number, boolean, array, object, integer, null).
description
instance-attribute
¶
Human-readable description of the property.
to_dict
¶
Serialize for JSON output.
| RETURNS | DESCRIPTION |
|---|---|
dict[str, Any]
|
Dictionary with type, and optionally description and metadata. |
Source code in src/mixpanel_data/types.py
mixpanel_data.LexiconMetadata
dataclass
¶
LexiconMetadata(
source: str | None,
display_name: str | None,
tags: list[str],
hidden: bool,
dropped: bool,
contacts: list[str],
team_contacts: list[str],
)
Mixpanel-specific metadata for Lexicon schemas and properties.
Contains platform-specific information about how schemas and properties are displayed and organized in the Mixpanel UI.
source
instance-attribute
¶
Origin of the schema definition (e.g., 'api', 'csv', 'ui').
display_name
instance-attribute
¶
Human-readable display name in Mixpanel UI.
to_dict
¶
Serialize for JSON output.
| RETURNS | DESCRIPTION |
|---|---|
dict[str, Any]
|
Dictionary with all metadata fields. |
Source code in src/mixpanel_data/types.py
Event Analytics Results¶
mixpanel_data.EventCountsResult
dataclass
¶
EventCountsResult(
events: list[str],
from_date: str,
to_date: str,
unit: Literal["day", "week", "month"],
type: Literal["general", "unique", "average"],
series: dict[str, dict[str, int]],
*,
_df_cache: DataFrame | None = None,
)
Bases: ResultWithDataFrame
Time-series event count data.
Contains aggregate counts for multiple events over time with lazy DataFrame conversion support.
Inherits from ResultWithDataFrame to provide: - Lazy DataFrame caching via _df_cache field - Normalized table output via to_table_dict() method
mixpanel_data.PropertyCountsResult
dataclass
¶
PropertyCountsResult(
event: str,
property_name: str,
from_date: str,
to_date: str,
unit: Literal["day", "week", "month"],
type: Literal["general", "unique", "average"],
series: dict[str, dict[str, int]],
*,
_df_cache: DataFrame | None = None,
)
Bases: ResultWithDataFrame
Time-series property value distribution data.
Contains aggregate counts by property values over time with lazy DataFrame conversion support.
Inherits from ResultWithDataFrame to provide: - Lazy DataFrame caching via _df_cache field - Normalized table output via to_table_dict() method
series
instance-attribute
¶
Time series data by property value.
Structure: {property_value: {date: count}} Example: {"US": {"2024-01-01": 150, "2024-01-02": 200}, "EU": {...}}
df
property
¶
Convert to DataFrame with columns: date, value, count.
Conversion is lazy - computed on first access and cached.
to_dict
¶
Serialize for JSON output.
Source code in src/mixpanel_data/types.py
Advanced Query Results¶
mixpanel_data.UserEvent
dataclass
¶
mixpanel_data.ActivityFeedResult
dataclass
¶
ActivityFeedResult(
distinct_ids: list[str],
from_date: str | None,
to_date: str | None,
events: list[UserEvent] = list(),
*,
_df_cache: DataFrame | None = None,
)
Bases: ResultWithDataFrame
Collection of user events from activity feed query.
Contains chronological event history for one or more users with lazy DataFrame conversion support.
Inherits from ResultWithDataFrame to provide: - Lazy DataFrame caching via _df_cache field - Normalized table output via to_table_dict() method
from_date
instance-attribute
¶
Start date filter (YYYY-MM-DD), None if not specified.
to_date
instance-attribute
¶
End date filter (YYYY-MM-DD), None if not specified.
events
class-attribute
instance-attribute
¶
Event history (chronological order).
df
property
¶
Convert to DataFrame with columns: event, time, distinct_id, + properties.
Flattens event properties into individual columns. Conversion is lazy - computed on first access and cached.
to_dict
¶
Serialize for JSON output.
Source code in src/mixpanel_data/types.py
mixpanel_data.FrequencyResult
dataclass
¶
FrequencyResult(
event: str | None,
from_date: str,
to_date: str,
unit: Literal["day", "week", "month"],
addiction_unit: Literal["hour", "day"],
data: dict[str, list[int]] = dict(),
*,
_df_cache: DataFrame | None = None,
)
Bases: ResultWithDataFrame
Event frequency distribution (addiction analysis).
Contains frequency arrays showing how many users performed events in N time periods, with lazy DataFrame conversion support.
Inherits from ResultWithDataFrame to provide: - Lazy DataFrame caching via _df_cache field - Normalized table output via to_table_dict() method
data
class-attribute
instance-attribute
¶
Frequency arrays by date.
Structure: {date: [count_1, count_2, ...]} Example: {"2024-01-01": [100, 50, 25, 10]}
Each array shows user counts by frequency: - Index 0: users active exactly 1 time - Index 1: users active exactly 2 times - Index N: users active exactly N+1 times
df
property
¶
Convert to DataFrame with columns: date, period_1, period_2, ...
Each period_N column shows users active in at least N time periods. Conversion is lazy - computed on first access and cached.
to_dict
¶
Serialize for JSON output.
Source code in src/mixpanel_data/types.py
mixpanel_data.NumericBucketResult
dataclass
¶
NumericBucketResult(
event: str,
from_date: str,
to_date: str,
property_expr: str,
unit: Literal["hour", "day"],
series: dict[str, dict[str, int]] = dict(),
*,
_df_cache: DataFrame | None = None,
)
Bases: ResultWithDataFrame
Events segmented into numeric property ranges.
Contains time-series data bucketed by automatically determined numeric ranges, with lazy DataFrame conversion support.
Inherits from ResultWithDataFrame to provide: - Lazy DataFrame caching via _df_cache field - Normalized table output via to_table_dict() method
mixpanel_data.NumericSumResult
dataclass
¶
NumericSumResult(
event: str,
from_date: str,
to_date: str,
property_expr: str,
unit: Literal["hour", "day"],
results: dict[str, float] = dict(),
computed_at: str | None = None,
*,
_df_cache: DataFrame | None = None,
)
Bases: ResultWithDataFrame
Sum of numeric property values per time unit.
Contains daily or hourly sum totals for a numeric property with lazy DataFrame conversion support.
Inherits from ResultWithDataFrame to provide: - Lazy DataFrame caching via _df_cache field - Normalized table output via to_table_dict() method
results
class-attribute
instance-attribute
¶
Sum values: {date: sum}.
computed_at
class-attribute
instance-attribute
¶
Computation timestamp (if provided by API).
df
property
¶
Convert to DataFrame with columns: date, sum.
Conversion is lazy - computed on first access and cached.
to_dict
¶
Serialize for JSON output.
Source code in src/mixpanel_data/types.py
mixpanel_data.NumericAverageResult
dataclass
¶
NumericAverageResult(
event: str,
from_date: str,
to_date: str,
property_expr: str,
unit: Literal["hour", "day"],
results: dict[str, float] = dict(),
*,
_df_cache: DataFrame | None = None,
)
Bases: ResultWithDataFrame
Average of numeric property values per time unit.
Contains daily or hourly average values for a numeric property with lazy DataFrame conversion support.
Inherits from ResultWithDataFrame to provide: - Lazy DataFrame caching via _df_cache field - Normalized table output via to_table_dict() method
Bookmark Types¶
mixpanel_data.BookmarkInfo
dataclass
¶
BookmarkInfo(
id: int,
name: str,
type: BookmarkType,
project_id: int,
created: str,
modified: str,
workspace_id: int | None = None,
dashboard_id: int | None = None,
description: str | None = None,
creator_id: int | None = None,
creator_name: str | None = None,
)
Metadata for a saved report (bookmark) from the Mixpanel Bookmarks API.
Represents a saved Insights, Funnel, Retention, or Flows report that can be queried using query_saved_report() or query_saved_flows().
| ATTRIBUTE | DESCRIPTION |
|---|---|
id |
Unique bookmark identifier.
TYPE:
|
name |
User-defined report name.
TYPE:
|
type |
Report type (insights, funnels, retention, flows, launch-analysis).
TYPE:
|
project_id |
Parent Mixpanel project ID.
TYPE:
|
created |
Creation timestamp (ISO format).
TYPE:
|
modified |
Last modification timestamp (ISO format).
TYPE:
|
workspace_id |
Optional workspace ID if scoped to a workspace.
TYPE:
|
dashboard_id |
Optional parent dashboard ID if linked to a dashboard.
TYPE:
|
description |
Optional user-provided description.
TYPE:
|
creator_id |
Optional creator's user ID.
TYPE:
|
creator_name |
Optional creator's display name.
TYPE:
|
workspace_id
class-attribute
instance-attribute
¶
Workspace ID if scoped to a workspace.
dashboard_id
class-attribute
instance-attribute
¶
Parent dashboard ID if linked to a dashboard.
description
class-attribute
instance-attribute
¶
User-provided description.
creator_name
class-attribute
instance-attribute
¶
Creator's display name.
to_dict
¶
Serialize for JSON output.
| RETURNS | DESCRIPTION |
|---|---|
dict[str, Any]
|
Dictionary with all bookmark metadata fields. |
Source code in src/mixpanel_data/types.py
mixpanel_data.SavedReportResult
dataclass
¶
SavedReportResult(
bookmark_id: int,
computed_at: str,
from_date: str,
to_date: str,
headers: list[str] = list(),
series: dict[str, Any] = dict(),
_df_cache: DataFrame | None = None,
)
Data from a saved report (Insights, Retention, or Funnel).
Contains data from a pre-configured saved report with automatic report type detection and lazy DataFrame conversion support.
The report_type property automatically detects the report type based on headers: "$retention" indicates retention, "$funnel" indicates funnel, otherwise it's an insights report.
| ATTRIBUTE | DESCRIPTION |
|---|---|
bookmark_id |
Saved report identifier.
TYPE:
|
computed_at |
When report was computed (ISO format).
TYPE:
|
from_date |
Report start date.
TYPE:
|
to_date |
Report end date.
TYPE:
|
headers |
Report column headers (used for type detection).
TYPE:
|
series |
Report data (structure varies by report type).
TYPE:
|
headers
class-attribute
instance-attribute
¶
Report column headers (used for type detection).
series
class-attribute
instance-attribute
¶
Report data (structure varies by report type).
For Insights reports: {event_name: {date: count}} For Retention reports: {series_name: {date: {segment: {first, counts, rates}}}} For Funnel reports: {count: {...}, overall_conv_ratio: {...}, ...}
report_type
property
¶
Detect the report type from headers.
| RETURNS | DESCRIPTION |
|---|---|
SavedReportType
|
'retention' if headers contain '$retention', |
SavedReportType
|
'funnel' if headers contain '$funnel', |
SavedReportType
|
'flows' if headers contain '$flows', |
SavedReportType
|
'insights' otherwise. |
df
property
¶
Convert to DataFrame.
For Insights reports: columns are date, event, count. For Retention/Funnel reports: flattens the nested structure.
Conversion is lazy - computed on first access and cached.
to_dict
¶
Serialize for JSON output.
| RETURNS | DESCRIPTION |
|---|---|
dict[str, Any]
|
Dictionary with all report fields including detected report_type. |
Source code in src/mixpanel_data/types.py
mixpanel_data.FlowsResult
dataclass
¶
FlowsResult(
bookmark_id: int,
computed_at: str,
steps: list[dict[str, Any]] = list(),
breakdowns: list[dict[str, Any]] = list(),
overall_conversion_rate: float = 0.0,
metadata: dict[str, Any] = dict(),
*,
_df_cache: DataFrame | None = None,
)
Bases: ResultWithDataFrame
Data from a saved Flows report.
Contains user path/navigation data from a pre-configured Flows report with lazy DataFrame conversion support.
Inherits from ResultWithDataFrame to provide: - Lazy DataFrame caching via _df_cache field - Normalized table output via to_table_dict() method
| ATTRIBUTE | DESCRIPTION |
|---|---|
bookmark_id |
Saved report identifier.
TYPE:
|
computed_at |
When report was computed (ISO format).
TYPE:
|
steps |
Flow step data with event sequences and counts.
TYPE:
|
breakdowns |
Path breakdown data showing user flow distribution.
TYPE:
|
overall_conversion_rate |
End-to-end conversion rate (0.0 to 1.0).
TYPE:
|
metadata |
Additional API metadata from the response.
TYPE:
|
steps
class-attribute
instance-attribute
¶
Flow step data with event sequences and counts.
breakdowns
class-attribute
instance-attribute
¶
Path breakdown data showing user flow distribution.
overall_conversion_rate
class-attribute
instance-attribute
¶
End-to-end conversion rate (0.0 to 1.0).
metadata
class-attribute
instance-attribute
¶
Additional API metadata from the response.
df
property
¶
Convert steps to DataFrame.
Returns DataFrame with columns derived from step data structure. Conversion is lazy - computed on first access and cached.
to_dict
¶
Serialize for JSON output.
| RETURNS | DESCRIPTION |
|---|---|
dict[str, Any]
|
Dictionary with all flows report fields. |
Source code in src/mixpanel_data/types.py
JQL Discovery Types¶
mixpanel_data.PropertyDistributionResult
dataclass
¶
PropertyDistributionResult(
event: str,
property_name: str,
from_date: str,
to_date: str,
total_count: int,
values: tuple[PropertyValueCount, ...],
_df_cache: DataFrame | None = None,
)
Distribution of values for a property from JQL analysis.
Contains the top N values for a property with their counts and percentages, enabling quick understanding of property value distribution without processing all raw events.
| ATTRIBUTE | DESCRIPTION |
|---|---|
event |
The event type analyzed.
TYPE:
|
property_name |
The property name analyzed.
TYPE:
|
from_date |
Query start date (YYYY-MM-DD).
TYPE:
|
to_date |
Query end date (YYYY-MM-DD).
TYPE:
|
total_count |
Total number of events with this property defined.
TYPE:
|
values |
Top values with counts and percentages.
TYPE:
|
values
instance-attribute
¶
Top values with counts and percentages.
df
property
¶
Convert to DataFrame with columns: value, count, percentage.
Conversion is lazy - computed on first access and cached.
| RETURNS | DESCRIPTION |
|---|---|
DataFrame
|
DataFrame with value distribution data. |
to_dict
¶
Serialize for JSON output.
| RETURNS | DESCRIPTION |
|---|---|
dict[str, Any]
|
Dictionary with all distribution data. |
Source code in src/mixpanel_data/types.py
mixpanel_data.PropertyValueCount
dataclass
¶
A single value and its count from property distribution analysis.
Represents one row in a property value distribution, showing the value, its occurrence count, and percentage of total.
| ATTRIBUTE | DESCRIPTION |
|---|---|
value |
The property value (can be string, number, bool, or None).
TYPE:
|
count |
Number of occurrences of this value.
TYPE:
|
percentage |
Percentage of total events (0.0 to 100.0).
TYPE:
|
to_dict
¶
Serialize for JSON output.
| RETURNS | DESCRIPTION |
|---|---|
dict[str, Any]
|
Dictionary with value, count, and percentage. |
Source code in src/mixpanel_data/types.py
mixpanel_data.NumericPropertySummaryResult
dataclass
¶
NumericPropertySummaryResult(
event: str,
property_name: str,
from_date: str,
to_date: str,
count: int,
min: float,
max: float,
sum: float,
avg: float,
stddev: float,
percentiles: dict[int, float],
)
Statistical summary of a numeric property from JQL analysis.
Contains min, max, sum, average, standard deviation, and percentiles for a numeric property, enabling understanding of value distributions without processing all raw events.
| ATTRIBUTE | DESCRIPTION |
|---|---|
event |
The event type analyzed.
TYPE:
|
property_name |
The property name analyzed.
TYPE:
|
from_date |
Query start date (YYYY-MM-DD).
TYPE:
|
to_date |
Query end date (YYYY-MM-DD).
TYPE:
|
count |
Number of events with this property defined.
TYPE:
|
min |
Minimum value.
TYPE:
|
max |
Maximum value.
TYPE:
|
sum |
Sum of all values.
TYPE:
|
avg |
Average value.
TYPE:
|
stddev |
Standard deviation.
TYPE:
|
percentiles |
Percentile values keyed by percentile number.
TYPE:
|
percentiles
instance-attribute
¶
Percentile values keyed by percentile number (e.g., {50: 98.0}).
to_dict
¶
Serialize for JSON output.
| RETURNS | DESCRIPTION |
|---|---|
dict[str, Any]
|
Dictionary with all numeric summary data. |
Source code in src/mixpanel_data/types.py
mixpanel_data.DailyCountsResult
dataclass
¶
DailyCountsResult(
from_date: str,
to_date: str,
events: tuple[str, ...] | None,
counts: tuple[DailyCount, ...],
_df_cache: DataFrame | None = None,
)
Time-series event counts by day from JQL analysis.
Contains daily event counts for quick activity trend analysis without complex segmentation setup.
| ATTRIBUTE | DESCRIPTION |
|---|---|
from_date |
Query start date (YYYY-MM-DD).
TYPE:
|
to_date |
Query end date (YYYY-MM-DD).
TYPE:
|
events |
Event types included (None for all events).
TYPE:
|
counts |
Daily counts for each event.
TYPE:
|
events
instance-attribute
¶
Event types included (None for all events).
df
property
¶
Convert to DataFrame with columns: date, event, count.
Conversion is lazy - computed on first access and cached.
| RETURNS | DESCRIPTION |
|---|---|
DataFrame
|
DataFrame with daily counts data. |
to_dict
¶
Serialize for JSON output.
| RETURNS | DESCRIPTION |
|---|---|
dict[str, Any]
|
Dictionary with all daily counts data. |
Source code in src/mixpanel_data/types.py
mixpanel_data.DailyCount
dataclass
¶
Event count for a single date from daily counts analysis.
Represents one row in a daily counts result, showing date, event, and count.
| ATTRIBUTE | DESCRIPTION |
|---|---|
date |
Date string (YYYY-MM-DD).
TYPE:
|
event |
Event name.
TYPE:
|
count |
Number of occurrences on this date.
TYPE:
|
to_dict
¶
Serialize for JSON output.
| RETURNS | DESCRIPTION |
|---|---|
dict[str, Any]
|
Dictionary with date, event, and count. |
mixpanel_data.EngagementDistributionResult
dataclass
¶
EngagementDistributionResult(
from_date: str,
to_date: str,
events: tuple[str, ...] | None,
total_users: int,
buckets: tuple[EngagementBucket, ...],
_df_cache: DataFrame | None = None,
)
User engagement distribution from JQL analysis.
Shows how many users performed N events, helping understand user engagement patterns without processing all raw events.
| ATTRIBUTE | DESCRIPTION |
|---|---|
from_date |
Query start date (YYYY-MM-DD).
TYPE:
|
to_date |
Query end date (YYYY-MM-DD).
TYPE:
|
events |
Event types included (None for all events).
TYPE:
|
total_users |
Total number of distinct users.
TYPE:
|
buckets |
Engagement buckets with user counts.
TYPE:
|
events
instance-attribute
¶
Event types included (None for all events).
buckets
instance-attribute
¶
Engagement buckets with user counts.
df
property
¶
Convert to DataFrame with engagement bucket columns.
Conversion is lazy - computed on first access and cached.
| RETURNS | DESCRIPTION |
|---|---|
DataFrame
|
DataFrame with engagement distribution data. |
to_dict
¶
Serialize for JSON output.
| RETURNS | DESCRIPTION |
|---|---|
dict[str, Any]
|
Dictionary with all engagement distribution data. |
Source code in src/mixpanel_data/types.py
mixpanel_data.EngagementBucket
dataclass
¶
User count in an engagement bucket from engagement analysis.
Represents one bucket in a user engagement distribution, showing how many users performed events in a certain frequency range.
| ATTRIBUTE | DESCRIPTION |
|---|---|
bucket_min |
Minimum events in this bucket.
TYPE:
|
bucket_label |
Human-readable label (e.g., "1", "2-5", "100+").
TYPE:
|
user_count |
Number of users in this bucket.
TYPE:
|
percentage |
Percentage of total users (0.0 to 100.0).
TYPE:
|
mixpanel_data.PropertyCoverageResult
dataclass
¶
PropertyCoverageResult(
event: str,
from_date: str,
to_date: str,
total_events: int,
coverage: tuple[PropertyCoverage, ...],
_df_cache: DataFrame | None = None,
)
Property coverage analysis result from JQL.
Shows which properties are consistently populated vs sparse, helping understand data quality before writing queries.
| ATTRIBUTE | DESCRIPTION |
|---|---|
event |
The event type analyzed.
TYPE:
|
from_date |
Query start date (YYYY-MM-DD).
TYPE:
|
to_date |
Query end date (YYYY-MM-DD).
TYPE:
|
total_events |
Total number of events analyzed.
TYPE:
|
coverage |
Coverage statistics for each property.
TYPE:
|
coverage
instance-attribute
¶
Coverage statistics for each property.
df
property
¶
Convert to DataFrame with property coverage columns.
Conversion is lazy - computed on first access and cached.
| RETURNS | DESCRIPTION |
|---|---|
DataFrame
|
DataFrame with property coverage data. |
to_dict
¶
Serialize for JSON output.
| RETURNS | DESCRIPTION |
|---|---|
dict[str, Any]
|
Dictionary with all coverage data. |
Source code in src/mixpanel_data/types.py
mixpanel_data.PropertyCoverage
dataclass
¶
Coverage statistics for a single property from coverage analysis.
Shows how often a property is defined vs null for a given event type.
| ATTRIBUTE | DESCRIPTION |
|---|---|
property |
Property name.
TYPE:
|
defined_count |
Number of events with this property defined.
TYPE:
|
null_count |
Number of events with this property null/undefined.
TYPE:
|
coverage_percentage |
Percentage of events with property defined (0.0-100.0).
TYPE:
|
Dashboard CRUD Types¶
mixpanel_data.Dashboard
¶
Bases: BaseModel
A Mixpanel dashboard as returned by the App API.
Represents the full dashboard entity including metadata, permissions,
and optional layout/content fields. Extra fields from API evolution
are preserved via extra="allow".
| ATTRIBUTE | DESCRIPTION |
|---|---|
id |
Unique dashboard identifier.
TYPE:
|
title |
Dashboard title.
TYPE:
|
description |
Dashboard description.
TYPE:
|
is_private |
Whether the dashboard is private.
TYPE:
|
is_restricted |
Whether the dashboard has restricted access.
TYPE:
|
creator_id |
ID of the dashboard creator.
TYPE:
|
creator_name |
Name of the dashboard creator.
TYPE:
|
creator_email |
Email of the dashboard creator.
TYPE:
|
created |
Creation timestamp (lenient parsing).
TYPE:
|
modified |
Last modification timestamp.
TYPE:
|
is_favorited |
Whether the current user has favorited this dashboard.
TYPE:
|
pinned_date |
Date the dashboard was pinned, if any.
TYPE:
|
layout_version |
Layout version metadata.
TYPE:
|
unique_view_count |
Number of unique viewers.
TYPE:
|
total_view_count |
Total view count.
TYPE:
|
last_modified_by_id |
ID of the last modifier.
TYPE:
|
last_modified_by_name |
Name of the last modifier.
TYPE:
|
last_modified_by_email |
Email of the last modifier.
TYPE:
|
filters |
Dashboard-level filters.
TYPE:
|
breakdowns |
Dashboard-level breakdowns.
TYPE:
|
time_filter |
Dashboard-level time filter.
TYPE:
|
generation_type |
How the dashboard was generated.
TYPE:
|
parent_dashboard_id |
Parent dashboard ID for nested dashboards.
TYPE:
|
child_dashboards |
Child dashboard references.
TYPE:
|
can_update_basic |
Permission flag.
TYPE:
|
can_share |
Permission flag.
TYPE:
|
can_view |
Permission flag.
TYPE:
|
can_update_restricted |
Permission flag.
TYPE:
|
can_update_visibility |
Permission flag.
TYPE:
|
is_superadmin |
Whether current user is superadmin.
TYPE:
|
allow_staff_override |
Whether staff override is allowed.
TYPE:
|
can_pin |
Whether current user can pin.
TYPE:
|
is_shared_with_project |
Whether shared with the project.
TYPE:
|
creator |
Creator identifier string.
TYPE:
|
ancestors |
Ancestor dashboard references.
TYPE:
|
layout |
Dashboard layout data.
TYPE:
|
contents |
Dashboard contents data.
TYPE:
|
num_active_public_links |
Number of active public links.
TYPE:
|
new_content |
New content data.
TYPE:
|
template_type |
Template type if created from a template.
TYPE:
|
Example
dashboard = Dashboard(
id=1, title="Q1 Metrics", is_private=False,
is_restricted=False, is_favorited=False,
can_update_basic=True, can_share=True, can_view=True,
can_update_restricted=False, can_update_visibility=False,
is_superadmin=False, allow_staff_override=False,
can_pin=True, is_shared_with_project=True, ancestors=[],
)
assert dashboard.title == "Q1 Metrics"
description
class-attribute
instance-attribute
¶
Dashboard description.
is_private
class-attribute
instance-attribute
¶
Whether the dashboard is private.
is_restricted
class-attribute
instance-attribute
¶
Whether the dashboard has restricted access.
creator_id
class-attribute
instance-attribute
¶
ID of the dashboard creator.
creator_name
class-attribute
instance-attribute
¶
Name of the dashboard creator.
creator_email
class-attribute
instance-attribute
¶
Email of the dashboard creator.
modified
class-attribute
instance-attribute
¶
Last modification timestamp.
is_favorited
class-attribute
instance-attribute
¶
Whether the current user has favorited this dashboard.
pinned_date
class-attribute
instance-attribute
¶
Date the dashboard was pinned, if any.
layout_version
class-attribute
instance-attribute
¶
Layout version metadata.
unique_view_count
class-attribute
instance-attribute
¶
Number of unique viewers.
total_view_count
class-attribute
instance-attribute
¶
Total view count.
last_modified_by_id
class-attribute
instance-attribute
¶
ID of the last modifier.
last_modified_by_name
class-attribute
instance-attribute
¶
Name of the last modifier.
last_modified_by_email
class-attribute
instance-attribute
¶
Email of the last modifier.
filters
class-attribute
instance-attribute
¶
Dashboard-level filters.
breakdowns
class-attribute
instance-attribute
¶
Dashboard-level breakdowns.
time_filter
class-attribute
instance-attribute
¶
Dashboard-level time filter.
generation_type
class-attribute
instance-attribute
¶
How the dashboard was generated.
parent_dashboard_id
class-attribute
instance-attribute
¶
Parent dashboard ID for nested dashboards.
child_dashboards
class-attribute
instance-attribute
¶
Child dashboard references.
can_update_basic
class-attribute
instance-attribute
¶
Permission: can update basic fields.
can_update_restricted
class-attribute
instance-attribute
¶
Permission: can update restricted fields.
can_update_visibility
class-attribute
instance-attribute
¶
Permission: can update visibility.
is_superadmin
class-attribute
instance-attribute
¶
Whether current user is superadmin.
allow_staff_override
class-attribute
instance-attribute
¶
Whether staff override is allowed.
is_shared_with_project
class-attribute
instance-attribute
¶
Whether shared with the project.
ancestors
class-attribute
instance-attribute
¶
Ancestor dashboard references.
num_active_public_links
class-attribute
instance-attribute
¶
Number of active public links.
template_type
class-attribute
instance-attribute
¶
Template type if created from a template.
mixpanel_data.CreateDashboardParams
¶
Bases: BaseModel
Parameters for creating a new dashboard.
| ATTRIBUTE | DESCRIPTION |
|---|---|
title |
Dashboard title (required).
TYPE:
|
description |
Dashboard description.
TYPE:
|
is_private |
Whether the dashboard should be private.
TYPE:
|
is_restricted |
Whether the dashboard should have restricted access.
TYPE:
|
filters |
Dashboard-level filters.
TYPE:
|
breakdowns |
Dashboard-level breakdowns.
TYPE:
|
time_filter |
Dashboard-level time filter.
TYPE:
|
duplicate |
ID of dashboard to duplicate.
TYPE:
|
rows |
Initial dashboard content with layout. Each row contains 1-4
content items (text cards or reports). Items in the same row are
placed side-by-side with auto-distributed widths. This is the
recommended way to create dashboards with proper layout — adding
content after creation via
TYPE:
|
Example
import json
params = CreateDashboardParams(
title="Product Health",
rows=[
DashboardRow(contents=[
DashboardRowContent(
content_type="text",
content_params={"markdown": "<h2>Overview</h2>"},
),
]),
DashboardRow(contents=[
DashboardRowContent(
content_type="report",
content_params={"bookmark": {
"name": "DAU", "type": "insights",
"params": json.dumps(dau_result.params),
}},
),
DashboardRowContent(
content_type="report",
content_params={"bookmark": {
"name": "Signups", "type": "insights",
"params": json.dumps(signup_result.params),
}},
),
]),
],
)
description
class-attribute
instance-attribute
¶
Dashboard description.
is_private
class-attribute
instance-attribute
¶
Whether the dashboard should be private.
is_restricted
class-attribute
instance-attribute
¶
Whether the dashboard should have restricted access.
filters
class-attribute
instance-attribute
¶
Dashboard-level filters.
breakdowns
class-attribute
instance-attribute
¶
Dashboard-level breakdowns.
time_filter
class-attribute
instance-attribute
¶
Dashboard-level time filter.
duplicate
class-attribute
instance-attribute
¶
ID of dashboard to duplicate.
rows
class-attribute
instance-attribute
¶
Initial content rows with layout. Each row has 1-4 content items.
mixpanel_data.UpdateDashboardParams
¶
Bases: BaseModel
Parameters for updating an existing dashboard.
All fields are optional — only provided fields are sent to the API.
| ATTRIBUTE | DESCRIPTION |
|---|---|
title |
New dashboard title.
TYPE:
|
description |
New dashboard description.
TYPE:
|
is_private |
New privacy setting.
TYPE:
|
is_restricted |
New restriction setting.
TYPE:
|
filters |
New dashboard-level filters.
TYPE:
|
breakdowns |
New dashboard-level breakdowns.
TYPE:
|
time_filter |
New dashboard-level time filter.
TYPE:
|
layout |
New dashboard layout data.
TYPE:
|
content |
New dashboard content data.
TYPE:
|
Example
description
class-attribute
instance-attribute
¶
New dashboard description.
is_restricted
class-attribute
instance-attribute
¶
New restriction setting.
filters
class-attribute
instance-attribute
¶
New dashboard-level filters.
breakdowns
class-attribute
instance-attribute
¶
New dashboard-level breakdowns.
time_filter
class-attribute
instance-attribute
¶
New dashboard-level time filter.
mixpanel_data.BlueprintTemplate
¶
Bases: BaseModel
A dashboard blueprint template.
| ATTRIBUTE | DESCRIPTION |
|---|---|
title_key |
Template title key.
TYPE:
|
description_key |
Template description key.
TYPE:
|
alternative_description_key |
Alternative description key.
TYPE:
|
number_of_reports |
Number of reports in the template.
TYPE:
|
mixpanel_data.BlueprintConfig
¶
mixpanel_data.BlueprintCard
¶
Bases: BaseModel
A card in a blueprint dashboard.
| ATTRIBUTE | DESCRIPTION |
|---|---|
card_type |
Card type (serialized as
TYPE:
|
text_card_id |
Text card ID, if applicable.
TYPE:
|
bookmark_id |
Bookmark ID, if applicable.
TYPE:
|
markdown |
Markdown content for text cards.
TYPE:
|
name |
Card name.
TYPE:
|
params |
Card parameters.
TYPE:
|
Example
card_type
class-attribute
instance-attribute
¶
Card type (serialized as "type").
text_card_id
class-attribute
instance-attribute
¶
Text card ID, if applicable.
bookmark_id
class-attribute
instance-attribute
¶
Bookmark ID, if applicable.
markdown
class-attribute
instance-attribute
¶
Markdown content for text cards.
mixpanel_data.BlueprintFinishParams
¶
Bases: BaseModel
Parameters for finalizing a blueprint dashboard.
| ATTRIBUTE | DESCRIPTION |
|---|---|
dashboard_id |
ID of the blueprint dashboard to finalize.
TYPE:
|
cards |
List of cards to include.
TYPE:
|
Example
mixpanel_data.CreateRcaDashboardParams
¶
Bases: BaseModel
Parameters for creating an RCA dashboard.
| ATTRIBUTE | DESCRIPTION |
|---|---|
rca_source_id |
Source ID for RCA analysis.
TYPE:
|
rca_source_data |
Source data configuration.
TYPE:
|
Example
mixpanel_data.RcaSourceData
¶
Bases: BaseModel
Source data for RCA dashboard creation.
| ATTRIBUTE | DESCRIPTION |
|---|---|
source_type |
Source type (serialized as
TYPE:
|
date |
Date string.
TYPE:
|
metric_source |
Whether this is a metric source.
TYPE:
|
Example
mixpanel_data.UpdateReportLinkParams
¶
mixpanel_data.UpdateTextCardParams
¶
Report CRUD Types¶
mixpanel_data.Bookmark
¶
Bases: BaseModel
A Mixpanel bookmark (saved report) as returned by the App API.
Represents the full bookmark entity including query parameters,
metadata, and permissions. The bookmark_type field is aliased
from "type" in the API response.
| ATTRIBUTE | DESCRIPTION |
|---|---|
id |
Unique bookmark identifier.
TYPE:
|
project_id |
Parent project identifier.
TYPE:
|
name |
Bookmark name.
TYPE:
|
bookmark_type |
Report type (aliased from
TYPE:
|
description |
Bookmark description.
TYPE:
|
icon |
Bookmark icon.
TYPE:
|
params |
Query parameters (JSON value defining the report).
TYPE:
|
dashboard_id |
Associated dashboard ID.
TYPE:
|
include_in_dashboard |
Whether included in dashboard.
TYPE:
|
is_default |
Whether this is a default bookmark.
TYPE:
|
creator_id |
ID of the creator.
TYPE:
|
creator_name |
Name of the creator.
TYPE:
|
creator_email |
Email of the creator.
TYPE:
|
created |
Creation timestamp.
TYPE:
|
modified |
Last modification timestamp.
TYPE:
|
last_modified_by_id |
ID of the last modifier.
TYPE:
|
last_modified_by_name |
Name of the last modifier.
TYPE:
|
last_modified_by_email |
Email of the last modifier.
TYPE:
|
metadata |
Report-specific metadata.
TYPE:
|
is_visibility_restricted |
Visibility restriction flag.
TYPE:
|
is_modification_restricted |
Modification restriction flag.
TYPE:
|
can_update_basic |
Permission flag.
TYPE:
|
can_view |
Permission flag.
TYPE:
|
can_share |
Permission flag.
TYPE:
|
generation_type |
How the bookmark was generated.
TYPE:
|
original_type |
Original report type before conversion.
TYPE:
|
unique_view_count |
Number of unique viewers.
TYPE:
|
total_view_count |
Total view count.
TYPE:
|
Example
project_id
class-attribute
instance-attribute
¶
Parent project identifier.
bookmark_type
class-attribute
instance-attribute
¶
Report type (aliased from "type").
description
class-attribute
instance-attribute
¶
Bookmark description.
params
class-attribute
instance-attribute
¶
Query parameters (JSON value defining the report).
dashboard_id
class-attribute
instance-attribute
¶
Associated dashboard ID.
include_in_dashboard
class-attribute
instance-attribute
¶
Whether included in dashboard.
is_default
class-attribute
instance-attribute
¶
Whether this is a default bookmark.
creator_name
class-attribute
instance-attribute
¶
Name of the creator.
creator_email
class-attribute
instance-attribute
¶
Email of the creator.
modified
class-attribute
instance-attribute
¶
Last modification timestamp.
last_modified_by_id
class-attribute
instance-attribute
¶
ID of the last modifier.
last_modified_by_name
class-attribute
instance-attribute
¶
Name of the last modifier.
last_modified_by_email
class-attribute
instance-attribute
¶
Email of the last modifier.
metadata
class-attribute
instance-attribute
¶
Report-specific metadata.
is_visibility_restricted
class-attribute
instance-attribute
¶
Visibility restriction flag.
is_modification_restricted
class-attribute
instance-attribute
¶
Modification restriction flag.
can_update_basic
class-attribute
instance-attribute
¶
Permission: can update basic fields.
generation_type
class-attribute
instance-attribute
¶
How the bookmark was generated.
original_type
class-attribute
instance-attribute
¶
Original report type before conversion.
unique_view_count
class-attribute
instance-attribute
¶
Number of unique viewers.
total_view_count
class-attribute
instance-attribute
¶
Total view count.
mixpanel_data.BookmarkMetadata
¶
Bases: BaseModel
Metadata associated with a bookmark/report.
Contains optional display and calculation settings that vary by bookmark type (insights, funnels, retention, etc.).
| ATTRIBUTE | DESCRIPTION |
|---|---|
table_display_mode |
Table display mode setting.
TYPE:
|
compare_enabled |
Whether comparison is enabled.
TYPE:
|
compare_filters |
Comparison filter settings.
TYPE:
|
retention_calculation_type |
Retention calculation method.
TYPE:
|
event_name |
Associated event name.
TYPE:
|
funnel_conversion_window |
Funnel conversion window in days.
TYPE:
|
funnel_breakdown_limit |
Maximum funnel breakdown count.
TYPE:
|
table_display_mode
class-attribute
instance-attribute
¶
Table display mode setting.
compare_enabled
class-attribute
instance-attribute
¶
Whether comparison is enabled.
compare_filters
class-attribute
instance-attribute
¶
Comparison filter settings.
retention_calculation_type
class-attribute
instance-attribute
¶
Retention calculation method.
event_name
class-attribute
instance-attribute
¶
Associated event name.
funnel_conversion_window
class-attribute
instance-attribute
¶
Funnel conversion window in days.
funnel_breakdown_limit
class-attribute
instance-attribute
¶
Maximum funnel breakdown count.
mixpanel_data.CreateBookmarkParams
¶
Bases: BaseModel
Parameters for creating a new bookmark/report.
| ATTRIBUTE | DESCRIPTION |
|---|---|
name |
Bookmark name (required).
TYPE:
|
bookmark_type |
Report type (required, serialized as
TYPE:
|
params |
Query parameters (required).
TYPE:
|
description |
Bookmark description.
TYPE:
|
icon |
Bookmark icon.
TYPE:
|
dashboard_id |
Dashboard to associate with. Required by
TYPE:
|
is_visibility_restricted |
Visibility restriction flag.
TYPE:
|
is_modification_restricted |
Modification restriction flag.
TYPE:
|
Example
bookmark_type
class-attribute
instance-attribute
¶
Report type (required, serialized as "type").
description
class-attribute
instance-attribute
¶
Bookmark description.
dashboard_id
class-attribute
instance-attribute
¶
Dashboard to associate with.
is_visibility_restricted
class-attribute
instance-attribute
¶
Visibility restriction flag.
is_modification_restricted
class-attribute
instance-attribute
¶
Modification restriction flag.
mixpanel_data.UpdateBookmarkParams
¶
Bases: BaseModel
Parameters for updating an existing bookmark/report.
All fields are optional — only provided fields are sent to the API.
| ATTRIBUTE | DESCRIPTION |
|---|---|
name |
New bookmark name.
TYPE:
|
params |
New query parameters.
TYPE:
|
description |
New bookmark description.
TYPE:
|
icon |
New bookmark icon.
TYPE:
|
dashboard_id |
New associated dashboard ID.
TYPE:
|
is_visibility_restricted |
New visibility restriction.
TYPE:
|
is_modification_restricted |
New modification restriction.
TYPE:
|
deleted |
Soft-delete flag.
TYPE:
|
Example
params
class-attribute
instance-attribute
¶
New query parameters.
description
class-attribute
instance-attribute
¶
New bookmark description.
dashboard_id
class-attribute
instance-attribute
¶
New associated dashboard ID.
is_visibility_restricted
class-attribute
instance-attribute
¶
New visibility restriction.
is_modification_restricted
class-attribute
instance-attribute
¶
New modification restriction.
mixpanel_data.BulkUpdateBookmarkEntry
¶
Bases: BaseModel
Entry for bulk-updating bookmarks.
| ATTRIBUTE | DESCRIPTION |
|---|---|
id |
Bookmark ID to update (required).
TYPE:
|
name |
New bookmark name.
TYPE:
|
params |
New query parameters.
TYPE:
|
description |
New bookmark description.
TYPE:
|
icon |
New bookmark icon.
TYPE:
|
is_visibility_restricted |
New visibility restriction.
TYPE:
|
is_modification_restricted |
New modification restriction.
TYPE:
|
params
class-attribute
instance-attribute
¶
New query parameters.
description
class-attribute
instance-attribute
¶
New bookmark description.
is_visibility_restricted
class-attribute
instance-attribute
¶
New visibility restriction.
is_modification_restricted
class-attribute
instance-attribute
¶
New modification restriction.
mixpanel_data.BookmarkHistoryResponse
¶
Bases: BaseModel
Response from the bookmark history endpoint.
| ATTRIBUTE | DESCRIPTION |
|---|---|
results |
List of history entries.
TYPE:
|
pagination |
Pagination metadata.
TYPE:
|
mixpanel_data.BookmarkHistoryPagination
¶
Bases: BaseModel
Pagination metadata for bookmark history responses.
| ATTRIBUTE | DESCRIPTION |
|---|---|
next_cursor |
Cursor for next page.
TYPE:
|
previous_cursor |
Cursor for previous page.
TYPE:
|
page_size |
Number of items per page.
TYPE:
|
Cohort CRUD Types¶
mixpanel_data.Cohort
¶
Bases: BaseModel
A Mixpanel cohort as returned by the App API.
Represents the full cohort entity with definition, metadata, and
cross-references. Extra fields from API evolution are preserved
via extra="allow".
| ATTRIBUTE | DESCRIPTION |
|---|---|
id |
Unique cohort identifier.
TYPE:
|
name |
Cohort name.
TYPE:
|
description |
Cohort description.
TYPE:
|
count |
Number of users in the cohort.
TYPE:
|
is_visible |
Whether the cohort is visible.
TYPE:
|
is_locked |
Whether the cohort is locked.
TYPE:
|
data_group_id |
Data group identifier.
TYPE:
|
last_edited |
Last edited timestamp string.
TYPE:
|
created_by |
Creator information.
TYPE:
|
referenced_by |
IDs of entities referencing this cohort.
TYPE:
|
verified |
Whether the cohort is verified.
TYPE:
|
last_queried |
Last queried timestamp string.
TYPE:
|
referenced_directly_by |
IDs of entities directly referencing this cohort.
TYPE:
|
active_integrations |
Active integration IDs.
TYPE:
|
is_visible
class-attribute
instance-attribute
¶
Whether the cohort is visible.
is_locked
class-attribute
instance-attribute
¶
Whether the cohort is locked.
data_group_id
class-attribute
instance-attribute
¶
Data group identifier.
last_edited
class-attribute
instance-attribute
¶
Last edited timestamp string.
created_by
class-attribute
instance-attribute
¶
Creator information.
referenced_by
class-attribute
instance-attribute
¶
IDs of entities referencing this cohort.
verified
class-attribute
instance-attribute
¶
Whether the cohort is verified.
last_queried
class-attribute
instance-attribute
¶
Last queried timestamp string.
referenced_directly_by
class-attribute
instance-attribute
¶
IDs of entities directly referencing this cohort.
active_integrations
class-attribute
instance-attribute
¶
Active integration IDs.
mixpanel_data.CohortCreator
¶
mixpanel_data.CreateCohortParams
¶
Bases: _DefinitionFlatteningModel
Parameters for creating a new cohort.
The definition dict is flattened into the top-level JSON payload
at serialization time — its keys become top-level fields in the request body.
| ATTRIBUTE | DESCRIPTION |
|---|---|
name |
Cohort name (required).
TYPE:
|
description |
Cohort description.
TYPE:
|
data_group_id |
Data group identifier.
TYPE:
|
is_locked |
Whether the cohort should be locked.
TYPE:
|
is_visible |
Whether the cohort should be visible.
TYPE:
|
deleted |
Soft-delete flag.
TYPE:
|
Example
mixpanel_data.UpdateCohortParams
¶
Bases: _DefinitionFlatteningModel
Parameters for updating an existing cohort.
All fields are optional — only provided fields are sent to the API.
The definition dict is flattened into the payload.
| ATTRIBUTE | DESCRIPTION |
|---|---|
name |
New cohort name.
TYPE:
|
description |
New cohort description.
TYPE:
|
data_group_id |
New data group identifier.
TYPE:
|
is_locked |
New lock setting.
TYPE:
|
is_visible |
New visibility setting.
TYPE:
|
deleted |
Soft-delete flag.
TYPE:
|
Example
mixpanel_data.BulkUpdateCohortEntry
¶
Bases: _DefinitionFlatteningModel
Entry for bulk-updating cohorts.
| ATTRIBUTE | DESCRIPTION |
|---|---|
id |
Cohort ID to update (required).
TYPE:
|
name |
New cohort name.
TYPE:
|
description |
New cohort description.
TYPE:
|
Feature Flag Enums¶
mixpanel_data.FeatureFlagStatus
¶
Bases: str, Enum
Lifecycle state of a feature flag.
| ATTRIBUTE | DESCRIPTION |
|---|---|
ENABLED |
Flag is active and serving variants.
|
DISABLED |
Flag is inactive (default state).
|
ARCHIVED |
Flag is soft-deleted, excluded from default listings.
|
mixpanel_data.ServingMethod
¶
Bases: str, Enum
Controls how flag values are delivered to clients.
| ATTRIBUTE | DESCRIPTION |
|---|---|
CLIENT |
Client-side evaluation (default).
|
SERVER |
Server-side evaluation only.
|
REMOTE_OR_LOCAL |
Remote preferred, local fallback.
|
REMOTE_ONLY |
Remote evaluation only.
|
mixpanel_data.FlagContractStatus
¶
Feature Flag Types¶
mixpanel_data.FeatureFlag
¶
Bases: BaseModel
A Mixpanel feature flag as returned by the App API.
Represents the full feature flag entity including configuration,
metadata, and permissions. Extra fields from API evolution are
preserved via extra="allow".
| ATTRIBUTE | DESCRIPTION |
|---|---|
id |
Unique identifier (UUID).
TYPE:
|
project_id |
Project this flag belongs to.
TYPE:
|
name |
Human-readable name.
TYPE:
|
key |
Machine-readable key (unique per project).
TYPE:
|
description |
Optional description.
TYPE:
|
status |
Current lifecycle status.
TYPE:
|
tags |
Tags for organization.
TYPE:
|
experiment_id |
Linked experiment ID if flag backs an experiment.
TYPE:
|
context |
Flag context identifier.
TYPE:
|
data_group_id |
Data group identifier.
TYPE:
|
serving_method |
How flag values are delivered.
TYPE:
|
ruleset |
Variants, rollout rules, and test overrides.
TYPE:
|
hash_salt |
Salt for deterministic variant assignment.
TYPE:
|
workspace_id |
Workspace this flag belongs to.
TYPE:
|
content_type |
Content type identifier.
TYPE:
|
created |
ISO 8601 creation timestamp.
TYPE:
|
modified |
ISO 8601 last-modified timestamp.
TYPE:
|
enabled_at |
Timestamp when flag was last enabled.
TYPE:
|
deleted |
Timestamp when flag was deleted.
TYPE:
|
creator_id |
Creator's user ID.
TYPE:
|
creator_name |
Creator's display name.
TYPE:
|
creator_email |
Creator's email.
TYPE:
|
last_modified_by_id |
Last modifier's user ID.
TYPE:
|
last_modified_by_name |
Last modifier's display name.
TYPE:
|
last_modified_by_email |
Last modifier's email.
TYPE:
|
is_favorited |
Whether current user has favorited.
TYPE:
|
pinned_date |
Date flag was pinned.
TYPE:
|
can_edit |
Permission: can current user edit.
TYPE:
|
Example
flag = FeatureFlag(
id="abc-123",
project_id=12345,
name="Dark Mode",
key="dark_mode",
status=FeatureFlagStatus.DISABLED,
context="default",
serving_method=ServingMethod.CLIENT,
ruleset={"variants": []},
created="2026-01-01T00:00:00Z",
modified="2026-01-01T00:00:00Z",
)
assert flag.key == "dark_mode"
description
class-attribute
instance-attribute
¶
Optional description.
status
class-attribute
instance-attribute
¶
Current lifecycle status.
tags
class-attribute
instance-attribute
¶
Tags for organization.
experiment_id
class-attribute
instance-attribute
¶
Linked experiment ID if flag backs an experiment.
data_group_id
class-attribute
instance-attribute
¶
Data group identifier.
serving_method
class-attribute
instance-attribute
¶
How flag values are delivered.
ruleset
class-attribute
instance-attribute
¶
Variants, rollout rules, and test overrides.
hash_salt
class-attribute
instance-attribute
¶
Salt for deterministic variant assignment.
workspace_id
class-attribute
instance-attribute
¶
Workspace this flag belongs to.
content_type
class-attribute
instance-attribute
¶
Content type identifier.
enabled_at
class-attribute
instance-attribute
¶
Timestamp when flag was last enabled.
deleted
class-attribute
instance-attribute
¶
Timestamp when flag was deleted.
creator_name
class-attribute
instance-attribute
¶
Creator's display name.
creator_email
class-attribute
instance-attribute
¶
Creator's email.
last_modified_by_id
class-attribute
instance-attribute
¶
Last modifier's user ID.
last_modified_by_name
class-attribute
instance-attribute
¶
Last modifier's display name.
last_modified_by_email
class-attribute
instance-attribute
¶
Last modifier's email.
is_favorited
class-attribute
instance-attribute
¶
Whether current user has favorited.
pinned_date
class-attribute
instance-attribute
¶
Date flag was pinned.
can_edit
class-attribute
instance-attribute
¶
Permission: can current user edit.
mixpanel_data.CreateFeatureFlagParams
¶
Bases: BaseModel
Parameters for creating a new feature flag.
The Mixpanel API requires name, key, context,
serving_method, tags, and ruleset (with variants
and rollout sub-fields). Sensible defaults are provided for
the non-obvious required fields so that minimal usage works::
CreateFeatureFlagParams(name="Dark Mode", key="dark_mode")
| ATTRIBUTE | DESCRIPTION |
|---|---|
name |
Flag name (required).
TYPE:
|
key |
Unique machine-readable key (required).
TYPE:
|
description |
Optional description.
TYPE:
|
status |
Initial status (defaults to disabled).
TYPE:
|
tags |
Tags for organization (required by API, defaults to empty list).
TYPE:
|
context |
Flag context identifier (required by API, defaults
to
TYPE:
|
serving_method |
How flag values are delivered (required by API,
defaults to
TYPE:
|
ruleset |
Ruleset with
TYPE:
|
Example
description
class-attribute
instance-attribute
¶
Optional description.
status
class-attribute
instance-attribute
¶
Initial status (defaults to disabled).
tags
class-attribute
instance-attribute
¶
Tags for organization (required by API, defaults to empty list).
context
class-attribute
instance-attribute
¶
Flag context identifier (required by API).
serving_method
class-attribute
instance-attribute
¶
How flag values are delivered (required by API).
ruleset
class-attribute
instance-attribute
¶
ruleset: dict[str, Any] = Field(
default_factory=lambda: {
"variants": [
{
"key": "On",
"value": True,
"is_control": False,
"split": 1.0,
"is_sticky": False,
},
{
"key": "Off",
"value": False,
"is_control": True,
"split": 0.0,
"is_sticky": False,
},
],
"rollout": [],
}
)
Ruleset with variants and rollout (required by API).
mixpanel_data.UpdateFeatureFlagParams
¶
Bases: BaseModel
Parameters for updating an existing feature flag (PUT semantics).
All required fields must always be provided since this performs a
full replacement, not a partial update. The API requires tags,
context, and serving_method in addition to name, key,
status, and ruleset.
| ATTRIBUTE | DESCRIPTION |
|---|---|
name |
Flag name (required).
TYPE:
|
key |
Unique key (required).
TYPE:
|
status |
Target status (required).
TYPE:
|
ruleset |
Complete ruleset — replaces existing (required).
TYPE:
|
description |
Optional description.
TYPE:
|
tags |
Tags for organization (required by API, defaults to empty list).
TYPE:
|
context |
Flag context identifier (required by API, defaults
to
TYPE:
|
serving_method |
How flag values are delivered (required by API,
defaults to
TYPE:
|
Example
ruleset
instance-attribute
¶
Complete ruleset — replaces existing (required).
description
class-attribute
instance-attribute
¶
Optional description.
tags
class-attribute
instance-attribute
¶
Tags for organization (required by API, defaults to empty list).
context
class-attribute
instance-attribute
¶
Flag context identifier (required by API).
serving_method
class-attribute
instance-attribute
¶
How flag values are delivered (required by API).
mixpanel_data.SetTestUsersParams
¶
Bases: BaseModel
Parameters for setting test user variant overrides on a flag.
| ATTRIBUTE | DESCRIPTION |
|---|---|
users |
Mapping of variant keys to user distinct IDs.
TYPE:
|
mixpanel_data.FlagHistoryParams
¶
mixpanel_data.FlagHistoryResponse
¶
mixpanel_data.FlagLimitsResponse
¶
Bases: BaseModel
Account-level feature flag usage and limits.
| ATTRIBUTE | DESCRIPTION |
|---|---|
limit |
Maximum allowed flags.
TYPE:
|
is_trial |
Whether account is on trial.
TYPE:
|
current_usage |
Current number of flags.
TYPE:
|
contract_status |
Contract status.
TYPE:
|
Example
Experiment Enums¶
mixpanel_data.ExperimentStatus
¶
Bases: str, Enum
Lifecycle state of an experiment.
State transitions: draft → active (launch) → concluded
(conclude) → success | fail (decide).
| ATTRIBUTE | DESCRIPTION |
|---|---|
DRAFT |
Experiment created but not started.
|
ACTIVE |
Experiment running, collecting data.
|
CONCLUDED |
Experiment stopped, awaiting decision.
|
SUCCESS |
Experiment decided as successful.
|
FAIL |
Experiment decided as failed.
|
Experiment Types¶
mixpanel_data.ExperimentCreator
¶
Bases: BaseModel
Creator metadata for an experiment.
| ATTRIBUTE | DESCRIPTION |
|---|---|
id |
Creator's user ID.
TYPE:
|
first_name |
Creator's first name.
TYPE:
|
last_name |
Creator's last name.
TYPE:
|
mixpanel_data.Experiment
¶
Bases: BaseModel
A Mixpanel A/B experiment as returned by the App API.
Represents the full experiment entity including lifecycle state,
variants, metrics, and metadata. Extra fields from API evolution
are preserved via extra="allow".
| ATTRIBUTE | DESCRIPTION |
|---|---|
id |
Unique identifier (UUID).
TYPE:
|
name |
Human-readable name.
TYPE:
|
description |
Optional description.
TYPE:
|
hypothesis |
Experiment hypothesis.
TYPE:
|
status |
Current lifecycle status.
TYPE:
|
variants |
Variant configuration.
TYPE:
|
metrics |
Success metrics.
TYPE:
|
settings |
Experiment settings.
TYPE:
|
exposures_cache |
Cached exposure data.
TYPE:
|
results_cache |
Cached result data.
TYPE:
|
start_date |
ISO 8601 start date.
TYPE:
|
end_date |
ISO 8601 end date.
TYPE:
|
created |
ISO 8601 creation timestamp.
TYPE:
|
updated |
ISO 8601 last-updated timestamp.
TYPE:
|
creator |
Creator metadata.
TYPE:
|
feature_flag |
Linked feature flag data.
TYPE:
|
is_favorited |
Whether current user has favorited.
TYPE:
|
pinned_date |
Date experiment was pinned.
TYPE:
|
tags |
Tags for organization.
TYPE:
|
can_edit |
Permission: can current user edit.
TYPE:
|
last_modified_by_id |
Last modifier's user ID.
TYPE:
|
last_modified_by_name |
Last modifier's display name.
TYPE:
|
last_modified_by_email |
Last modifier's email.
TYPE:
|
Example
description
class-attribute
instance-attribute
¶
Optional description.
hypothesis
class-attribute
instance-attribute
¶
Experiment hypothesis.
status
class-attribute
instance-attribute
¶
Current lifecycle status.
variants
class-attribute
instance-attribute
¶
Variant configuration (list from API, may also be dict).
metrics
class-attribute
instance-attribute
¶
Success metrics (list from API, may also be dict).
settings
class-attribute
instance-attribute
¶
Experiment settings.
exposures_cache
class-attribute
instance-attribute
¶
Cached exposure data.
results_cache
class-attribute
instance-attribute
¶
Cached result data.
created
class-attribute
instance-attribute
¶
ISO 8601 creation timestamp.
updated
class-attribute
instance-attribute
¶
ISO 8601 last-updated timestamp.
creator
class-attribute
instance-attribute
¶
Creator metadata.
feature_flag
class-attribute
instance-attribute
¶
Linked feature flag data.
is_favorited
class-attribute
instance-attribute
¶
Whether current user has favorited.
pinned_date
class-attribute
instance-attribute
¶
Date experiment was pinned.
can_edit
class-attribute
instance-attribute
¶
Permission: can current user edit.
last_modified_by_id
class-attribute
instance-attribute
¶
Last modifier's user ID.
last_modified_by_name
class-attribute
instance-attribute
¶
Last modifier's display name.
last_modified_by_email
class-attribute
instance-attribute
¶
Last modifier's email.
mixpanel_data.CreateExperimentParams
¶
Bases: BaseModel
Parameters for creating a new experiment.
| ATTRIBUTE | DESCRIPTION |
|---|---|
name |
Experiment name (required).
TYPE:
|
description |
Optional description.
TYPE:
|
hypothesis |
Experiment hypothesis.
TYPE:
|
settings |
Experiment settings.
TYPE:
|
access_type |
Access control type.
TYPE:
|
can_edit |
Edit permission.
TYPE:
|
Example
mixpanel_data.UpdateExperimentParams
¶
Bases: BaseModel
Parameters for updating an existing experiment (PATCH semantics).
All fields optional — only provided fields are updated.
| ATTRIBUTE | DESCRIPTION |
|---|---|
name |
Updated name.
TYPE:
|
description |
Updated description.
TYPE:
|
hypothesis |
Updated hypothesis.
TYPE:
|
variants |
Updated variant config.
TYPE:
|
metrics |
Updated metrics.
TYPE:
|
settings |
Updated settings.
TYPE:
|
start_date |
Updated start date.
TYPE:
|
end_date |
Updated end date.
TYPE:
|
tags |
Updated tags.
TYPE:
|
exposures_cache |
Updated exposures cache.
TYPE:
|
results_cache |
Updated results cache.
TYPE:
|
status |
Updated status.
TYPE:
|
global_access_type |
Updated access type.
TYPE:
|
Example
description
class-attribute
instance-attribute
¶
Updated description.
variants
class-attribute
instance-attribute
¶
Updated variant config (list or dict).
metrics
class-attribute
instance-attribute
¶
Updated metrics (list or dict).
settings
class-attribute
instance-attribute
¶
Updated settings.
exposures_cache
class-attribute
instance-attribute
¶
Updated exposures cache.
results_cache
class-attribute
instance-attribute
¶
Updated results cache.
global_access_type
class-attribute
instance-attribute
¶
Updated access type.
mixpanel_data.ExperimentConcludeParams
¶
mixpanel_data.ExperimentDecideParams
¶
mixpanel_data.DuplicateExperimentParams
¶
Annotation Types¶
mixpanel_data.Annotation
¶
Bases: BaseModel
Response model for a timeline annotation.
| ATTRIBUTE | DESCRIPTION |
|---|---|
id |
Annotation ID.
TYPE:
|
project_id |
Project ID.
TYPE:
|
date |
Annotation date (ISO format).
TYPE:
|
description |
Annotation text.
TYPE:
|
user |
Creator user info.
TYPE:
|
tags |
Associated tags.
TYPE:
|
tags
class-attribute
instance-attribute
¶
Associated tags.
mixpanel_data.AnnotationUser
¶
Bases: BaseModel
Nested user info for annotation creator.
| ATTRIBUTE | DESCRIPTION |
|---|---|
id |
User ID.
TYPE:
|
first_name |
First name.
TYPE:
|
last_name |
Last name.
TYPE:
|
mixpanel_data.AnnotationTag
¶
Bases: BaseModel
Annotation tag for categorization.
| ATTRIBUTE | DESCRIPTION |
|---|---|
id |
Tag ID.
TYPE:
|
name |
Tag name.
TYPE:
|
project_id |
Project ID.
TYPE:
|
has_annotations |
Whether tag has annotations.
TYPE:
|
mixpanel_data.CreateAnnotationParams
¶
Bases: BaseModel
Parameters for creating a new annotation.
| ATTRIBUTE | DESCRIPTION |
|---|---|
date |
Date string in
TYPE:
|
description |
Annotation text (max 512 characters, required).
TYPE:
|
tags |
Tag IDs to associate.
TYPE:
|
user_id |
Creator user ID.
TYPE:
|
description
class-attribute
instance-attribute
¶
Annotation text (max 512 characters).
mixpanel_data.UpdateAnnotationParams
¶
Bases: BaseModel
Parameters for updating an annotation (PATCH semantics).
Only description and tags can be changed after creation;
the annotation date is immutable.
| ATTRIBUTE | DESCRIPTION |
|---|---|
description |
New description (max 512 characters).
TYPE:
|
tags |
New tag IDs.
TYPE:
|
mixpanel_data.CreateAnnotationTagParams
¶
Webhook Enums¶
mixpanel_data.WebhookAuthType
¶
Bases: str, Enum
Authentication type for webhooks.
Values
BASIC: HTTP Basic authentication.
Webhook Types¶
mixpanel_data.ProjectWebhook
¶
Bases: BaseModel
Response model for a project webhook.
| ATTRIBUTE | DESCRIPTION |
|---|---|
id |
Webhook ID (UUID string).
TYPE:
|
name |
Webhook name.
TYPE:
|
url |
Webhook URL.
TYPE:
|
is_enabled |
Whether enabled.
TYPE:
|
auth_type |
Authentication type.
TYPE:
|
created |
Creation timestamp.
TYPE:
|
modified |
Last modified timestamp.
TYPE:
|
creator_id |
Creator user ID.
TYPE:
|
creator_name |
Creator name.
TYPE:
|
auth_type
class-attribute
instance-attribute
¶
Authentication type.
mixpanel_data.CreateWebhookParams
¶
Bases: BaseModel
Parameters for creating a webhook.
| ATTRIBUTE | DESCRIPTION |
|---|---|
name |
Webhook name (required).
TYPE:
|
url |
Webhook URL (required).
TYPE:
|
auth_type |
Auth type ("basic" or None).
TYPE:
|
username |
Basic auth username.
TYPE:
|
password |
Basic auth password.
TYPE:
|
auth_type
class-attribute
instance-attribute
¶
Auth type (e.g. WebhookAuthType.BASIC).
mixpanel_data.UpdateWebhookParams
¶
Bases: BaseModel
Parameters for updating a webhook (PATCH semantics).
| ATTRIBUTE | DESCRIPTION |
|---|---|
name |
New name.
TYPE:
|
url |
New URL.
TYPE:
|
auth_type |
New auth type.
TYPE:
|
username |
New username.
TYPE:
|
password |
New password.
TYPE:
|
is_enabled |
New enabled state.
TYPE:
|
auth_type
class-attribute
instance-attribute
¶
New auth type.
mixpanel_data.WebhookTestParams
¶
mixpanel_data.WebhookTestResult
¶
Bases: BaseModel
Response model for webhook connectivity test.
| ATTRIBUTE | DESCRIPTION |
|---|---|
success |
Whether test succeeded.
TYPE:
|
status_code |
HTTP status code.
TYPE:
|
message |
Descriptive message.
TYPE:
|
Example
mixpanel_data.WebhookMutationResult
¶
Alert Enums¶
mixpanel_data.AlertFrequencyPreset
¶
Bases: int, Enum
Preset frequency values for alert check intervals.
Values
HOURLY: Check every hour (3600 seconds). DAILY: Check every day (86400 seconds). WEEKLY: Check every week (604800 seconds).
Alert Types¶
mixpanel_data.CustomAlert
¶
Bases: BaseModel
Response model for a custom alert.
| ATTRIBUTE | DESCRIPTION |
|---|---|
id |
Alert ID.
TYPE:
|
name |
Alert name.
TYPE:
|
bookmark |
Linked saved report.
TYPE:
|
condition |
Trigger condition (opaque JSON).
TYPE:
|
frequency |
Check frequency in seconds.
TYPE:
|
paused |
Whether alert is paused.
TYPE:
|
subscriptions |
Notification targets.
TYPE:
|
notification_windows |
Notification window config.
TYPE:
|
creator |
Creator user info.
TYPE:
|
workspace |
Workspace metadata.
TYPE:
|
project |
Project metadata.
TYPE:
|
created |
Creation timestamp.
TYPE:
|
modified |
Last modified timestamp.
TYPE:
|
last_checked |
Last check timestamp.
TYPE:
|
last_fired |
Last trigger timestamp.
TYPE:
|
valid |
Whether alert is valid.
TYPE:
|
results |
Latest evaluation results.
TYPE:
|
bookmark
class-attribute
instance-attribute
¶
Linked saved report.
condition
class-attribute
instance-attribute
¶
Trigger condition (opaque JSON).
subscriptions
class-attribute
instance-attribute
¶
Notification targets.
notification_windows
class-attribute
instance-attribute
¶
Notification window config.
workspace
class-attribute
instance-attribute
¶
Workspace metadata.
last_checked
class-attribute
instance-attribute
¶
Last check timestamp.
last_fired
class-attribute
instance-attribute
¶
Last trigger timestamp.
results
class-attribute
instance-attribute
¶
Latest evaluation results.
mixpanel_data.AlertBookmark
¶
mixpanel_data.AlertCreator
¶
Bases: BaseModel
Nested creator info for an alert.
| ATTRIBUTE | DESCRIPTION |
|---|---|
id |
User ID.
TYPE:
|
first_name |
First name.
TYPE:
|
last_name |
Last name.
TYPE:
|
email |
Email.
TYPE:
|
mixpanel_data.AlertWorkspace
¶
mixpanel_data.AlertProject
¶
mixpanel_data.CreateAlertParams
¶
Bases: BaseModel
Parameters for creating a new alert.
| ATTRIBUTE | DESCRIPTION |
|---|---|
bookmark_id |
ID of linked bookmark (required).
TYPE:
|
name |
Alert name (required).
TYPE:
|
condition |
Trigger condition JSON (required).
TYPE:
|
frequency |
Check frequency in seconds (required).
TYPE:
|
paused |
Start paused or active (required).
TYPE:
|
subscriptions |
Notification targets (required).
TYPE:
|
notification_windows |
Notification window config.
TYPE:
|
Example
params = CreateAlertParams(
bookmark_id=12345,
name="Daily signups drop",
condition={
"keys": [{"header": "Signup", "value": "Signup"}],
"type": "absolute",
"op": "<",
"value": 100,
},
frequency=AlertFrequencyPreset.DAILY,
paused=False,
subscriptions=[{"type": "email", "value": "team@example.com"}],
)
mixpanel_data.UpdateAlertParams
¶
Bases: BaseModel
Parameters for updating an alert (PATCH semantics).
| ATTRIBUTE | DESCRIPTION |
|---|---|
name |
New name.
TYPE:
|
bookmark_id |
New bookmark ID.
TYPE:
|
condition |
New condition.
TYPE:
|
frequency |
New frequency.
TYPE:
|
paused |
New pause state.
TYPE:
|
subscriptions |
New subscriptions.
TYPE:
|
notification_windows |
New notification windows.
TYPE:
|
mixpanel_data.AlertCount
¶
Bases: BaseModel
Response model for alert count and limits.
| ATTRIBUTE | DESCRIPTION |
|---|---|
anomaly_alerts_count |
Current alert count.
TYPE:
|
alert_limit |
Account limit.
TYPE:
|
is_below_limit |
Whether below limit.
TYPE:
|
Example
mixpanel_data.AlertHistoryPagination
¶
Bases: BaseModel
Pagination metadata for alert history.
| ATTRIBUTE | DESCRIPTION |
|---|---|
next_cursor |
Next page cursor.
TYPE:
|
previous_cursor |
Previous page cursor.
TYPE:
|
page_size |
Page size.
TYPE:
|
mixpanel_data.AlertHistoryResponse
¶
Bases: BaseModel
Response model for alert history (paginated).
| ATTRIBUTE | DESCRIPTION |
|---|---|
results |
History entries.
TYPE:
|
pagination |
Pagination metadata.
TYPE:
|
Example
mixpanel_data.AlertScreenshotResponse
¶
Bases: BaseModel
Response model for alert screenshot URL.
| ATTRIBUTE | DESCRIPTION |
|---|---|
signed_url |
Signed GCS URL for screenshot.
TYPE:
|
mixpanel_data.AlertValidation
¶
Bases: BaseModel
Per-alert validation result.
| ATTRIBUTE | DESCRIPTION |
|---|---|
alert_id |
Alert ID.
TYPE:
|
alert_name |
Alert name.
TYPE:
|
valid |
Whether valid.
TYPE:
|
reason |
Reason if invalid.
TYPE:
|
mixpanel_data.ValidateAlertsForBookmarkParams
¶
Bases: BaseModel
Parameters for validating alerts against a bookmark.
| ATTRIBUTE | DESCRIPTION |
|---|---|
alert_ids |
Alert IDs to validate (required).
TYPE:
|
bookmark_type |
Bookmark type to validate against (required).
TYPE:
|
bookmark_params |
Bookmark params JSON (required).
TYPE:
|
Example
mixpanel_data.ValidateAlertsForBookmarkResponse
¶
Bases: BaseModel
Response model for alert-bookmark validation.
| ATTRIBUTE | DESCRIPTION |
|---|---|
alert_validations |
Per-alert validation results.
TYPE:
|
invalid_count |
Count of invalid alerts.
TYPE:
|
Example
Data Governance Enums¶
mixpanel_data.PropertyResourceType
¶
Bases: str, Enum
Resource type for property definitions.
Values
EVENT: Event property.
USER: User profile property.
GROUPPROFILE: Group profile property (wire format: groupprofile).
mixpanel_data.CustomPropertyResourceType
¶
Bases: str, Enum
Resource type for custom properties.
Values
EVENTS: Event-level custom property. PEOPLE: User profile custom property. GROUP_PROFILES: Group profile custom property.
Event Definition Types¶
mixpanel_data.EventDefinition
¶
Bases: BaseModel
A Mixpanel event definition from the Lexicon.
| ATTRIBUTE | DESCRIPTION |
|---|---|
id |
Server-assigned event ID.
TYPE:
|
name |
Event name (unique identifier).
TYPE:
|
display_name |
Human-readable name.
TYPE:
|
description |
Event description.
TYPE:
|
hidden |
Whether hidden from UI.
TYPE:
|
dropped |
Whether data is dropped at ingestion.
TYPE:
|
merged |
Whether merged into another event.
TYPE:
|
verified |
Whether verified by governance team.
TYPE:
|
tags |
Assigned tag names.
TYPE:
|
custom_event_id |
Links to custom event.
TYPE:
|
last_modified |
ISO 8601 timestamp.
TYPE:
|
status |
Event status.
TYPE:
|
platforms |
Tracking platforms.
TYPE:
|
created_utc |
ISO 8601 creation timestamp.
TYPE:
|
modified_utc |
ISO 8601 modification timestamp.
TYPE:
|
display_name
class-attribute
instance-attribute
¶
Human-readable name.
dropped
class-attribute
instance-attribute
¶
Whether data is dropped at ingestion.
merged
class-attribute
instance-attribute
¶
Whether merged into another event.
verified
class-attribute
instance-attribute
¶
Whether verified by governance team.
custom_event_id
class-attribute
instance-attribute
¶
Links to custom event.
last_modified
class-attribute
instance-attribute
¶
ISO 8601 timestamp.
platforms
class-attribute
instance-attribute
¶
Tracking platforms.
created_utc
class-attribute
instance-attribute
¶
ISO 8601 creation timestamp.
modified_utc
class-attribute
instance-attribute
¶
ISO 8601 modification timestamp.
mixpanel_data.UpdateEventDefinitionParams
¶
Bases: BaseModel
Parameters for updating an event definition (PATCH semantics).
All fields are optional; only set fields are sent.
| ATTRIBUTE | DESCRIPTION |
|---|---|
hidden |
Whether hidden from UI.
TYPE:
|
dropped |
Whether data is dropped.
TYPE:
|
merged |
Whether merged.
TYPE:
|
verified |
Whether verified.
TYPE:
|
tags |
Tag names to assign.
TYPE:
|
description |
Event description.
TYPE:
|
Example
mixpanel_data.BulkEventUpdate
¶
Bases: BaseModel
A single event update entry for bulk operations.
| ATTRIBUTE | DESCRIPTION |
|---|---|
name |
Event name (identifier).
TYPE:
|
id |
Alternative identifier.
TYPE:
|
hidden |
Whether hidden from UI.
TYPE:
|
dropped |
Whether data is dropped.
TYPE:
|
merged |
Whether merged.
TYPE:
|
verified |
Whether verified.
TYPE:
|
tags |
Tag names.
TYPE:
|
contacts |
Contact emails.
TYPE:
|
team_contacts |
Team contact emails.
TYPE:
|
team_contacts
class-attribute
instance-attribute
¶
Team contact emails.
mixpanel_data.BulkUpdateEventsParams
¶
Bases: BaseModel
Parameters for bulk-updating event definitions.
| ATTRIBUTE | DESCRIPTION |
|---|---|
events |
List of event update entries (required).
TYPE:
|
Property Definition Types¶
mixpanel_data.PropertyDefinition
¶
Bases: BaseModel
A Mixpanel property definition from the Lexicon.
| ATTRIBUTE | DESCRIPTION |
|---|---|
id |
Server-assigned property ID.
TYPE:
|
name |
Property name.
TYPE:
|
resource_type |
Property resource type (event, user, groupprofile).
TYPE:
|
description |
Property description.
TYPE:
|
hidden |
Whether hidden from UI.
TYPE:
|
dropped |
Whether data is dropped.
TYPE:
|
merged |
Whether merged into another property.
TYPE:
|
sensitive |
PII flag.
TYPE:
|
data_group_id |
Data group identifier.
TYPE:
|
id
class-attribute
instance-attribute
¶
Server-assigned property ID (may be absent for custom properties).
resource_type
class-attribute
instance-attribute
¶
Property resource type (event, user, groupprofile).
description
class-attribute
instance-attribute
¶
Property description.
merged
class-attribute
instance-attribute
¶
Whether merged into another property.
data_group_id
class-attribute
instance-attribute
¶
Data group identifier.
mixpanel_data.UpdatePropertyDefinitionParams
¶
Bases: BaseModel
Parameters for updating a property definition (PATCH semantics).
All fields are optional; only set fields are sent.
| ATTRIBUTE | DESCRIPTION |
|---|---|
hidden |
Whether hidden from UI.
TYPE:
|
dropped |
Whether data is dropped.
TYPE:
|
merged |
Whether merged.
TYPE:
|
sensitive |
PII flag.
TYPE:
|
description |
Property description.
TYPE:
|
description
class-attribute
instance-attribute
¶
Property description.
mixpanel_data.BulkPropertyUpdate
¶
Bases: BaseModel
A single property update entry for bulk operations.
Uses camelCase serialization to match the Django API contract.
| ATTRIBUTE | DESCRIPTION |
|---|---|
name |
Property name (required).
TYPE:
|
resource_type |
Resource type (required).
TYPE:
|
id |
Property ID.
TYPE:
|
hidden |
Whether hidden from UI.
TYPE:
|
dropped |
Whether data is dropped.
TYPE:
|
sensitive |
PII flag.
TYPE:
|
data_group_id |
Data group identifier.
TYPE:
|
data_group_id
class-attribute
instance-attribute
¶
Data group identifier.
mixpanel_data.BulkUpdatePropertiesParams
¶
Bases: BaseModel
Parameters for bulk-updating property definitions.
| ATTRIBUTE | DESCRIPTION |
|---|---|
properties |
List of property update entries (required).
TYPE:
|
Example
properties
instance-attribute
¶
List of property update entries.
Lexicon Tag Types¶
mixpanel_data.LexiconTag
¶
mixpanel_data.CreateTagParams
¶
mixpanel_data.UpdateTagParams
¶
Drop Filter Types¶
mixpanel_data.DropFilter
¶
Bases: BaseModel
A drop filter for discarding events at ingestion.
| ATTRIBUTE | DESCRIPTION |
|---|---|
id |
Server-assigned filter ID.
TYPE:
|
event_name |
Event name to filter.
TYPE:
|
filters |
Filter condition JSON.
TYPE:
|
active |
Whether the filter is active.
TYPE:
|
display_name |
Human-readable name.
TYPE:
|
created |
ISO 8601 creation timestamp.
TYPE:
|
mixpanel_data.CreateDropFilterParams
¶
Bases: BaseModel
Parameters for creating a drop filter.
| ATTRIBUTE | DESCRIPTION |
|---|---|
event_name |
Event name to filter (required).
TYPE:
|
filters |
Filter condition JSON (required).
TYPE:
|
Example
mixpanel_data.UpdateDropFilterParams
¶
Bases: BaseModel
Parameters for updating a drop filter.
| ATTRIBUTE | DESCRIPTION |
|---|---|
id |
Drop filter ID (required).
TYPE:
|
event_name |
New event name.
TYPE:
|
filters |
New filter condition JSON.
TYPE:
|
active |
Whether the filter is active.
TYPE:
|
active
class-attribute
instance-attribute
¶
Whether the filter is active.
mixpanel_data.DropFilterLimitsResponse
¶
Bases: BaseModel
Response model for drop filter limits.
| ATTRIBUTE | DESCRIPTION |
|---|---|
filter_limit |
Maximum allowed filters.
TYPE:
|
Custom Property Types¶
mixpanel_data.ComposedPropertyValue
¶
Bases: BaseModel
A composed property reference within a custom property formula.
| ATTRIBUTE | DESCRIPTION |
|---|---|
type |
Property type.
TYPE:
|
type_cast |
Type cast instruction.
TYPE:
|
resource_type |
Resource type (required).
TYPE:
|
behavior |
Behavior specification.
TYPE:
|
join_property_type |
Join property type.
TYPE:
|
resource_type
instance-attribute
¶
Resource type. Uses singular form (event, user, groupprofile) from the
Mixpanel API composed property schema — distinct from
CustomPropertyResourceType which uses plural form.
value
class-attribute
instance-attribute
¶
Property name in the project (e.g. "deal_name").
label
class-attribute
instance-attribute
¶
Human-readable label for the property (e.g. "Deal Name").
property_default_type
class-attribute
instance-attribute
¶
Default property type hint (e.g. "string", "number").
join_property_type
class-attribute
instance-attribute
¶
Join property type.
mixpanel_data.CustomProperty
¶
Bases: BaseModel
A Mixpanel custom property (computed/formula property).
| ATTRIBUTE | DESCRIPTION |
|---|---|
custom_property_id |
Server-assigned property ID.
TYPE:
|
name |
Property name.
TYPE:
|
description |
Property description.
TYPE:
|
resource_type |
Resource type (events, people, group_profiles). |
property_type |
Property type.
TYPE:
|
display_formula |
Formula expression.
TYPE:
|
composed_properties |
Referenced properties in formula.
TYPE:
|
is_locked |
Whether the property is locked.
TYPE:
|
is_visible |
Whether the property is visible.
TYPE:
|
data_group_id |
Data group identifier.
TYPE:
|
created |
ISO 8601 creation timestamp.
TYPE:
|
modified |
ISO 8601 modification timestamp.
TYPE:
|
example_value |
Example value.
TYPE:
|
description
class-attribute
instance-attribute
¶
Property description.
resource_type
instance-attribute
¶
Resource type (events, people, group_profiles).
display_formula
class-attribute
instance-attribute
¶
Formula expression.
composed_properties
class-attribute
instance-attribute
¶
Referenced properties in formula.
is_locked
class-attribute
instance-attribute
¶
Whether the property is locked.
is_visible
class-attribute
instance-attribute
¶
Whether the property is visible.
data_group_id
class-attribute
instance-attribute
¶
Data group identifier.
created
class-attribute
instance-attribute
¶
ISO 8601 creation timestamp.
modified
class-attribute
instance-attribute
¶
ISO 8601 modification timestamp.
mixpanel_data.CreateCustomPropertyParams
¶
Bases: BaseModel
Parameters for creating a custom property.
Validation rules:
- display_formula and behavior are mutually exclusive.
- behavior and composed_properties are mutually exclusive.
- display_formula requires composed_properties.
- One of display_formula or behavior must be set.
| ATTRIBUTE | DESCRIPTION |
|---|---|
name |
Property name (required).
TYPE:
|
resource_type |
Resource type (required). |
description |
Property description.
TYPE:
|
display_formula |
Formula expression (mutually exclusive with behavior).
TYPE:
|
composed_properties |
Referenced properties (required if display_formula set).
TYPE:
|
is_locked |
Whether the property is locked.
TYPE:
|
is_visible |
Whether the property is visible.
TYPE:
|
data_group_id |
Data group identifier.
TYPE:
|
behavior |
Behavior specification (mutually exclusive with display_formula).
TYPE:
|
Example
resource_type
instance-attribute
¶
Resource type (events, people, group_profiles).
description
class-attribute
instance-attribute
¶
Property description.
display_formula
class-attribute
instance-attribute
¶
Formula expression (mutually exclusive with behavior).
composed_properties
class-attribute
instance-attribute
¶
Referenced properties (required if display_formula set).
is_locked
class-attribute
instance-attribute
¶
Whether the property is locked.
is_visible
class-attribute
instance-attribute
¶
Whether the property is visible.
property_type
class-attribute
instance-attribute
¶
Output type of the custom property (string, number, boolean, datetime). Auto-inferred by the API from the formula if not set.
example_value
class-attribute
instance-attribute
¶
Example output value for documentation purposes.
data_group_id
class-attribute
instance-attribute
¶
Data group identifier.
behavior
class-attribute
instance-attribute
¶
Behavior specification (mutually exclusive with display_formula).
mixpanel_data.UpdateCustomPropertyParams
¶
Bases: BaseModel
Parameters for updating a custom property (PUT — full replacement).
Note: resource_type and data_group_id are immutable.
| ATTRIBUTE | DESCRIPTION |
|---|---|
name |
Property name.
TYPE:
|
description |
Property description.
TYPE:
|
display_formula |
Formula expression.
TYPE:
|
composed_properties |
Referenced properties.
TYPE:
|
is_locked |
Whether the property is locked.
TYPE:
|
is_visible |
Whether the property is visible.
TYPE:
|
description
class-attribute
instance-attribute
¶
Property description.
display_formula
class-attribute
instance-attribute
¶
Formula expression.
composed_properties
class-attribute
instance-attribute
¶
Referenced properties.
is_locked
class-attribute
instance-attribute
¶
Whether the property is locked.
is_visible
class-attribute
instance-attribute
¶
Whether the property is visible.
Lookup Table Types¶
mixpanel_data.LookupTable
¶
Bases: BaseModel
A Mixpanel lookup table.
| ATTRIBUTE | DESCRIPTION |
|---|---|
id |
Server-assigned table ID.
TYPE:
|
name |
Table name.
TYPE:
|
token |
Table token.
TYPE:
|
created_at |
ISO 8601 creation timestamp.
TYPE:
|
last_modified_at |
ISO 8601 modification timestamp.
TYPE:
|
has_mapped_properties |
Whether the table has mapped properties.
TYPE:
|
mixpanel_data.UploadLookupTableParams
¶
Bases: BaseModel
Parameters for uploading a lookup table CSV.
The upload is a 3-step process handled by the workspace method: 1. Get a signed upload URL 2. Upload CSV to signed URL 3. Register the table
| ATTRIBUTE | DESCRIPTION |
|---|---|
name |
Table name (1-255 characters, required).
TYPE:
|
file_path |
Path to local CSV file (required).
TYPE:
|
data_group_id |
For replacing an existing table.
TYPE:
|
Example
mixpanel_data.MarkLookupTableReadyParams
¶
Bases: BaseModel
Parameters for marking a lookup table as ready.
| ATTRIBUTE | DESCRIPTION |
|---|---|
name |
Table name (required).
TYPE:
|
key |
Primary key column name (required).
TYPE:
|
data_group_id |
For replacing an existing table.
TYPE:
|
mixpanel_data.LookupTableUploadUrl
¶
mixpanel_data.UpdateLookupTableParams
¶
Schema Registry Types¶
Types for managing JSON Schema Draft 7 definitions in the schema registry.
mixpanel_data.SchemaEntry
¶
Bases: BaseModel
A schema registry entry for an event, custom event, or profile.
Represents a JSON Schema Draft 7 definition registered in the Mixpanel schema registry. Used for both API responses and as entries in bulk create/update operations.
| ATTRIBUTE | DESCRIPTION |
|---|---|
entity_type |
Entity type ("event", "custom_event", "profile").
TYPE:
|
name |
Entity name (event name or "$user" for profile).
TYPE:
|
version |
Schema version in YYYY-MM-DD format.
TYPE:
|
schema_definition |
JSON Schema Draft 7 definition (API field: schemaJson).
TYPE:
|
Example
mixpanel_data.BulkCreateSchemasParams
¶
Bases: BaseModel
Parameters for bulk-creating schemas in the registry.
| ATTRIBUTE | DESCRIPTION |
|---|---|
entries |
Schema entries to create.
TYPE:
|
truncate |
If true, delete all existing schemas of entity_type before inserting.
TYPE:
|
entity_type |
Entity type for all entries (only "event" supported for batch operations).
TYPE:
|
Example
mixpanel_data.BulkCreateSchemasResponse
¶
mixpanel_data.BulkPatchResult
¶
Bases: BaseModel
Per-entry result from a bulk schema update operation.
| ATTRIBUTE | DESCRIPTION |
|---|---|
entity_type |
Entity type processed.
TYPE:
|
name |
Entity name processed.
TYPE:
|
status |
Result status ("ok" or "error").
TYPE:
|
error |
Error message if status is "error".
TYPE:
|
error
class-attribute
instance-attribute
¶
Error message if status is "error".
mixpanel_data.DeleteSchemasResponse
¶
Bases: BaseModel
Response from a schema deletion operation.
| ATTRIBUTE | DESCRIPTION |
|---|---|
delete_count |
Number of schemas deleted.
TYPE:
|
Schema Enforcement Types¶
Types for configuring schema enforcement policies.
mixpanel_data.SchemaEnforcementConfig
¶
Bases: BaseModel
Schema enforcement configuration for a project.
Controls how Mixpanel handles events that don't match defined schemas.
| ATTRIBUTE | DESCRIPTION |
|---|---|
id |
Config ID.
TYPE:
|
last_modified |
Last modification timestamp.
TYPE:
|
last_modified_by |
User who last modified.
TYPE:
|
rule_event |
Enforcement action ("Warn and Accept", "Warn and Hide", "Warn and Drop").
TYPE:
|
notification_emails |
Notification recipients.
TYPE:
|
events |
Event enforcement rules.
TYPE:
|
common_properties |
Common property rules.
TYPE:
|
user_properties |
User property rules.
TYPE:
|
initialized_by |
User who initialized.
TYPE:
|
initialized_from |
Initialization start date.
TYPE:
|
initialized_to |
Initialization end date.
TYPE:
|
state |
Enforcement state ("planned" or "ingested").
TYPE:
|
last_modified
class-attribute
instance-attribute
¶
Last modification timestamp.
last_modified_by
class-attribute
instance-attribute
¶
User who last modified.
rule_event
class-attribute
instance-attribute
¶
Enforcement action: "Warn and Accept", "Warn and Hide", "Warn and Drop".
notification_emails
class-attribute
instance-attribute
¶
Notification recipients.
events
class-attribute
instance-attribute
¶
Event enforcement rules.
common_properties
class-attribute
instance-attribute
¶
Common property rules.
user_properties
class-attribute
instance-attribute
¶
User property rules.
initialized_by
class-attribute
instance-attribute
¶
User who initialized.
initialized_from
class-attribute
instance-attribute
¶
Initialization start date.
initialized_to
class-attribute
instance-attribute
¶
Initialization end date.
state
class-attribute
instance-attribute
¶
Enforcement state ("planned" or "ingested").
mixpanel_data.InitSchemaEnforcementParams
¶
Bases: BaseModel
Parameters for initializing schema enforcement.
| ATTRIBUTE | DESCRIPTION |
|---|---|
rule_event |
Enforcement action ("Warn and Accept", "Warn and Hide", "Warn and Drop").
TYPE:
|
mixpanel_data.UpdateSchemaEnforcementParams
¶
Bases: BaseModel
Parameters for partially updating schema enforcement.
| ATTRIBUTE | DESCRIPTION |
|---|---|
notification_emails |
Updated notification recipients.
TYPE:
|
rule_event |
Updated enforcement action.
TYPE:
|
events |
Updated event list.
TYPE:
|
properties |
Updated property map.
TYPE:
|
Example
mixpanel_data.ReplaceSchemaEnforcementParams
¶
Bases: BaseModel
Parameters for fully replacing schema enforcement configuration.
All fields are required since this is a full replacement.
| ATTRIBUTE | DESCRIPTION |
|---|---|
common_properties |
Full common property rules.
TYPE:
|
user_properties |
Full user property rules.
TYPE:
|
events |
Full event rules.
TYPE:
|
rule_event |
Enforcement action.
TYPE:
|
notification_emails |
Notification recipients.
TYPE:
|
schema_id |
Schema definition ID.
TYPE:
|
Example
Data Audit Types¶
Types for schema audit operations and violation reporting.
mixpanel_data.AuditViolation
¶
Bases: BaseModel
A single violation found during a data audit.
| ATTRIBUTE | DESCRIPTION |
|---|---|
violation |
Violation type (e.g., "Unexpected Event", "Missing Property", "Unexpected Type for Property").
TYPE:
|
name |
Property or event name.
TYPE:
|
platform |
Platform ("iOS", "Android", "Web").
TYPE:
|
version |
Version string.
TYPE:
|
count |
Number of occurrences.
TYPE:
|
event |
Event name (for property violations).
TYPE:
|
sensitive |
Whether property is marked sensitive.
TYPE:
|
property_type_error |
Type mismatch description.
TYPE:
|
platform
class-attribute
instance-attribute
¶
Platform: "iOS", "Android", "Web".
event
class-attribute
instance-attribute
¶
Event name (for property violations).
sensitive
class-attribute
instance-attribute
¶
Whether property is marked sensitive.
property_type_error
class-attribute
instance-attribute
¶
Type mismatch description.
mixpanel_data.AuditResponse
¶
Bases: BaseModel
Response from a data audit operation.
Contains a list of schema violations and the timestamp when the audit was computed.
| ATTRIBUTE | DESCRIPTION |
|---|---|
violations |
List of audit violations.
TYPE:
|
computed_at |
Timestamp of audit computation.
TYPE:
|
Example
Data Volume Anomaly Types¶
Types for monitoring and managing data volume anomalies.
mixpanel_data.DataVolumeAnomaly
¶
Bases: BaseModel
A detected data volume anomaly.
| ATTRIBUTE | DESCRIPTION |
|---|---|
id |
Anomaly ID.
TYPE:
|
timestamp |
Detection timestamp.
TYPE:
|
actual_count |
Actual observed count.
TYPE:
|
predicted_upper |
Upper bound of prediction.
TYPE:
|
predicted_lower |
Lower bound of prediction.
TYPE:
|
percent_variance |
Variance percentage.
TYPE:
|
status |
Anomaly status ("open" or "dismissed").
TYPE:
|
project |
Project ID.
TYPE:
|
event |
Event ID.
TYPE:
|
event_name |
Event name.
TYPE:
|
property |
Property ID.
TYPE:
|
property_name |
Property name.
TYPE:
|
metric |
Metric ID.
TYPE:
|
metric_name |
Metric name.
TYPE:
|
metric_type |
Metric type.
TYPE:
|
primary_type |
Primary anomaly type.
TYPE:
|
drift_types |
Drift type details.
TYPE:
|
anomaly_class |
Anomaly class ("Event", "Property", "PropertyTypeDrift", "Metric").
TYPE:
|
Example
mixpanel_data.UpdateAnomalyParams
¶
Bases: BaseModel
Parameters for updating a single anomaly status.
| ATTRIBUTE | DESCRIPTION |
|---|---|
id |
Anomaly ID.
TYPE:
|
status |
New status ("open" or "dismissed").
TYPE:
|
anomaly_class |
Anomaly class.
TYPE:
|
mixpanel_data.BulkAnomalyEntry
¶
Bases: BaseModel
A single entry in a bulk anomaly update.
| ATTRIBUTE | DESCRIPTION |
|---|---|
id |
Anomaly ID.
TYPE:
|
anomaly_class |
Anomaly class.
TYPE:
|
mixpanel_data.BulkUpdateAnomalyParams
¶
Bases: BaseModel
Parameters for bulk-updating anomaly statuses.
| ATTRIBUTE | DESCRIPTION |
|---|---|
anomalies |
Anomalies to update.
TYPE:
|
status |
New status for all ("open" or "dismissed").
TYPE:
|
Example
Event Deletion Request Types¶
Types for managing event deletion requests.
mixpanel_data.EventDeletionRequest
¶
Bases: BaseModel
An event deletion request with lifecycle status.
| ATTRIBUTE | DESCRIPTION |
|---|---|
id |
Request ID.
TYPE:
|
display_name |
Display name.
TYPE:
|
event_name |
Event to delete.
TYPE:
|
from_date |
Start date.
TYPE:
|
to_date |
End date.
TYPE:
|
filters |
Deletion filters.
TYPE:
|
status |
Request status ("Submitted", "Processing", "Completed", "Failed").
TYPE:
|
deleted_events_count |
Count of deleted events.
TYPE:
|
created |
Creation timestamp.
TYPE:
|
requesting_user |
User who requested.
TYPE:
|
Example
mixpanel_data.CreateDeletionRequestParams
¶
Bases: BaseModel
Parameters for creating an event deletion request.
| ATTRIBUTE | DESCRIPTION |
|---|---|
from_date |
Start date (YYYY-MM-DD or datetime).
TYPE:
|
to_date |
End date.
TYPE:
|
event_name |
Event name to delete.
TYPE:
|
filters |
Optional deletion filters.
TYPE:
|
Example
filters
class-attribute
instance-attribute
¶
Optional deletion filters.
mixpanel_data.PreviewDeletionFiltersParams
¶
Bases: BaseModel
Parameters for previewing event deletion filters.
This is a read-only operation that shows what events would match.
| ATTRIBUTE | DESCRIPTION |
|---|---|
event_name |
Event name.
TYPE:
|
from_date |
Start date.
TYPE:
|
to_date |
End date.
TYPE:
|
filters |
Optional filters.
TYPE:
|