Workspace¶
The Workspace class is the unified entry point for all Mixpanel data operations.
Explore on DeepWiki
Ask questions about Workspace methods, explore usage patterns, or understand how services are orchestrated.
Overview¶
Workspace orchestrates internal services and provides direct App API access:
- DiscoveryService — Schema exploration (events, properties, funnels, cohorts)
- LiveQueryService — Real-time analytics queries (legacy) and Insights engine queries
- Streaming — Stream events and profiles directly from Mixpanel
- Entity CRUD — Create, read, update, delete dashboards, reports, and cohorts via Mixpanel App API (workspace-scoped)
- Feature Management — Create, read, update, delete feature flags and experiments via Mixpanel App API (project-scoped)
- Operational Tooling — Manage alerts, annotations, and webhooks via Mixpanel App API (workspace-scoped)
- Data Governance — Manage Lexicon definitions, drop filters, custom properties, custom events, lookup tables, schema registry, schema enforcement, data auditing, volume anomalies, and event deletion requests via Mixpanel App API (workspace-scoped)
Key Features¶
Entity CRUD¶
Manage dashboards, reports (bookmarks), and cohorts programmatically via the Mixpanel App API (workspace-scoped):
import mixpanel_data as mp
ws = mp.Workspace()
# Dashboards
dashboards = ws.list_dashboards()
new_dash = ws.create_dashboard(mp.CreateDashboardParams(title="Q1 Metrics"))
ws.update_dashboard(new_dash.id, mp.UpdateDashboardParams(title="Q1 Metrics v2"))
ws.favorite_dashboard(new_dash.id)
# Reports (Bookmarks)
reports = ws.list_bookmarks_v2()
report = ws.create_bookmark(mp.CreateBookmarkParams(
name="Daily Signups",
bookmark_type="insights"
))
# Cohorts
cohorts = ws.list_cohorts_full()
cohort = ws.create_cohort(mp.CreateCohortParams(name="Power Users"))
ws.update_cohort(cohort.id, mp.UpdateCohortParams(name="Super Users"))
Dashboard, report, and cohort operations require a workspace ID, set via MP_WORKSPACE_ID environment variable, --workspace / -w CLI flag, Workspace(workspace=N), or ws.use(workspace=N). List available workspaces with mp workspace list or ws.workspaces().
Feature Flags & Experiments¶
Manage feature flags and experiments programmatically. Unlike dashboards/reports/cohorts, these are project-scoped and do not require a workspace ID.
import mixpanel_data as mp
ws = mp.Workspace()
# Feature Flags
flags = ws.list_feature_flags()
flag = ws.create_feature_flag(mp.CreateFeatureFlagParams(
name="Dark Mode", key="dark_mode"
))
ws.update_feature_flag(flag.id, mp.UpdateFeatureFlagParams(
name="Dark Mode", key="dark_mode",
status=mp.FeatureFlagStatus.ENABLED,
ruleset=flag.ruleset,
))
# Experiments (full lifecycle)
exp = ws.create_experiment(mp.CreateExperimentParams(name="Checkout Flow Test"))
launched = ws.launch_experiment(exp.id)
concluded = ws.conclude_experiment(exp.id)
decided = ws.decide_experiment(exp.id, mp.ExperimentDecideParams(success=True))
Feature flag update uses PUT semantics (all required fields must be provided). Experiment update uses PATCH semantics (only changed fields needed). See the Entity Management guide for complete coverage.
Data Governance¶
Manage Lexicon definitions, drop filters, custom properties, custom events, and lookup tables programmatically. All operations are workspace-scoped.
import mixpanel_data as mp
ws = mp.Workspace()
# Lexicon — Event and property definitions
defs = ws.get_event_definitions(names=["Signup", "Login"])
ws.update_event_definition("Signup", mp.UpdateEventDefinitionParams(verified=True))
tags = ws.list_lexicon_tags()
# Drop filters
filters = ws.list_drop_filters()
ws.create_drop_filter(mp.CreateDropFilterParams(
event_name="Debug Event", filters={"property": "env", "value": "test"},
))
# Custom properties
props = ws.list_custom_properties()
prop = ws.get_custom_property("abc123")
# Lookup tables
tables = ws.list_lookup_tables()
table = ws.upload_lookup_table(mp.UploadLookupTableParams(
name="Countries", file_path="/path/to/countries.csv",
))
# Custom events
events = ws.list_custom_events()
See the Data Governance guide for complete coverage.
workspaces() vs list_workspaces()
Both methods are exposed. workspaces() (recommended) returns list[WorkspaceRef] from the cached /me response — fast, typed, and consistent with events() / properties() / funnels() / cohorts(). list_workspaces() is a lower-level escape hatch that calls GET /api/app/projects/{pid}/workspaces/public directly and returns list[PublicWorkspace].
In-Session Switching¶
Workspace.use() swaps the active account, project, workspace, or target without rebuilding the underlying httpx.Client or per-account /me cache. It returns self for fluent chaining, so cross-project iteration is O(1) per swap.
import mixpanel_data as mp
ws = mp.Workspace()
ws.use(account="team") # implicitly clears workspace
ws.use(project="3018488")
ws.use(workspace=3448414)
ws.use(target="ecom") # apply all three at once
# Persist the new state
ws.use(project="3018488", persist=True) # writes [active]
# Read the resolved state
print(ws.account.name, ws.project.id, ws.workspace.id if ws.workspace else None)
print(ws.session) # full Session snapshot
See Auth → Workspace.use() for the resolution semantics and parallel-snapshot patterns.
Class Reference¶
mixpanel_data.Workspace
¶
Workspace(
*,
account: str | None = None,
project: str | None = None,
workspace: int | None = None,
target: str | None = None,
session: Session | None = None,
_api_client: MixpanelAPIClient | None = None,
)
Unified entry point for Mixpanel data operations.
The Workspace class is a facade that orchestrates: - DiscoveryService for schema exploration - LiveQueryService for real-time analytics - App API client for CRUD and data governance operations
Examples:
Basic usage with credentials from config:
ws = Workspace()
events = ws.events() # discover schema
result = ws.segmentation(event="login", from_date="2024-01-01", to_date="2024-01-31")
ws.close()
Stream events for external processing:
ws = Workspace()
for event in ws.stream_events(from_date="2024-01-01", to_date="2024-01-31"):
process(event)
ws.close()
Create a new Workspace bound to a resolved :class:Session.
Resolution priority follows FR-017: env vars > kwargs > target >
bridge > [active] > Account.default_project. Pass
session= to bypass the resolver and use a pre-built
:class:Session directly.
| PARAMETER | DESCRIPTION |
|---|---|
account
|
Named account from
TYPE:
|
project
|
Project ID override (digit string).
TYPE:
|
workspace
|
Workspace ID override (positive int).
TYPE:
|
target
|
Apply all three axes from
TYPE:
|
session
|
Pre-built :class:
TYPE:
|
_api_client
|
Injected :class:
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
|
ConfigError
|
Account or project axis cannot be resolved. |
OAuthError
|
Auth header construction fails. |
Source code in src/mixpanel_data/workspace.py
369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 | |
workspace
property
¶
Return the resolved :class:WorkspaceRef (or None for lazy).
api
property
¶
Direct access to the Mixpanel API client.
Use this escape hatch for Mixpanel API operations not covered by the Workspace class. The client handles authentication automatically.
The client provides
request(method, url, **kwargs): Make authenticated requests to any Mixpanel API endpoint.project_id: The configured project ID for constructing URLs.region: The configured region ('us', 'eu', or 'in').
| RETURNS | DESCRIPTION |
|---|---|
MixpanelAPIClient
|
The underlying MixpanelAPIClient. |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If API credentials not available. |
Example
Fetch event schema from the Lexicon Schemas API::
import mixpanel_data as mp
from urllib.parse import quote
ws = mp.Workspace()
client = ws.api
# Build the URL with proper encoding
event_name = quote("Added To Cart", safe="")
url = f"https://mixpanel.com/api/app/projects/{client.project_id}/schemas/event/{event_name}"
# Make the authenticated request
schema = client.request("GET", url)
print(schema)
close
¶
Close all resources (HTTP client).
This method is idempotent and safe to call multiple times.
Source code in src/mixpanel_data/workspace.py
use
¶
use(
*,
account: str | None = None,
project: str | None = None,
workspace: int | None = None,
target: str | None = None,
persist: bool = False,
) -> Workspace
Swap one or more session axes in place; return self for chaining.
target= is mutually exclusive with account=/project=/
workspace=. The HTTP transport is preserved across all switches
(per Research R5).
When account= is supplied, the project axis re-resolves through
the FR-017 chain ending at the new account's default_project
(env MP_PROJECT_ID > explicit project= > new account's
default_project). If no source provides a project, the call
raises :class:ConfigError per FR-033 — the prior session's
project is NEVER carried forward across an account swap because
cross-account project access is not guaranteed. The workspace
axis is cleared on account swap (workspaces are project-scoped;
the prior workspace doesn't apply to the new project) — explicit
workspace= or MP_WORKSPACE_ID env override is honored.
| PARAMETER | DESCRIPTION |
|---|---|
account
|
Replacement account name.
TYPE:
|
project
|
Replacement project ID.
TYPE:
|
workspace
|
Replacement workspace ID.
TYPE:
|
target
|
Apply this target's three axes atomically.
TYPE:
|
persist
|
When
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Workspace
|
|
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
Mutually exclusive args, or referenced name missing. |
OAuthError
|
New auth header construction fails (atomic on success). |
ConfigError
|
|
Source code in src/mixpanel_data/workspace.py
491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 | |
me
¶
Get /me response for current credentials (cached 24h).
Returns the authenticated user's profile including all accessible organizations, projects, and workspaces.
| PARAMETER | DESCRIPTION |
|---|---|
force_refresh
|
If True, bypass cache and call the API.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Any
|
MeResponse with user profile, projects, and workspaces. |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials lack /me access (401 or 403). |
QueryError
|
If the API returns a non-403 error. |
Example
Source code in src/mixpanel_data/workspace.py
projects
¶
List all accessible projects via the /me API (FR-035).
Returns projects from the cached /me response, sorted by name. Each
entry is a v3 :class:Project (id + name + organization_id +
timezone), built from the underlying MeProjectInfo payload —
callers iterate for project in ws.projects(): ws.use(project=project.id)
per the documented cross-project iteration pattern.
Replaces the deprecated discover_projects() (which returned
list[tuple[str, MeProjectInfo]]) — for the raw /me shape
with extra fields (has_workspaces, domain, type, ...),
call self._me_svc.list_projects() directly from internal code.
| PARAMETER | DESCRIPTION |
|---|---|
refresh
|
When True, bypass the on-disk and in-memory
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[Project]
|
List of :class: |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials lack /me access. |
Example
Source code in src/mixpanel_data/workspace.py
workspaces
¶
List workspaces for a project via the /me API (FR-036).
Returns workspaces from the cached /me response, sorted by name.
Defaults to the current project if project_id is not provided.
Replaces the deprecated discover_workspaces() (which returned
list[MeWorkspaceInfo]) — for the raw /me shape with extra
fields (is_global, is_restricted, description, ...),
call self._me_svc.list_workspaces(project_id=) directly from
internal code.
| PARAMETER | DESCRIPTION |
|---|---|
project_id
|
Project ID to list workspaces for. Defaults to the current project.
TYPE:
|
refresh
|
When True, bypass the on-disk and in-memory
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[WorkspaceRef]
|
List of :class: |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials lack /me access. |
Example
Source code in src/mixpanel_data/workspace.py
list_workspaces
¶
List all public workspaces for the current project.
Delegates to the API client's list_workspaces() method, which
calls GET /api/app/projects/{pid}/workspaces/public.
| RETURNS | DESCRIPTION |
|---|---|
list[PublicWorkspace]
|
List of |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
API error (400, 404). |
ServerError
|
Server-side errors (5xx). |
Example
Source code in src/mixpanel_data/workspace.py
resolve_workspace_id
¶
Resolve the workspace ID for scoped requests.
Resolution order:
1. Workspace ID already pinned on the resolved session (for example
via Workspace(workspace=N), Workspace.use(workspace=N),
MP_WORKSPACE_ID, saved targets, bridge pins, or persisted
[active].workspace state)
2. Cached auto-discovered workspace ID
3. Auto-discover by listing workspaces and finding the default
| RETURNS | DESCRIPTION |
|---|---|
int
|
The resolved workspace ID. |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
WorkspaceScopeError
|
If no workspaces are found for the project. |
Source code in src/mixpanel_data/workspace.py
events
¶
List all event names in the Mixpanel project.
Results are cached for the lifetime of the Workspace.
| RETURNS | DESCRIPTION |
|---|---|
list[str]
|
Alphabetically sorted list of event names. |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If API credentials not available. |
AuthenticationError
|
If credentials are invalid. |
Source code in src/mixpanel_data/workspace.py
properties
¶
List all property names for an event.
Results are cached per event for the lifetime of the Workspace.
| PARAMETER | DESCRIPTION |
|---|---|
event
|
Event name to get properties for.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[str]
|
Alphabetically sorted list of property names. |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If API credentials not available. |
Source code in src/mixpanel_data/workspace.py
property_values
¶
Get sample values for a property.
Results are cached per (property, event, limit) for the lifetime of the Workspace.
| PARAMETER | DESCRIPTION |
|---|---|
property_name
|
Property to get values for.
TYPE:
|
event
|
Optional event to filter by.
TYPE:
|
limit
|
Maximum number of values to return.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[str]
|
List of sample property values as strings. |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If API credentials not available. |
Source code in src/mixpanel_data/workspace.py
subproperties
¶
subproperties(
property_name: str, *, event: str | None = None, sample_size: int = 50
) -> list[SubPropertyInfo]
List inferred subproperties of a list-of-object event property.
Samples values via :meth:property_values, parses each as JSON,
and returns one :class:SubPropertyInfo per discovered scalar
subproperty. Designed for properties like cart whose values
are objects with subkeys (Brand, Category, Price,
Item ID). The returned name and type plug directly
into :meth:GroupBy.list_item and :meth:Filter.list_contains.
Scope: only scalar subproperty values (string / number /
boolean / ISO datetime string) are reported. Subproperties whose
values are themselves dicts or lists are silently skipped — they
cannot be used by GroupBy.list_item or
Filter.list_contains anyway.
| PARAMETER | DESCRIPTION |
|---|---|
property_name
|
Top-level list-of-object property name (e.g.
TYPE:
|
event
|
Optional event name to scope the sample. Strongly recommended; without it the API may return values from across all events.
TYPE:
|
sample_size
|
Number of raw values to sample. Default: 50.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[SubPropertyInfo]
|
Alphabetically sorted list of :class: |
list[SubPropertyInfo]
|
Empty list if no parseable dict values were found. |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If API credentials cannot be resolved. |
AuthenticationError
|
If credentials are configured but rejected by Mixpanel. |
| WARNS | DESCRIPTION |
|---|---|
UserWarning
|
When a subproperty has values of mixed scalar
types across rows (collapses to |
Example
Source code in src/mixpanel_data/workspace.py
funnels
¶
List saved funnels in the Mixpanel project.
Results are cached for the lifetime of the Workspace.
| RETURNS | DESCRIPTION |
|---|---|
list[FunnelInfo]
|
List of FunnelInfo objects (funnel_id, name). |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If API credentials not available. |
Source code in src/mixpanel_data/workspace.py
cohorts
¶
List saved cohorts in the Mixpanel project.
Results are cached for the lifetime of the Workspace.
| RETURNS | DESCRIPTION |
|---|---|
list[SavedCohort]
|
List of SavedCohort objects. |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If API credentials not available. |
Source code in src/mixpanel_data/workspace.py
list_bookmarks
¶
List all saved reports (bookmarks) in the project.
Retrieves metadata for all saved Insights, Funnel, Retention, and Flows reports in the project.
| PARAMETER | DESCRIPTION |
|---|---|
bookmark_type
|
Optional filter by report type. Valid values are 'insights', 'funnels', 'retention', 'flows', 'launch-analysis'. If None, returns all bookmark types.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[BookmarkInfo]
|
List of BookmarkInfo objects with report metadata. |
list[BookmarkInfo]
|
Empty list if no bookmarks exist. |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If API credentials not available. |
QueryError
|
Permission denied or invalid type parameter. |
Source code in src/mixpanel_data/workspace.py
top_events
¶
top_events(
*,
type: Literal["general", "average", "unique"] = "general",
limit: int | None = None,
) -> list[TopEvent]
Get today's most active events.
This method is NOT cached (returns real-time data).
| PARAMETER | DESCRIPTION |
|---|---|
type
|
Counting method (general, average, unique).
TYPE:
|
limit
|
Maximum number of events to return.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[TopEvent]
|
List of TopEvent objects with |
list[TopEvent]
|
|
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If API credentials not available. |
Example
Source code in src/mixpanel_data/workspace.py
lexicon_schemas
¶
List Lexicon schemas in the project.
Retrieves documented event and profile property schemas from the Mixpanel Lexicon (data dictionary).
Results are cached for the lifetime of the Workspace.
| PARAMETER | DESCRIPTION |
|---|---|
entity_type
|
Optional filter by type ("event" or "profile"). If None, returns all schemas.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[LexiconSchema]
|
Alphabetically sorted list of LexiconSchema objects. |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If API credentials not available. |
AuthenticationError
|
If credentials are invalid. |
Note
The Lexicon API has a strict 5 requests/minute rate limit. Caching helps avoid hitting this limit; call clear_discovery_cache() only when fresh data is needed.
Source code in src/mixpanel_data/workspace.py
lexicon_schema
¶
Get a single Lexicon schema by entity type and name.
Retrieves a documented schema for a specific event or profile property from the Mixpanel Lexicon (data dictionary).
Results are cached for the lifetime of the Workspace.
| PARAMETER | DESCRIPTION |
|---|---|
entity_type
|
Entity type ("event" or "profile").
TYPE:
|
name
|
Entity name.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
LexiconSchema
|
LexiconSchema for the specified entity. |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If API credentials not available. |
AuthenticationError
|
If credentials are invalid. |
QueryError
|
If schema not found. |
Note
The Lexicon API has a strict 5 requests/minute rate limit. Caching helps avoid hitting this limit; call clear_discovery_cache() only when fresh data is needed.
Source code in src/mixpanel_data/workspace.py
clear_discovery_cache
¶
Clear cached discovery results.
Subsequent discovery calls will fetch fresh data from the API.
stream_events
¶
stream_events(
*,
from_date: str,
to_date: str,
events: list[str] | None = None,
where: str | None = None,
limit: int | None = None,
raw: bool = False,
) -> Iterator[dict[str, Any]]
Stream events directly from Mixpanel API without storing.
Yields events one at a time as they are received from the API. No database files or tables are created.
| PARAMETER | DESCRIPTION |
|---|---|
from_date
|
Start date inclusive (YYYY-MM-DD format).
TYPE:
|
to_date
|
End date inclusive (YYYY-MM-DD format).
TYPE:
|
events
|
Optional list of event names to filter. If None, all events returned.
TYPE:
|
where
|
Optional Mixpanel filter expression (e.g., 'properties["country"]=="US"').
TYPE:
|
limit
|
Optional maximum number of events to return (max 100000).
TYPE:
|
raw
|
If True, return events in raw Mixpanel API format. If False (default), return normalized format with datetime objects.
TYPE:
|
| YIELDS | DESCRIPTION |
|---|---|
dict[str, Any]
|
dict[str, Any]: Event dictionaries in normalized or raw format. |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If API credentials are not available. |
AuthenticationError
|
If credentials are invalid. |
RateLimitError
|
If rate limit exceeded after max retries. |
QueryError
|
If filter expression is invalid. |
ValueError
|
If limit is outside valid range (1-100000). |
Example
ws = Workspace()
for event in ws.stream_events(from_date="2024-01-01", to_date="2024-01-31"):
process(event)
ws.close()
With raw format:
Source code in src/mixpanel_data/workspace.py
1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 | |
stream_profiles
¶
stream_profiles(
*,
where: str | None = None,
cohort_id: str | None = None,
output_properties: list[str] | None = None,
raw: bool = False,
distinct_id: str | None = None,
distinct_ids: list[str] | None = None,
group_id: str | None = None,
behaviors: list[dict[str, Any]] | None = None,
as_of_timestamp: int | None = None,
include_all_users: bool = False,
) -> Iterator[dict[str, Any]]
Stream user profiles directly from Mixpanel API without storing.
Yields profiles one at a time as they are received from the API. No database files or tables are created.
| PARAMETER | DESCRIPTION |
|---|---|
where
|
Optional Mixpanel filter expression for profile properties.
TYPE:
|
cohort_id
|
Optional cohort ID to filter by. Only profiles that are members of this cohort will be returned.
TYPE:
|
output_properties
|
Optional list of property names to include in the response. If None, all properties are returned.
TYPE:
|
raw
|
If True, return profiles in raw Mixpanel API format. If False (default), return normalized format.
TYPE:
|
distinct_id
|
Optional single user ID to fetch. Mutually exclusive with distinct_ids.
TYPE:
|
distinct_ids
|
Optional list of user IDs to fetch. Mutually exclusive with distinct_id. Duplicates are automatically removed.
TYPE:
|
group_id
|
Optional group type identifier (e.g., "companies") to fetch group profiles instead of user profiles.
TYPE:
|
behaviors
|
Optional list of behavioral filters. Each dict should have
'window' (e.g., "30d"), 'name' (identifier), and 'event_selectors'
(list of {"event": "Name"}). Use with
TYPE:
|
as_of_timestamp
|
Optional Unix timestamp to query profile state at a specific point in time. Must be in the past.
TYPE:
|
include_all_users
|
If True, include all users and mark cohort membership. Only valid when cohort_id is provided.
TYPE:
|
| YIELDS | DESCRIPTION |
|---|---|
dict[str, Any]
|
dict[str, Any]: Profile dictionaries in normalized or raw format. |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If API credentials are not available. |
AuthenticationError
|
If credentials are invalid. |
RateLimitError
|
If rate limit exceeded after max retries. |
ValueError
|
If mutually exclusive parameters are provided. |
Example
Filter to premium users:
Filter by cohort and select specific properties:
for profile in ws.stream_profiles(
cohort_id="12345",
output_properties=["$email", "$name"]
):
send_email(profile)
Fetch specific users by ID:
Fetch group profiles:
Source code in src/mixpanel_data/workspace.py
1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 | |
query
¶
query(
events: str
| Metric
| CohortMetric
| Formula
| Sequence[str | Metric | CohortMetric | Formula],
*,
from_date: str | None = None,
to_date: str | None = None,
last: int = 30,
unit: QueryTimeUnit = "day",
math: MathType = "total",
math_property: str | None = None,
per_user: PerUserAggregation | None = None,
percentile_value: int | float | None = None,
group_by: str
| GroupBy
| CohortBreakdown
| FrequencyBreakdown
| list[str | GroupBy | CohortBreakdown | FrequencyBreakdown]
| None = None,
where: Filter
| FrequencyFilter
| list[Filter | FrequencyFilter]
| None = None,
formula: str | None = None,
formula_label: str | None = None,
rolling: int | None = None,
cumulative: bool = False,
mode: Literal["timeseries", "total", "table"] = "timeseries",
time_comparison: TimeComparison | None = None,
data_group_id: int | None = None,
) -> QueryResult
Run a typed insights query against the Mixpanel API.
Generates bookmark params from keyword arguments, POSTs them inline
to /api/query/insights, and returns a structured QueryResult
with lazy DataFrame conversion.
| PARAMETER | DESCRIPTION |
|---|---|
events
|
Event name(s) to query. Accepts a single string,
a Metric object, a CohortMetric object, a Formula
object, or a sequence mixing strings, Metrics,
CohortMetrics, and Formulas. Formula objects in the
list are extracted and appended as formula show clauses.
When events includes a CohortMetric,
TYPE:
|
from_date
|
Start date (YYYY-MM-DD). If set, overrides
TYPE:
|
to_date
|
End date (YYYY-MM-DD). Requires
TYPE:
|
last
|
Relative time range in days. Default: 30.
Ignored if
TYPE:
|
unit
|
Time aggregation unit. Default:
TYPE:
|
math
|
Aggregation function for plain-string events.
Default:
TYPE:
|
math_property
|
Property name for property-based math (average, sum, percentiles).
TYPE:
|
per_user
|
Per-user pre-aggregation (average, total, min, max).
TYPE:
|
percentile_value
|
Custom percentile value (e.g. 95 for p95).
Required when
TYPE:
|
group_by
|
Break down results by property or cohort membership.
Accepts a string,
TYPE:
|
where
|
Filter results by conditions. Accepts a Filter or list of Filters.
TYPE:
|
formula
|
Formula expression referencing events by position
(A, B, C...). Requires 2+ events. Cannot be combined
with Formula objects in
TYPE:
|
formula_label
|
Display label for formula result.
TYPE:
|
rolling
|
Rolling window size in periods.
Mutually exclusive with
TYPE:
|
cumulative
|
Enable cumulative analysis mode.
Mutually exclusive with
TYPE:
|
mode
|
Result shape.
TYPE:
|
time_comparison
|
Optional period-over-period comparison.
Use
TYPE:
|
data_group_id
|
Optional data group ID for group-level
analytics. Scopes the query to a specific data group.
Default:
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
QueryResult
|
QueryResult with series data, DataFrame, and metadata. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If arguments violate validation rules. |
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials. |
QueryError
|
Invalid query parameters. |
RateLimitError
|
Rate limit exceeded. |
Example
ws = Workspace()
# Simple event query
result = ws.query("Login")
print(result.df.head())
# With aggregation and time range
result = ws.query("Login", math="unique", last=7, unit="day")
# Multi-event with formula (top-level parameter)
result = ws.query(
[Metric("Signup", math="unique"), Metric("Purchase", math="unique")],
formula="(B / A) * 100",
formula_label="Conversion Rate",
)
# Multi-event with formula (Formula in list)
result = ws.query(
[Metric("Signup", math="unique"),
Metric("Purchase", math="unique"),
Formula("(B / A) * 100", label="Conversion Rate")],
)
Source code in src/mixpanel_data/workspace.py
2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 | |
build_params
¶
build_params(
events: str
| Metric
| CohortMetric
| Formula
| Sequence[str | Metric | CohortMetric | Formula],
*,
from_date: str | None = None,
to_date: str | None = None,
last: int = 30,
unit: QueryTimeUnit = "day",
math: MathType = "total",
math_property: str | None = None,
per_user: PerUserAggregation | None = None,
percentile_value: int | float | None = None,
group_by: str
| GroupBy
| CohortBreakdown
| FrequencyBreakdown
| list[str | GroupBy | CohortBreakdown | FrequencyBreakdown]
| None = None,
where: Filter
| FrequencyFilter
| list[Filter | FrequencyFilter]
| None = None,
formula: str | None = None,
formula_label: str | None = None,
rolling: int | None = None,
cumulative: bool = False,
mode: Literal["timeseries", "total", "table"] = "timeseries",
time_comparison: TimeComparison | None = None,
data_group_id: int | None = None,
) -> dict[str, Any]
Build validated bookmark params without executing the API call.
Has the same signature as :meth:query but returns the generated
bookmark params dict instead of querying the Mixpanel API. Useful
for debugging, inspecting generated JSON, persisting via
:meth:create_bookmark, or testing.
| PARAMETER | DESCRIPTION |
|---|---|
events
|
Event name(s) to query. Accepts a single string,
a
TYPE:
|
from_date
|
Start date (YYYY-MM-DD). If set, overrides
TYPE:
|
to_date
|
End date (YYYY-MM-DD). Requires
TYPE:
|
last
|
Relative time range in days. Default: 30.
TYPE:
|
unit
|
Time aggregation unit. Default:
TYPE:
|
math
|
Aggregation function for plain-string events.
Default:
TYPE:
|
math_property
|
Property name for property-based math.
TYPE:
|
per_user
|
Per-user pre-aggregation.
TYPE:
|
percentile_value
|
Custom percentile value (e.g. 95).
Required when
TYPE:
|
group_by
|
Break down results by property or cohort membership.
Accepts a string,
TYPE:
|
where
|
Filter results by conditions.
TYPE:
|
formula
|
Formula expression referencing events by position.
TYPE:
|
formula_label
|
Display label for formula result.
TYPE:
|
rolling
|
Rolling window size in periods.
TYPE:
|
cumulative
|
Enable cumulative analysis mode.
TYPE:
|
mode
|
Result shape. Default:
TYPE:
|
time_comparison
|
Optional period-over-period comparison.
Use
TYPE:
|
data_group_id
|
Optional data group ID for group-level
analytics. Scopes the query to a specific data group.
Default:
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
dict[str, Any]
|
Bookmark params dict with |
dict[str, Any]
|
keys, ready for use with the insights API or |
dict[str, Any]
|
meth: |
| RAISES | DESCRIPTION |
|---|---|
BookmarkValidationError
|
If arguments violate validation rules. |
Example
ws = Workspace()
# Inspect generated bookmark JSON
params = ws.build_params("Login", math="unique", last=7)
print(json.dumps(params, indent=2))
# Save as a bookmark (dashboard_id required)
ws.create_bookmark(CreateBookmarkParams(
name="Daily Unique Logins",
bookmark_type="insights",
params=params,
dashboard_id=12345,
))
Source code in src/mixpanel_data/workspace.py
2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 | |
query_funnel
¶
query_funnel(
steps: list[str | FunnelStep],
*,
conversion_window: int = 14,
conversion_window_unit: Literal[
"second", "minute", "hour", "day", "week", "month", "session"
] = "day",
order: Literal["loose", "any"] = "loose",
from_date: str | None = None,
to_date: str | None = None,
last: int = 30,
unit: QueryTimeUnit = "day",
math: FunnelMathType = "conversion_rate_unique",
math_property: str | None = None,
group_by: str
| GroupBy
| CohortBreakdown
| list[str | GroupBy | CohortBreakdown]
| None = None,
where: Filter | list[Filter] | None = None,
exclusions: list[str | Exclusion] | None = None,
holding_constant: str
| HoldingConstant
| list[str | HoldingConstant]
| None = None,
mode: Literal["steps", "trends", "table"] = "steps",
reentry_mode: FunnelReentryMode | None = None,
time_comparison: TimeComparison | None = None,
data_group_id: int | None = None,
) -> FunnelQueryResult
Run a typed funnel query against the Mixpanel API.
Generates funnel bookmark params from keyword arguments, POSTs
them inline to /api/query/insights, and returns a structured
FunnelQueryResult with lazy DataFrame conversion.
| PARAMETER | DESCRIPTION |
|---|---|
steps
|
Funnel step specifications. At least 2 required.
Accepts event name strings or
TYPE:
|
conversion_window
|
How long users have to complete the funnel. Default: 14.
TYPE:
|
conversion_window_unit
|
Time unit for conversion window.
Default:
TYPE:
|
order
|
Step ordering mode.
TYPE:
|
from_date
|
Start date (YYYY-MM-DD). If set, overrides
TYPE:
|
to_date
|
End date (YYYY-MM-DD). Requires
TYPE:
|
last
|
Relative time range in days. Default: 30.
TYPE:
|
unit
|
Time aggregation unit. Default:
TYPE:
|
math
|
Funnel aggregation function. Default:
TYPE:
|
math_property
|
Numeric property name for property-aggregation
math types (
TYPE:
|
group_by
|
Break down results by property or cohort
membership. Accepts a string,
TYPE:
|
where
|
Filter results by conditions. |
exclusions
|
Events to exclude between steps. Accepts
event name strings or
TYPE:
|
holding_constant
|
Properties to hold constant across
steps. Accepts strings,
TYPE:
|
mode
|
Result display mode.
TYPE:
|
reentry_mode
|
Funnel reentry mode controlling how users
re-enter the funnel after conversion. One of
TYPE:
|
time_comparison
|
Optional period-over-period comparison.
Use
TYPE:
|
data_group_id
|
Optional data group ID for group-level
analytics. Scopes the query to a specific data group.
Default:
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
FunnelQueryResult
|
FunnelQueryResult with step data, DataFrame, and metadata. |
| RAISES | DESCRIPTION |
|---|---|
BookmarkValidationError
|
If arguments violate validation rules (before API call). |
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials. |
QueryError
|
Invalid query parameters. |
RateLimitError
|
Rate limit exceeded. |
Example
Source code in src/mixpanel_data/workspace.py
3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 | |
build_funnel_params
¶
build_funnel_params(
steps: list[str | FunnelStep],
*,
conversion_window: int = 14,
conversion_window_unit: Literal[
"second", "minute", "hour", "day", "week", "month", "session"
] = "day",
order: Literal["loose", "any"] = "loose",
from_date: str | None = None,
to_date: str | None = None,
last: int = 30,
unit: QueryTimeUnit = "day",
math: FunnelMathType = "conversion_rate_unique",
math_property: str | None = None,
group_by: str
| GroupBy
| CohortBreakdown
| list[str | GroupBy | CohortBreakdown]
| None = None,
where: Filter | list[Filter] | None = None,
exclusions: list[str | Exclusion] | None = None,
holding_constant: str
| HoldingConstant
| list[str | HoldingConstant]
| None = None,
mode: Literal["steps", "trends", "table"] = "steps",
reentry_mode: FunnelReentryMode | None = None,
time_comparison: TimeComparison | None = None,
data_group_id: int | None = None,
) -> dict[str, Any]
Build validated funnel bookmark params without executing.
Has the same signature as :meth:query_funnel but returns the
generated bookmark params dict instead of querying the API.
Useful for debugging, inspecting generated JSON, persisting
via :meth:create_bookmark, or testing.
| PARAMETER | DESCRIPTION |
|---|---|
steps
|
Funnel step specifications. At least 2 required.
TYPE:
|
conversion_window
|
Conversion window size. Default: 14.
TYPE:
|
conversion_window_unit
|
Time unit. Default:
TYPE:
|
order
|
Step ordering mode. Default:
TYPE:
|
from_date
|
Start date (YYYY-MM-DD) or None.
TYPE:
|
to_date
|
End date (YYYY-MM-DD) or None.
TYPE:
|
last
|
Relative time range in days. Default: 30.
TYPE:
|
unit
|
Time aggregation unit. Default:
TYPE:
|
math
|
Aggregation function. Default:
TYPE:
|
math_property
|
Numeric property name for property-aggregation
math types. Required for
TYPE:
|
group_by
|
Break down results by property or cohort
membership. Accepts a string,
TYPE:
|
where
|
Filter results by conditions. |
exclusions
|
Events to exclude between steps.
TYPE:
|
holding_constant
|
Properties to hold constant.
TYPE:
|
mode
|
Display mode. Default:
TYPE:
|
reentry_mode
|
Funnel reentry mode controlling how users
re-enter the funnel after conversion. One of
TYPE:
|
time_comparison
|
Optional period-over-period comparison.
Use
TYPE:
|
data_group_id
|
Optional data group ID for group-level
analytics. Scopes the query to a specific data group.
Default:
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
dict[str, Any]
|
Bookmark params dict with |
dict[str, Any]
|
|
| RAISES | DESCRIPTION |
|---|---|
BookmarkValidationError
|
If arguments violate validation rules. |
Example
ws = Workspace()
# Inspect generated JSON
params = ws.build_funnel_params(["Signup", "Purchase"])
print(json.dumps(params, indent=2))
# Save as a report (dashboard_id required)
ws.create_bookmark(CreateBookmarkParams(
name="Signup → Purchase Funnel",
bookmark_type="funnels",
params=params,
dashboard_id=12345,
))
Source code in src/mixpanel_data/workspace.py
3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 | |
query_retention
¶
query_retention(
born_event: str | RetentionEvent,
return_event: str | RetentionEvent,
*,
retention_unit: TimeUnit = "week",
alignment: RetentionAlignment = "birth",
bucket_sizes: list[int] | None = None,
from_date: str | None = None,
to_date: str | None = None,
last: int = 30,
unit: QueryTimeUnit = "day",
math: RetentionMathType = "retention_rate",
group_by: str
| GroupBy
| CohortBreakdown
| list[str | GroupBy | CohortBreakdown]
| None = None,
where: Filter | list[Filter] | None = None,
mode: RetentionMode = "curve",
unbounded_mode: RetentionUnboundedMode | None = None,
retention_cumulative: bool = False,
time_comparison: TimeComparison | None = None,
data_group_id: int | None = None,
) -> RetentionQueryResult
Run a typed retention query against the Mixpanel API.
Generates retention bookmark params from keyword arguments, POSTs
them inline to /api/query/insights, and returns a structured
RetentionQueryResult with lazy DataFrame conversion.
| PARAMETER | DESCRIPTION |
|---|---|
born_event
|
Event that defines cohort membership. Accepts
an event name string or a
TYPE:
|
return_event
|
Event that defines return. Accepts an event
name string or a
TYPE:
|
retention_unit
|
Retention period unit. Default:
TYPE:
|
alignment
|
Retention alignment mode. Default:
TYPE:
|
bucket_sizes
|
Custom bucket sizes (positive ints in
ascending order). Default:
TYPE:
|
from_date
|
Start date (YYYY-MM-DD). If set, overrides
TYPE:
|
to_date
|
End date (YYYY-MM-DD). Requires
TYPE:
|
last
|
Relative time range in days. Default: 30.
TYPE:
|
unit
|
Time aggregation unit (
TYPE:
|
math
|
Retention aggregation function. Default:
TYPE:
|
group_by
|
Break down results by property or cohort
membership. Accepts a string,
TYPE:
|
where
|
Filter results by conditions. |
mode
|
Result display mode. Default:
TYPE:
|
unbounded_mode
|
Retention unbounded mode controlling how
retention is counted in unbounded periods. One of
TYPE:
|
retention_cumulative
|
Whether to use cumulative retention
counting. Default:
TYPE:
|
time_comparison
|
Optional period-over-period comparison.
Use
TYPE:
|
data_group_id
|
Optional data group ID for group-level
analytics. Scopes the query to a specific data group.
Default:
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
RetentionQueryResult
|
RetentionQueryResult with cohort data, DataFrame, and |
RetentionQueryResult
|
metadata. |
| RAISES | DESCRIPTION |
|---|---|
BookmarkValidationError
|
If arguments violate validation rules (before API call). |
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials. |
QueryError
|
Invalid query parameters. |
RateLimitError
|
Rate limit exceeded. |
Example
Source code in src/mixpanel_data/workspace.py
4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 | |
build_retention_params
¶
build_retention_params(
born_event: str | RetentionEvent,
return_event: str | RetentionEvent,
*,
retention_unit: TimeUnit = "week",
alignment: RetentionAlignment = "birth",
bucket_sizes: list[int] | None = None,
from_date: str | None = None,
to_date: str | None = None,
last: int = 30,
unit: QueryTimeUnit = "day",
math: RetentionMathType = "retention_rate",
group_by: str
| GroupBy
| CohortBreakdown
| list[str | GroupBy | CohortBreakdown]
| None = None,
where: Filter | list[Filter] | None = None,
mode: RetentionMode = "curve",
unbounded_mode: RetentionUnboundedMode | None = None,
retention_cumulative: bool = False,
time_comparison: TimeComparison | None = None,
data_group_id: int | None = None,
) -> dict[str, Any]
Build validated retention bookmark params without executing.
Accepts the same arguments as :meth:query_retention but returns
the generated bookmark params dict (not a
RetentionQueryResult) instead of querying the API. Useful for
debugging, inspecting generated JSON, persisting via
:meth:create_bookmark, or testing.
| PARAMETER | DESCRIPTION |
|---|---|
born_event
|
Event that defines cohort membership.
TYPE:
|
return_event
|
Event that defines return.
TYPE:
|
retention_unit
|
Retention period unit. Default:
TYPE:
|
alignment
|
Retention alignment mode. Default:
TYPE:
|
bucket_sizes
|
Custom bucket sizes. Default:
TYPE:
|
from_date
|
Start date (YYYY-MM-DD) or None.
TYPE:
|
to_date
|
End date (YYYY-MM-DD) or None.
TYPE:
|
last
|
Relative time range in days. Default: 30.
TYPE:
|
unit
|
Time aggregation unit (
TYPE:
|
math
|
Aggregation function. Default:
TYPE:
|
group_by
|
Break down results by property or cohort
membership. Accepts a string,
TYPE:
|
where
|
Filter results by conditions. |
mode
|
Display mode. Default:
TYPE:
|
unbounded_mode
|
Retention unbounded mode controlling how
retention is counted in unbounded periods. One of
TYPE:
|
retention_cumulative
|
Whether to use cumulative retention
counting. Default:
TYPE:
|
time_comparison
|
Optional period-over-period comparison.
Use
TYPE:
|
data_group_id
|
Optional data group ID for group-level
analytics. Scopes the query to a specific data group.
Default:
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
dict[str, Any]
|
Bookmark params dict with |
dict[str, Any]
|
|
| RAISES | DESCRIPTION |
|---|---|
BookmarkValidationError
|
If arguments violate validation rules. |
Example
ws = Workspace()
# Inspect generated JSON
params = ws.build_retention_params("Signup", "Login")
print(json.dumps(params, indent=2))
# Save as a report (dashboard_id required)
ws.create_bookmark(CreateBookmarkParams(
name="Signup → Login Retention",
bookmark_type="retention",
params=params,
dashboard_id=12345,
))
Source code in src/mixpanel_data/workspace.py
4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 | |
query_flow
¶
query_flow(
event: str | FlowStep | Sequence[str | FlowStep],
*,
forward: int = 3,
reverse: int = 0,
from_date: str | None = None,
to_date: str | None = None,
last: int = 30,
conversion_window: int = 7,
conversion_window_unit: Literal["day", "week", "month", "session"] = "day",
count_type: Literal["unique", "total", "session"] = "unique",
cardinality: int = 3,
collapse_repeated: bool = False,
hidden_events: list[str] | None = None,
mode: Literal["sankey", "paths", "tree"] = "sankey",
where: Filter | list[Filter] | None = None,
data_group_id: int | None = None,
segments: str
| GroupBy
| CohortBreakdown
| FrequencyBreakdown
| list[str | GroupBy | CohortBreakdown | FrequencyBreakdown]
| None = None,
exclusions: list[str] | None = None,
) -> FlowQueryResult
Run a typed flow query against the Mixpanel API.
Generates flow bookmark params from keyword arguments, POSTs
them inline to /arb_funnels, and returns a structured
FlowQueryResult with lazy DataFrame conversion.
| PARAMETER | DESCRIPTION |
|---|---|
event
|
Event specification. Accepts an event name string,
a |
forward
|
Default number of forward steps to trace from
each anchor event. Overridden by per-step values.
Default:
TYPE:
|
reverse
|
Default number of reverse steps to trace from
each anchor event. Overridden by per-step values.
Default:
TYPE:
|
from_date
|
Start date (YYYY-MM-DD). If set, overrides
TYPE:
|
to_date
|
End date (YYYY-MM-DD). Requires
TYPE:
|
last
|
Relative time range in days. Default: 30.
TYPE:
|
conversion_window
|
Conversion window size. Default: 7.
TYPE:
|
conversion_window_unit
|
Conversion window unit.
Default:
TYPE:
|
count_type
|
Counting method for flow analysis.
Default:
TYPE:
|
cardinality
|
Number of top paths to display.
Default:
TYPE:
|
collapse_repeated
|
Whether to merge consecutive repeated
events. Default:
TYPE:
|
hidden_events
|
Events to hide from the flow visualization.
Default:
TYPE:
|
mode
|
Flow visualization mode. Default:
TYPE:
|
where
|
Filter results by cohort membership or property
conditions. Cohort filters ( |
data_group_id
|
Optional data group ID for group-level
analytics. Scopes the query to a specific data group.
Default:
TYPE:
|
segments
|
Segment (breakdown) specification for flow
results. Accepts a string,
TYPE:
|
exclusions
|
List of event names to exclude from flow
paths. Default:
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
FlowQueryResult
|
FlowQueryResult with steps, flows, breakdowns, and |
FlowQueryResult
|
metadata. |
| RAISES | DESCRIPTION |
|---|---|
BookmarkValidationError
|
If arguments violate validation rules (before API call). |
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials. |
QueryError
|
Invalid query parameters. |
RateLimitError
|
Rate limit exceeded. |
Example
ws = Workspace()
# Simple flow query
result = ws.query_flow("Login")
print(result.overall_conversion_rate)
# With configuration
result = ws.query_flow(
FlowStep("Login", forward=5, reverse=2),
mode="paths",
last=90,
)
print(result.df)
# With property filter and segments
result = ws.query_flow(
"Login",
where=Filter.equals("country", "US"),
segments=GroupBy("platform"),
exclusions=["Error Event"],
)
Source code in src/mixpanel_data/workspace.py
3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 | |
build_flow_params
¶
build_flow_params(
event: str | FlowStep | Sequence[str | FlowStep],
*,
forward: int = 3,
reverse: int = 0,
from_date: str | None = None,
to_date: str | None = None,
last: int = 30,
conversion_window: int = 7,
conversion_window_unit: Literal["day", "week", "month", "session"] = "day",
count_type: Literal["unique", "total", "session"] = "unique",
cardinality: int = 3,
collapse_repeated: bool = False,
hidden_events: list[str] | None = None,
mode: Literal["sankey", "paths", "tree"] = "sankey",
where: Filter | list[Filter] | None = None,
data_group_id: int | None = None,
segments: str
| GroupBy
| CohortBreakdown
| FrequencyBreakdown
| list[str | GroupBy | CohortBreakdown | FrequencyBreakdown]
| None = None,
exclusions: list[str] | None = None,
) -> dict[str, Any]
Build validated flow bookmark params without executing.
Accepts the same arguments as :meth:query_flow but returns
the generated bookmark params dict instead of querying
the API. Useful for debugging, inspecting generated JSON,
persisting via :meth:create_bookmark, or testing.
| PARAMETER | DESCRIPTION |
|---|---|
event
|
Event specification. Accepts an event name string,
a |
forward
|
Default forward step count. Default:
TYPE:
|
reverse
|
Default reverse step count. Default:
TYPE:
|
from_date
|
Start date (YYYY-MM-DD) or
TYPE:
|
to_date
|
End date (YYYY-MM-DD) or
TYPE:
|
last
|
Relative time range in days. Default: 30.
TYPE:
|
conversion_window
|
Conversion window size. Default: 7.
TYPE:
|
conversion_window_unit
|
Conversion window unit.
Default:
TYPE:
|
count_type
|
Counting method. Default:
TYPE:
|
cardinality
|
Number of top paths. Default:
TYPE:
|
collapse_repeated
|
Merge repeated events. Default:
TYPE:
|
hidden_events
|
Events to hide. Default:
TYPE:
|
mode
|
Display mode. Default:
TYPE:
|
where
|
Filter results by cohort membership or property
conditions. Cohort filters produce |
data_group_id
|
Optional data group ID for group-level
analytics. Scopes the query to a specific data group.
Default:
TYPE:
|
segments
|
Segment (breakdown) specification for flow
results. Accepts a string,
TYPE:
|
exclusions
|
List of event names to exclude from flow
paths. Default:
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
dict[str, Any]
|
Flat bookmark params dict with |
dict[str, Any]
|
|
| RAISES | DESCRIPTION |
|---|---|
BookmarkValidationError
|
If arguments violate validation rules. |
Example
Source code in src/mixpanel_data/workspace.py
3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 | |
query_user
¶
query_user(
*,
where: Filter | list[Filter] | str | None = None,
cohort: int | CohortDefinition | None = None,
properties: list[str] | None = None,
sort_by: str | None = None,
sort_order: Literal["ascending", "descending"] = "descending",
limit: int | None = 1,
search: str | None = None,
distinct_id: str | None = None,
distinct_ids: list[str] | None = None,
group_id: str | None = None,
as_of: str | int | None = None,
mode: Literal["profiles", "aggregate"] = "aggregate",
aggregate: Literal[
"count", "extremes", "percentile", "numeric_summary"
] = "count",
aggregate_property: str | None = None,
percentile: float | None = None,
segment_by: list[int] | None = None,
parallel: bool = False,
workers: int = 5,
include_all_users: bool = False,
) -> UserQueryResult
Query user profiles from Mixpanel's Engage API.
Provides a high-level interface to Mixpanel's Engage API for
querying user profiles with typed filters, cohort membership,
sorting, and pagination. Results are returned as a structured
UserQueryResult with lazy DataFrame conversion.
| PARAMETER | DESCRIPTION |
|---|---|
where
|
Filter profiles by property values. Accepts a single
|
cohort
|
Filter by cohort membership. An
TYPE:
|
properties
|
Output properties to include in results.
TYPE:
|
sort_by
|
Property name to sort results by.
TYPE:
|
sort_order
|
Sort direction (
TYPE:
|
limit
|
Maximum profiles to return. Defaults to
TYPE:
|
search
|
Full-text search term applied to profile properties.
TYPE:
|
distinct_id
|
Look up a single user by distinct ID.
TYPE:
|
distinct_ids
|
Batch look up multiple users by distinct IDs.
TYPE:
|
group_id
|
Query group profiles instead of user profiles.
TYPE:
|
as_of
|
Point-in-time query. An ISO date string (
TYPE:
|
mode
|
Output mode (
TYPE:
|
aggregate
|
Aggregation function for aggregate mode. One of
TYPE:
|
aggregate_property
|
Property to aggregate on (required for non-count aggregations).
TYPE:
|
percentile
|
Percentile value (0-100 exclusive). Required
when
TYPE:
|
segment_by
|
Cohort IDs for segmented aggregation.
TYPE:
|
parallel
|
Whether to enable concurrent page fetching.
TYPE:
|
workers
|
Maximum concurrent workers for parallel fetching.
TYPE:
|
include_all_users
|
Include non-members in cohort query results.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
UserQueryResult
|
|
UserQueryResult
|
and execution metadata. |
| RAISES | DESCRIPTION |
|---|---|
BookmarkValidationError
|
If any validation rule fails. |
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
RateLimitError
|
API rate limit exceeded (429). |
APIError
|
Other API communication errors. |
Example
ws = Workspace()
# Quick peek at one profile
result = ws.query_user()
print(result.df)
# Filter premium users, sorted by LTV
result = ws.query_user(
where=Filter.equals("plan", "premium"),
sort_by="ltv",
sort_order="descending",
limit=100,
)
print(f"Total premium users: {result.total}")
print(result.df.head())
# Batch lookup specific users
result = ws.query_user(
distinct_ids=["user_001", "user_002"],
limit=None,
)
Source code in src/mixpanel_data/workspace.py
9307 9308 9309 9310 9311 9312 9313 9314 9315 9316 9317 9318 9319 9320 9321 9322 9323 9324 9325 9326 9327 9328 9329 9330 9331 9332 9333 9334 9335 9336 9337 9338 9339 9340 9341 9342 9343 9344 9345 9346 9347 9348 9349 9350 9351 9352 9353 9354 9355 9356 9357 9358 9359 9360 9361 9362 9363 9364 9365 9366 9367 9368 9369 9370 9371 9372 9373 9374 9375 9376 9377 9378 9379 9380 9381 9382 9383 9384 9385 9386 9387 9388 9389 9390 9391 9392 9393 9394 9395 9396 9397 9398 9399 9400 9401 9402 9403 9404 9405 9406 9407 9408 9409 9410 9411 9412 9413 9414 9415 9416 9417 9418 9419 9420 9421 9422 9423 9424 9425 9426 9427 9428 9429 9430 9431 9432 9433 9434 9435 9436 9437 9438 9439 9440 9441 9442 9443 9444 9445 9446 9447 9448 9449 9450 9451 9452 9453 9454 9455 9456 9457 9458 9459 9460 9461 9462 9463 9464 9465 9466 | |
build_user_params
¶
build_user_params(
*,
where: Filter | list[Filter] | str | None = None,
cohort: int | CohortDefinition | None = None,
properties: list[str] | None = None,
sort_by: str | None = None,
sort_order: Literal["ascending", "descending"] = "descending",
search: str | None = None,
distinct_id: str | None = None,
distinct_ids: list[str] | None = None,
group_id: str | None = None,
as_of: str | int | None = None,
mode: Literal["profiles", "aggregate"] = "aggregate",
aggregate: Literal[
"count", "extremes", "percentile", "numeric_summary"
] = "count",
aggregate_property: str | None = None,
percentile: float | None = None,
segment_by: list[int] | None = None,
limit: int | None = 1,
parallel: bool = False,
workers: int = 5,
include_all_users: bool = False,
) -> dict[str, Any]
Build engage API params without executing a query.
Validates arguments and constructs the params dict that would be sent to the Engage API, without actually making an API call. Useful for debugging, testing, and inspecting the generated params before execution.
| PARAMETER | DESCRIPTION |
|---|---|
where
|
Filter profiles by property values. Accepts a single
|
cohort
|
Filter by cohort membership. An
TYPE:
|
properties
|
Output properties to include in results.
TYPE:
|
sort_by
|
Property name to sort results by.
TYPE:
|
sort_order
|
Sort direction (
TYPE:
|
search
|
Full-text search term applied to profile properties.
TYPE:
|
distinct_id
|
Look up a single user by distinct ID.
TYPE:
|
distinct_ids
|
Batch look up multiple users by distinct IDs.
TYPE:
|
group_id
|
Query group profiles instead of user profiles.
TYPE:
|
as_of
|
Point-in-time query. An ISO date string (
TYPE:
|
mode
|
Output mode (
TYPE:
|
aggregate
|
Aggregation function for aggregate mode. One of
TYPE:
|
aggregate_property
|
Property to aggregate on (required for non-count aggregations).
TYPE:
|
percentile
|
Percentile value (0-100 exclusive). Required
when
TYPE:
|
segment_by
|
Cohort IDs for segmented aggregation.
TYPE:
|
limit
|
Maximum profiles to return. Defaults to
TYPE:
|
parallel
|
Whether to enable concurrent page fetching.
Accepted for signature compatibility with
TYPE:
|
workers
|
Maximum concurrent workers for parallel fetching.
Accepted for signature compatibility with
TYPE:
|
include_all_users
|
Include non-members in cohort query results.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
dict[str, Any]
|
Engage API params dict. Does not include pagination params |
dict[str, Any]
|
( |
dict[str, Any]
|
execution time by |
| RAISES | DESCRIPTION |
|---|---|
BookmarkValidationError
|
If any validation rule fails at either the argument level (U1-U28) or the param level (UP1-UP4). |
Example
Source code in src/mixpanel_data/workspace.py
9468 9469 9470 9471 9472 9473 9474 9475 9476 9477 9478 9479 9480 9481 9482 9483 9484 9485 9486 9487 9488 9489 9490 9491 9492 9493 9494 9495 9496 9497 9498 9499 9500 9501 9502 9503 9504 9505 9506 9507 9508 9509 9510 9511 9512 9513 9514 9515 9516 9517 9518 9519 9520 9521 9522 9523 9524 9525 9526 9527 9528 9529 9530 9531 9532 9533 9534 9535 9536 9537 9538 9539 9540 9541 9542 9543 9544 9545 9546 9547 9548 9549 9550 9551 9552 9553 9554 9555 9556 9557 9558 9559 9560 9561 9562 9563 9564 9565 9566 9567 9568 9569 9570 9571 9572 9573 9574 9575 9576 9577 9578 9579 9580 9581 | |
segmentation
¶
segmentation(
event: str,
*,
from_date: str,
to_date: str,
on: str | None = None,
unit: Literal["day", "week", "month"] = "day",
where: str | None = None,
) -> SegmentationResult
Run a segmentation query against Mixpanel API.
| PARAMETER | DESCRIPTION |
|---|---|
event
|
Event name to query.
TYPE:
|
from_date
|
Start date (YYYY-MM-DD).
TYPE:
|
to_date
|
End date (YYYY-MM-DD).
TYPE:
|
on
|
Optional property to segment by.
TYPE:
|
unit
|
Time unit for aggregation.
TYPE:
|
where
|
Optional WHERE clause.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
SegmentationResult
|
SegmentationResult with time-series data. |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If API credentials not available. |
Source code in src/mixpanel_data/workspace.py
funnel
¶
funnel(
funnel_id: int,
*,
from_date: str,
to_date: str,
unit: str | None = None,
on: str | None = None,
) -> FunnelResult
Run a funnel analysis query.
| PARAMETER | DESCRIPTION |
|---|---|
funnel_id
|
ID of saved funnel.
TYPE:
|
from_date
|
Start date (YYYY-MM-DD).
TYPE:
|
to_date
|
End date (YYYY-MM-DD).
TYPE:
|
unit
|
Optional time unit.
TYPE:
|
on
|
Optional property to segment by.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
FunnelResult
|
FunnelResult with step conversion rates. |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If API credentials not available. |
Source code in src/mixpanel_data/workspace.py
retention
¶
retention(
*,
born_event: str,
return_event: str,
from_date: str,
to_date: str,
born_where: str | None = None,
return_where: str | None = None,
interval: int = 1,
interval_count: int = 10,
unit: Literal["day", "week", "month"] = "day",
) -> RetentionResult
Run a retention analysis query.
| PARAMETER | DESCRIPTION |
|---|---|
born_event
|
Event that defines cohort entry.
TYPE:
|
return_event
|
Event that defines return.
TYPE:
|
from_date
|
Start date (YYYY-MM-DD).
TYPE:
|
to_date
|
End date (YYYY-MM-DD).
TYPE:
|
born_where
|
Optional filter for born event.
TYPE:
|
return_where
|
Optional filter for return event.
TYPE:
|
interval
|
Retention interval.
TYPE:
|
interval_count
|
Number of intervals.
TYPE:
|
unit
|
Time unit.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
RetentionResult
|
RetentionResult with cohort retention data. |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If API credentials not available. |
Source code in src/mixpanel_data/workspace.py
jql
¶
Execute a custom JQL script.
| PARAMETER | DESCRIPTION |
|---|---|
script
|
JQL script code.
TYPE:
|
params
|
Optional parameters to pass to script.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
JQLResult
|
JQLResult with raw query results. |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If API credentials not available. |
JQLSyntaxError
|
If script has syntax errors. |
Source code in src/mixpanel_data/workspace.py
event_counts
¶
event_counts(
events: list[str],
*,
from_date: str,
to_date: str,
type: Literal["general", "unique", "average"] = "general",
unit: Literal["day", "week", "month"] = "day",
) -> EventCountsResult
Get event counts for multiple events.
| PARAMETER | DESCRIPTION |
|---|---|
events
|
List of event names.
TYPE:
|
from_date
|
Start date (YYYY-MM-DD).
TYPE:
|
to_date
|
End date (YYYY-MM-DD).
TYPE:
|
type
|
Counting method.
TYPE:
|
unit
|
Time unit.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
EventCountsResult
|
EventCountsResult with time-series per event. |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If API credentials not available. |
Source code in src/mixpanel_data/workspace.py
property_counts
¶
property_counts(
event: str,
property_name: str,
*,
from_date: str,
to_date: str,
type: Literal["general", "unique", "average"] = "general",
unit: Literal["day", "week", "month"] = "day",
values: list[str] | None = None,
limit: int | None = None,
) -> PropertyCountsResult
Get event counts broken down by property values.
| PARAMETER | DESCRIPTION |
|---|---|
event
|
Event name.
TYPE:
|
property_name
|
Property to break down by.
TYPE:
|
from_date
|
Start date (YYYY-MM-DD).
TYPE:
|
to_date
|
End date (YYYY-MM-DD).
TYPE:
|
type
|
Counting method.
TYPE:
|
unit
|
Time unit.
TYPE:
|
values
|
Optional list of property values to include.
TYPE:
|
limit
|
Maximum number of property values.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
PropertyCountsResult
|
PropertyCountsResult with time-series per property value. |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If API credentials not available. |
Source code in src/mixpanel_data/workspace.py
activity_feed
¶
activity_feed(
distinct_ids: list[str],
*,
from_date: str | None = None,
to_date: str | None = None,
) -> ActivityFeedResult
Get activity feed for specific users.
| PARAMETER | DESCRIPTION |
|---|---|
distinct_ids
|
List of user identifiers.
TYPE:
|
from_date
|
Optional start date filter.
TYPE:
|
to_date
|
Optional end date filter.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ActivityFeedResult
|
ActivityFeedResult with user events. |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If API credentials not available. |
Source code in src/mixpanel_data/workspace.py
query_saved_report
¶
query_saved_report(
bookmark_id: int,
*,
bookmark_type: Literal[
"insights", "funnels", "retention", "flows"
] = "insights",
from_date: str | None = None,
to_date: str | None = None,
) -> SavedReportResult
Query a saved report by bookmark type.
Routes to the appropriate Mixpanel API endpoint based on bookmark_type and returns the normalized result.
| PARAMETER | DESCRIPTION |
|---|---|
bookmark_id
|
ID of saved report (from list_bookmarks or Mixpanel URL).
TYPE:
|
bookmark_type
|
Type of bookmark to query. Determines which API endpoint is called. Defaults to 'insights'.
TYPE:
|
from_date
|
Start date (YYYY-MM-DD). Required for funnels, optional otherwise.
TYPE:
|
to_date
|
End date (YYYY-MM-DD). Required for funnels, optional otherwise.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
SavedReportResult
|
SavedReportResult with report data and report_type property. |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If API credentials not available. |
QueryError
|
If bookmark_id is invalid or report not found. |
Source code in src/mixpanel_data/workspace.py
query_saved_flows
¶
Query a saved Flows report.
Executes a saved Flows report by its bookmark ID, returning step data, breakdowns, and conversion rates.
| PARAMETER | DESCRIPTION |
|---|---|
bookmark_id
|
ID of saved flows report (from list_bookmarks or Mixpanel URL).
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
FlowsResult
|
FlowsResult with steps, breakdowns, and conversion rate. |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If API credentials not available. |
QueryError
|
If bookmark_id is invalid or report not found. |
Source code in src/mixpanel_data/workspace.py
frequency
¶
frequency(
*,
from_date: str,
to_date: str,
unit: Literal["day", "week", "month"] = "day",
addiction_unit: Literal["hour", "day"] = "hour",
event: str | None = None,
where: str | None = None,
) -> FrequencyResult
Analyze event frequency distribution.
| PARAMETER | DESCRIPTION |
|---|---|
from_date
|
Start date (YYYY-MM-DD).
TYPE:
|
to_date
|
End date (YYYY-MM-DD).
TYPE:
|
unit
|
Overall time unit.
TYPE:
|
addiction_unit
|
Measurement granularity.
TYPE:
|
event
|
Optional event filter.
TYPE:
|
where
|
Optional WHERE clause.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
FrequencyResult
|
FrequencyResult with frequency distribution. |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If API credentials not available. |
Source code in src/mixpanel_data/workspace.py
segmentation_numeric
¶
segmentation_numeric(
event: str,
*,
from_date: str,
to_date: str,
on: str,
unit: Literal["hour", "day"] = "day",
where: str | None = None,
type: Literal["general", "unique", "average"] = "general",
) -> NumericBucketResult
Bucket events by numeric property ranges.
| PARAMETER | DESCRIPTION |
|---|---|
event
|
Event name.
TYPE:
|
from_date
|
Start date.
TYPE:
|
to_date
|
End date.
TYPE:
|
on
|
Numeric property expression.
TYPE:
|
unit
|
Time unit.
TYPE:
|
where
|
Optional filter.
TYPE:
|
type
|
Counting method.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
NumericBucketResult
|
NumericBucketResult with bucketed data. |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If API credentials not available. |
Source code in src/mixpanel_data/workspace.py
segmentation_sum
¶
segmentation_sum(
event: str,
*,
from_date: str,
to_date: str,
on: str,
unit: Literal["hour", "day"] = "day",
where: str | None = None,
) -> NumericSumResult
Calculate sum of numeric property over time.
| PARAMETER | DESCRIPTION |
|---|---|
event
|
Event name.
TYPE:
|
from_date
|
Start date.
TYPE:
|
to_date
|
End date.
TYPE:
|
on
|
Numeric property expression.
TYPE:
|
unit
|
Time unit.
TYPE:
|
where
|
Optional filter.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
NumericSumResult
|
NumericSumResult with sum values per period. |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If API credentials not available. |
Source code in src/mixpanel_data/workspace.py
segmentation_average
¶
segmentation_average(
event: str,
*,
from_date: str,
to_date: str,
on: str,
unit: Literal["hour", "day"] = "day",
where: str | None = None,
) -> NumericAverageResult
Calculate average of numeric property over time.
| PARAMETER | DESCRIPTION |
|---|---|
event
|
Event name.
TYPE:
|
from_date
|
Start date.
TYPE:
|
to_date
|
End date.
TYPE:
|
on
|
Numeric property expression.
TYPE:
|
unit
|
Time unit.
TYPE:
|
where
|
Optional filter.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
NumericAverageResult
|
NumericAverageResult with average values per period. |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If API credentials not available. |
Source code in src/mixpanel_data/workspace.py
property_distribution
¶
property_distribution(
event: str, property: str, *, from_date: str, to_date: str, limit: int = 20
) -> PropertyDistributionResult
Get distribution of values for a property.
Uses JQL to count occurrences of each property value, returning counts and percentages sorted by frequency.
| PARAMETER | DESCRIPTION |
|---|---|
event
|
Event name to analyze.
TYPE:
|
property
|
Property name to get distribution for.
TYPE:
|
from_date
|
Start date (YYYY-MM-DD).
TYPE:
|
to_date
|
End date (YYYY-MM-DD).
TYPE:
|
limit
|
Maximum number of values to return. Default: 20.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
PropertyDistributionResult
|
PropertyDistributionResult with value counts and percentages. |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If API credentials not available. |
QueryError
|
Script execution error. |
Example
Source code in src/mixpanel_data/workspace.py
numeric_summary
¶
numeric_summary(
event: str,
property: str,
*,
from_date: str,
to_date: str,
percentiles: list[int] | None = None,
) -> NumericPropertySummaryResult
Get statistical summary for a numeric property.
Uses JQL to compute count, min, max, avg, stddev, and percentiles for a numeric property.
| PARAMETER | DESCRIPTION |
|---|---|
event
|
Event name to analyze.
TYPE:
|
property
|
Numeric property name.
TYPE:
|
from_date
|
Start date (YYYY-MM-DD).
TYPE:
|
to_date
|
End date (YYYY-MM-DD).
TYPE:
|
percentiles
|
Percentiles to compute. Default: [25, 50, 75, 90, 95, 99].
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
NumericPropertySummaryResult
|
NumericPropertySummaryResult with statistics. |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If API credentials not available. |
QueryError
|
Script execution error or non-numeric property. |
Example
Source code in src/mixpanel_data/workspace.py
daily_counts
¶
daily_counts(
*, from_date: str, to_date: str, events: list[str] | None = None
) -> DailyCountsResult
Get daily event counts.
Uses JQL to count events by day, optionally filtered to specific events.
| PARAMETER | DESCRIPTION |
|---|---|
from_date
|
Start date (YYYY-MM-DD).
TYPE:
|
to_date
|
End date (YYYY-MM-DD).
TYPE:
|
events
|
Optional list of events to count. None = all events.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
DailyCountsResult
|
DailyCountsResult with date/event/count tuples. |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If API credentials not available. |
QueryError
|
Script execution error. |
Example
Source code in src/mixpanel_data/workspace.py
engagement_distribution
¶
engagement_distribution(
*,
from_date: str,
to_date: str,
events: list[str] | None = None,
buckets: list[int] | None = None,
) -> EngagementDistributionResult
Get user engagement distribution.
Uses JQL to bucket users by their event count, showing how many users performed N events.
| PARAMETER | DESCRIPTION |
|---|---|
from_date
|
Start date (YYYY-MM-DD).
TYPE:
|
to_date
|
End date (YYYY-MM-DD).
TYPE:
|
events
|
Optional list of events to count. None = all events.
TYPE:
|
buckets
|
Bucket boundaries. Default: [1, 2, 5, 10, 25, 50, 100].
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
EngagementDistributionResult
|
EngagementDistributionResult with user counts per bucket. |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If API credentials not available. |
QueryError
|
Script execution error. |
Example
Source code in src/mixpanel_data/workspace.py
property_coverage
¶
property_coverage(
event: str, properties: list[str], *, from_date: str, to_date: str
) -> PropertyCoverageResult
Get property coverage statistics.
Uses JQL to count how often each property is defined (non-null) vs undefined for the specified event.
| PARAMETER | DESCRIPTION |
|---|---|
event
|
Event name to analyze.
TYPE:
|
properties
|
List of property names to check.
TYPE:
|
from_date
|
Start date (YYYY-MM-DD).
TYPE:
|
to_date
|
End date (YYYY-MM-DD).
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
PropertyCoverageResult
|
PropertyCoverageResult with coverage statistics per property. |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If API credentials not available. |
QueryError
|
Script execution error. |
Example
Source code in src/mixpanel_data/workspace.py
list_dashboards
¶
List dashboards for the current project/workspace.
Retrieves all dashboards visible to the authenticated user, optionally filtered by specific IDs.
| PARAMETER | DESCRIPTION |
|---|---|
ids
|
Optional list of dashboard IDs to filter by.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[Dashboard]
|
List of |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
API error (400, 404). |
ServerError
|
Server-side errors (5xx). |
Example
Source code in src/mixpanel_data/workspace.py
create_dashboard
¶
Create a new dashboard.
| PARAMETER | DESCRIPTION |
|---|---|
params
|
Dashboard creation parameters.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Dashboard
|
The newly created |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Invalid parameters (400, 422). |
ServerError
|
Server-side errors (5xx). |
Example
Source code in src/mixpanel_data/workspace.py
get_dashboard
¶
Get a single dashboard by ID.
| PARAMETER | DESCRIPTION |
|---|---|
dashboard_id
|
Dashboard identifier.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Dashboard
|
The |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Dashboard not found (404). |
ServerError
|
Server-side errors (5xx). |
Source code in src/mixpanel_data/workspace.py
update_dashboard
¶
Update an existing dashboard.
| PARAMETER | DESCRIPTION |
|---|---|
dashboard_id
|
Dashboard identifier.
TYPE:
|
params
|
Fields to update.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Dashboard
|
The updated |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Dashboard not found or invalid params (400, 404). |
ServerError
|
Server-side errors (5xx). |
Example
Source code in src/mixpanel_data/workspace.py
delete_dashboard
¶
Delete a dashboard.
| PARAMETER | DESCRIPTION |
|---|---|
dashboard_id
|
Dashboard identifier.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Dashboard not found (404). |
ServerError
|
Server-side errors (5xx). |
Source code in src/mixpanel_data/workspace.py
bulk_delete_dashboards
¶
Delete multiple dashboards.
| PARAMETER | DESCRIPTION |
|---|---|
ids
|
List of dashboard IDs to delete.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
One or more IDs not found (400, 404). |
ServerError
|
Server-side errors (5xx). |
Source code in src/mixpanel_data/workspace.py
favorite_dashboard
¶
Favorite a dashboard.
| PARAMETER | DESCRIPTION |
|---|---|
dashboard_id
|
Dashboard identifier.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Dashboard not found (404). |
ServerError
|
Server-side errors (5xx). |
Source code in src/mixpanel_data/workspace.py
unfavorite_dashboard
¶
Unfavorite a dashboard.
| PARAMETER | DESCRIPTION |
|---|---|
dashboard_id
|
Dashboard identifier.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Dashboard not found (404). |
ServerError
|
Server-side errors (5xx). |
Source code in src/mixpanel_data/workspace.py
pin_dashboard
¶
Pin a dashboard.
| PARAMETER | DESCRIPTION |
|---|---|
dashboard_id
|
Dashboard identifier.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Dashboard not found (404). |
ServerError
|
Server-side errors (5xx). |
Source code in src/mixpanel_data/workspace.py
unpin_dashboard
¶
Unpin a dashboard.
| PARAMETER | DESCRIPTION |
|---|---|
dashboard_id
|
Dashboard identifier.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Dashboard not found (404). |
ServerError
|
Server-side errors (5xx). |
Source code in src/mixpanel_data/workspace.py
add_report_to_dashboard
¶
Add a report to a dashboard.
Clones the specified bookmark onto the dashboard. The cloned report appears as a new card in the dashboard layout.
| PARAMETER | DESCRIPTION |
|---|---|
dashboard_id
|
Dashboard identifier.
TYPE:
|
bookmark_id
|
Bookmark/report identifier to add.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Dashboard
|
The updated |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Dashboard or bookmark not found (404). |
ServerError
|
Server-side errors (5xx). |
MixpanelDataError
|
If the API response is not a valid dashboard dict. |
Source code in src/mixpanel_data/workspace.py
remove_report_from_dashboard
¶
Remove a report from a dashboard.
| PARAMETER | DESCRIPTION |
|---|---|
dashboard_id
|
Dashboard identifier.
TYPE:
|
bookmark_id
|
Bookmark/report identifier to remove.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Dashboard
|
The updated |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Dashboard or bookmark not found (404). |
ServerError
|
Server-side errors (5xx). |
Source code in src/mixpanel_data/workspace.py
list_blueprint_templates
¶
List available dashboard blueprint templates.
| PARAMETER | DESCRIPTION |
|---|---|
include_reports
|
Whether to include report details.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[BlueprintTemplate]
|
List of |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
ServerError
|
Server-side errors (5xx). |
Source code in src/mixpanel_data/workspace.py
create_blueprint
¶
Create a dashboard from a blueprint template.
| PARAMETER | DESCRIPTION |
|---|---|
template_type
|
Blueprint template type identifier.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Dashboard
|
The newly created |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Invalid template type (400). |
ServerError
|
Server-side errors (5xx). |
Source code in src/mixpanel_data/workspace.py
get_blueprint_config
¶
Get the blueprint configuration for a dashboard.
| PARAMETER | DESCRIPTION |
|---|---|
dashboard_id
|
Dashboard identifier.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
BlueprintConfig
|
|
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Dashboard not found (404). |
ServerError
|
Server-side errors (5xx). |
Source code in src/mixpanel_data/workspace.py
update_blueprint_cohorts
¶
Update cohorts for blueprint configuration.
| PARAMETER | DESCRIPTION |
|---|---|
cohorts
|
List of cohort configuration dicts.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Invalid cohort configuration (400). |
ServerError
|
Server-side errors (5xx). |
Source code in src/mixpanel_data/workspace.py
finalize_blueprint
¶
Finalize a blueprint dashboard with cards.
| PARAMETER | DESCRIPTION |
|---|---|
params
|
Blueprint finalization parameters.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Dashboard
|
The finalized |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Invalid parameters (400). |
ServerError
|
Server-side errors (5xx). |
Example
Source code in src/mixpanel_data/workspace.py
create_rca_dashboard
¶
Create an RCA (Root Cause Analysis) dashboard.
| PARAMETER | DESCRIPTION |
|---|---|
params
|
RCA dashboard parameters.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Dashboard
|
The newly created |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Invalid parameters (400). |
ServerError
|
Server-side errors (5xx). |
Example
Source code in src/mixpanel_data/workspace.py
get_bookmark_dashboard_ids
¶
Get dashboard IDs containing a bookmark/report.
| PARAMETER | DESCRIPTION |
|---|---|
bookmark_id
|
Bookmark identifier.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[int]
|
List of dashboard IDs. |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Bookmark not found (404). |
ServerError
|
Server-side errors (5xx). |
Source code in src/mixpanel_data/workspace.py
get_dashboard_erf
¶
Get ERF data for a dashboard.
| PARAMETER | DESCRIPTION |
|---|---|
dashboard_id
|
Dashboard identifier.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
dict[str, Any]
|
Dict with ERF metrics data. |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Dashboard not found (404). |
ServerError
|
Server-side errors (5xx). |
Source code in src/mixpanel_data/workspace.py
update_report_link
¶
update_report_link(
dashboard_id: int, report_link_id: int, params: UpdateReportLinkParams
) -> None
Update a report link on a dashboard.
| PARAMETER | DESCRIPTION |
|---|---|
dashboard_id
|
Dashboard identifier.
TYPE:
|
report_link_id
|
Report link identifier.
TYPE:
|
params
|
Update parameters.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Dashboard or link not found (404). |
ServerError
|
Server-side errors (5xx). |
Example
Source code in src/mixpanel_data/workspace.py
update_text_card
¶
Update a text card on a dashboard.
| PARAMETER | DESCRIPTION |
|---|---|
dashboard_id
|
Dashboard identifier.
TYPE:
|
text_card_id
|
Text card identifier.
TYPE:
|
params
|
Update parameters.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Dashboard or text card not found (404). |
ServerError
|
Server-side errors (5xx). |
Source code in src/mixpanel_data/workspace.py
list_bookmarks_v2
¶
list_bookmarks_v2(
*, bookmark_type: BookmarkType | None = None, ids: list[int] | None = None
) -> list[Bookmark]
List bookmarks/reports via the App API v2 endpoint.
| PARAMETER | DESCRIPTION |
|---|---|
bookmark_type
|
Optional report type filter (e.g.,
TYPE:
|
ids
|
Optional list of bookmark IDs to filter by.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[Bookmark]
|
List of |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
API error (400, 404). |
ServerError
|
Server-side errors (5xx). |
Example
Source code in src/mixpanel_data/workspace.py
create_bookmark
¶
Create a new bookmark (saved report).
| PARAMETER | DESCRIPTION |
|---|---|
params
|
Bookmark creation parameters.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Bookmark
|
The newly created |
| RAISES | DESCRIPTION |
|---|---|
MixpanelDataError
|
If |
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Invalid parameters (400, 422). |
ServerError
|
Server-side errors (5xx). |
Example
Source code in src/mixpanel_data/workspace.py
get_bookmark
¶
Get a single bookmark by ID.
| PARAMETER | DESCRIPTION |
|---|---|
bookmark_id
|
Bookmark identifier.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Bookmark
|
The |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Bookmark not found (404). |
ServerError
|
Server-side errors (5xx). |
Source code in src/mixpanel_data/workspace.py
update_bookmark
¶
Update an existing bookmark.
| PARAMETER | DESCRIPTION |
|---|---|
bookmark_id
|
Bookmark identifier.
TYPE:
|
params
|
Fields to update.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Bookmark
|
The updated |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Bookmark not found or invalid params (400, 404). |
ServerError
|
Server-side errors (5xx). |
Example
Source code in src/mixpanel_data/workspace.py
delete_bookmark
¶
Delete a bookmark.
| PARAMETER | DESCRIPTION |
|---|---|
bookmark_id
|
Bookmark identifier.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Bookmark not found (404). |
ServerError
|
Server-side errors (5xx). |
Source code in src/mixpanel_data/workspace.py
bulk_delete_bookmarks
¶
Delete multiple bookmarks.
| PARAMETER | DESCRIPTION |
|---|---|
ids
|
List of bookmark IDs to delete.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
One or more IDs not found (400, 404). |
ServerError
|
Server-side errors (5xx). |
Source code in src/mixpanel_data/workspace.py
bulk_update_bookmarks
¶
Update multiple bookmarks.
| PARAMETER | DESCRIPTION |
|---|---|
entries
|
List of bookmark update entries.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Invalid entries or IDs not found (400, 404). |
ServerError
|
Server-side errors (5xx). |
Example
Source code in src/mixpanel_data/workspace.py
bookmark_linked_dashboard_ids
¶
Get dashboard IDs linked to a bookmark.
| PARAMETER | DESCRIPTION |
|---|---|
bookmark_id
|
Bookmark identifier.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[int]
|
List of dashboard IDs. |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Bookmark not found (404). |
ServerError
|
Server-side errors (5xx). |
Source code in src/mixpanel_data/workspace.py
get_bookmark_history
¶
get_bookmark_history(
bookmark_id: int, *, cursor: str | None = None, page_size: int | None = None
) -> BookmarkHistoryResponse
Get the change history for a bookmark.
| PARAMETER | DESCRIPTION |
|---|---|
bookmark_id
|
Bookmark identifier.
TYPE:
|
cursor
|
Opaque pagination cursor.
TYPE:
|
page_size
|
Maximum entries per page.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
BookmarkHistoryResponse
|
|
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Bookmark not found (404). |
ServerError
|
Server-side errors (5xx). |
Source code in src/mixpanel_data/workspace.py
list_cohorts_full
¶
list_cohorts_full(
*, data_group_id: str | None = None, ids: list[int] | None = None
) -> list[Cohort]
List cohorts via the App API (full detail).
Unlike cohorts() which uses the discovery endpoint, this method
uses the App API and returns full Cohort objects with all metadata.
| PARAMETER | DESCRIPTION |
|---|---|
data_group_id
|
Optional data group filter.
TYPE:
|
ids
|
Optional list of cohort IDs to filter by.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[Cohort]
|
List of |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
API error (400, 404). |
ServerError
|
Server-side errors (5xx). |
Example
Source code in src/mixpanel_data/workspace.py
get_cohort
¶
Get a single cohort by ID via the App API.
| PARAMETER | DESCRIPTION |
|---|---|
cohort_id
|
Cohort identifier.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Cohort
|
The |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Cohort not found (404). |
ServerError
|
Server-side errors (5xx). |
Source code in src/mixpanel_data/workspace.py
create_cohort
¶
Create a new cohort.
| PARAMETER | DESCRIPTION |
|---|---|
params
|
Cohort creation parameters.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Cohort
|
The newly created |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Invalid parameters (400). |
ServerError
|
Server-side errors (5xx). |
Source code in src/mixpanel_data/workspace.py
update_cohort
¶
Update an existing cohort.
| PARAMETER | DESCRIPTION |
|---|---|
cohort_id
|
Cohort identifier.
TYPE:
|
params
|
Fields to update.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Cohort
|
The updated |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Cohort not found or invalid params (400, 404). |
ServerError
|
Server-side errors (5xx). |
Source code in src/mixpanel_data/workspace.py
delete_cohort
¶
Delete a cohort.
| PARAMETER | DESCRIPTION |
|---|---|
cohort_id
|
Cohort identifier.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Cohort not found (404). |
ServerError
|
Server-side errors (5xx). |
Source code in src/mixpanel_data/workspace.py
bulk_delete_cohorts
¶
Delete multiple cohorts.
| PARAMETER | DESCRIPTION |
|---|---|
ids
|
List of cohort IDs to delete.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
One or more IDs not found (400, 404). |
ServerError
|
Server-side errors (5xx). |
Source code in src/mixpanel_data/workspace.py
bulk_update_cohorts
¶
Update multiple cohorts.
| PARAMETER | DESCRIPTION |
|---|---|
entries
|
List of cohort update entries.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Invalid entries or IDs not found (400, 404). |
ServerError
|
Server-side errors (5xx). |
Source code in src/mixpanel_data/workspace.py
list_feature_flags
¶
List feature flags for the current project/workspace.
| PARAMETER | DESCRIPTION |
|---|---|
include_archived
|
When True, include archived flags.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[FeatureFlag]
|
List of |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
API error (400, 404). |
ServerError
|
Server-side errors (5xx). |
Example
Source code in src/mixpanel_data/workspace.py
create_feature_flag
¶
Create a new feature flag.
| PARAMETER | DESCRIPTION |
|---|---|
params
|
Flag creation parameters.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
FeatureFlag
|
The newly created |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Duplicate key or invalid parameters (400). |
ServerError
|
Server-side errors (5xx). |
Example
Source code in src/mixpanel_data/workspace.py
get_feature_flag
¶
Get a single feature flag by ID.
| PARAMETER | DESCRIPTION |
|---|---|
flag_id
|
Feature flag UUID.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
FeatureFlag
|
The |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Flag not found (404). |
ServerError
|
Server-side errors (5xx). |
Source code in src/mixpanel_data/workspace.py
update_feature_flag
¶
Update a feature flag (full replacement, PUT semantics).
| PARAMETER | DESCRIPTION |
|---|---|
flag_id
|
Feature flag UUID.
TYPE:
|
params
|
Complete flag configuration.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
FeatureFlag
|
The updated |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Flag not found or invalid params (400, 404). |
ServerError
|
Server-side errors (5xx). |
Example
Source code in src/mixpanel_data/workspace.py
delete_feature_flag
¶
Delete a feature flag.
| PARAMETER | DESCRIPTION |
|---|---|
flag_id
|
Feature flag UUID.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Flag not found (404). |
ServerError
|
Server-side errors (5xx). |
Source code in src/mixpanel_data/workspace.py
archive_feature_flag
¶
Archive a feature flag (soft-delete).
| PARAMETER | DESCRIPTION |
|---|---|
flag_id
|
Feature flag UUID.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Flag not found (404). |
ServerError
|
Server-side errors (5xx). |
Source code in src/mixpanel_data/workspace.py
restore_feature_flag
¶
Restore an archived feature flag.
| PARAMETER | DESCRIPTION |
|---|---|
flag_id
|
Feature flag UUID.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
FeatureFlag
|
The restored |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Flag not found (404). |
ServerError
|
Server-side errors (5xx). |
Source code in src/mixpanel_data/workspace.py
duplicate_feature_flag
¶
Duplicate a feature flag.
| PARAMETER | DESCRIPTION |
|---|---|
flag_id
|
Feature flag UUID.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
FeatureFlag
|
The newly created duplicate |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Flag not found (404). |
ServerError
|
Server-side errors (5xx). |
Source code in src/mixpanel_data/workspace.py
set_flag_test_users
¶
Set test user variant overrides for a feature flag.
| PARAMETER | DESCRIPTION |
|---|---|
flag_id
|
Feature flag UUID.
TYPE:
|
params
|
Test user mapping.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Flag not found (404) or invalid payload (400). |
ServerError
|
Server-side errors (5xx). |
Example
Source code in src/mixpanel_data/workspace.py
get_flag_history
¶
get_flag_history(
flag_id: str, *, page: str | None = None, page_size: int | None = None
) -> FlagHistoryResponse
Get paginated change history for a feature flag.
| PARAMETER | DESCRIPTION |
|---|---|
flag_id
|
Feature flag UUID.
TYPE:
|
page
|
Pagination cursor.
TYPE:
|
page_size
|
Results per page.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
FlagHistoryResponse
|
|
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Flag not found (404). |
ServerError
|
Server-side errors (5xx). |
Source code in src/mixpanel_data/workspace.py
get_flag_limits
¶
Get account-level feature flag limits and usage.
| RETURNS | DESCRIPTION |
|---|---|
FlagLimitsResponse
|
|
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
API error (400). |
ServerError
|
Server-side errors (5xx). |
Example
Source code in src/mixpanel_data/workspace.py
list_experiments
¶
List experiments for the current project.
| PARAMETER | DESCRIPTION |
|---|---|
include_archived
|
When True, include archived experiments.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[Experiment]
|
List of |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
API error (400, 404). |
ServerError
|
Server-side errors (5xx). |
Example
Source code in src/mixpanel_data/workspace.py
create_experiment
¶
Create a new experiment in Draft status.
| PARAMETER | DESCRIPTION |
|---|---|
params
|
Experiment creation parameters.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Experiment
|
The newly created |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Invalid parameters (400). |
ServerError
|
Server-side errors (5xx). |
Example
Source code in src/mixpanel_data/workspace.py
get_experiment
¶
Get a single experiment by ID.
| PARAMETER | DESCRIPTION |
|---|---|
experiment_id
|
Experiment UUID.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Experiment
|
The |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Experiment not found (404). |
ServerError
|
Server-side errors (5xx). |
Source code in src/mixpanel_data/workspace.py
update_experiment
¶
Update an experiment (PATCH semantics).
| PARAMETER | DESCRIPTION |
|---|---|
experiment_id
|
Experiment UUID.
TYPE:
|
params
|
Fields to update.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Experiment
|
The updated |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Experiment not found or invalid params (400, 404). |
ServerError
|
Server-side errors (5xx). |
Example
Source code in src/mixpanel_data/workspace.py
delete_experiment
¶
Delete an experiment.
| PARAMETER | DESCRIPTION |
|---|---|
experiment_id
|
Experiment UUID.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Experiment not found (404). |
ServerError
|
Server-side errors (5xx). |
Source code in src/mixpanel_data/workspace.py
launch_experiment
¶
Launch an experiment (Draft → Active).
| PARAMETER | DESCRIPTION |
|---|---|
experiment_id
|
Experiment UUID.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Experiment
|
The launched |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Invalid state transition (400) or not found (404). |
ServerError
|
Server-side errors (5xx). |
Source code in src/mixpanel_data/workspace.py
conclude_experiment
¶
conclude_experiment(
experiment_id: str, *, params: ExperimentConcludeParams | None = None
) -> Experiment
Conclude an experiment (Active → Concluded).
Always sends a JSON body (empty {} if no params).
| PARAMETER | DESCRIPTION |
|---|---|
experiment_id
|
Experiment UUID.
TYPE:
|
params
|
Optional conclude parameters (e.g. end date override).
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Experiment
|
The concluded |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Invalid state transition (400) or not found (404). |
ServerError
|
Server-side errors (5xx). |
Source code in src/mixpanel_data/workspace.py
decide_experiment
¶
Record the experiment decision (Concluded → Success/Fail).
| PARAMETER | DESCRIPTION |
|---|---|
experiment_id
|
Experiment UUID.
TYPE:
|
params
|
Decision parameters (success, variant, message).
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Experiment
|
The decided |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Invalid state transition (400) or not found (404). |
ServerError
|
Server-side errors (5xx). |
Example
Source code in src/mixpanel_data/workspace.py
archive_experiment
¶
Archive an experiment.
| PARAMETER | DESCRIPTION |
|---|---|
experiment_id
|
Experiment UUID.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Experiment not found (404). |
ServerError
|
Server-side errors (5xx). |
Source code in src/mixpanel_data/workspace.py
restore_experiment
¶
Restore an archived experiment.
| PARAMETER | DESCRIPTION |
|---|---|
experiment_id
|
Experiment UUID.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Experiment
|
The restored |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Experiment not found (404). |
ServerError
|
Server-side errors (5xx). |
Source code in src/mixpanel_data/workspace.py
duplicate_experiment
¶
Duplicate an experiment.
A name is required because the Mixpanel API returns an empty response body when duplicating without one.
| PARAMETER | DESCRIPTION |
|---|---|
experiment_id
|
Experiment UUID.
TYPE:
|
params
|
Duplication parameters ( |
| RETURNS | DESCRIPTION |
|---|---|
Experiment
|
The newly created duplicate |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Experiment not found (404). |
ServerError
|
Server-side errors (5xx). |
Example
Source code in src/mixpanel_data/workspace.py
list_erf_experiments
¶
List experiments in ERF (Experiment Results Framework) format.
| RETURNS | DESCRIPTION |
|---|---|
list[dict[str, Any]]
|
List of experiment dicts in ERF format. |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
API error (400). |
ServerError
|
Server-side errors (5xx). |
Source code in src/mixpanel_data/workspace.py
list_alerts
¶
list_alerts(
*, bookmark_id: int | None = None, skip_user_filter: bool | None = None
) -> list[CustomAlert]
List custom alerts for the current project.
| PARAMETER | DESCRIPTION |
|---|---|
bookmark_id
|
Filter alerts by linked bookmark ID.
TYPE:
|
skip_user_filter
|
If True, list alerts for all users.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[CustomAlert]
|
List of |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
API error (400). |
ServerError
|
Server-side errors (5xx). |
Example
Source code in src/mixpanel_data/workspace.py
create_alert
¶
Create a new custom alert.
| PARAMETER | DESCRIPTION |
|---|---|
params
|
Alert creation parameters (bookmark_id, name, condition, frequency, paused, and subscriptions are required).
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
CustomAlert
|
The created |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Validation error (400). |
ServerError
|
Server-side errors (5xx). |
Example
Source code in src/mixpanel_data/workspace.py
get_alert
¶
Get a single custom alert by ID.
| PARAMETER | DESCRIPTION |
|---|---|
alert_id
|
Alert ID (integer).
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
CustomAlert
|
The |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Alert not found (404). |
ServerError
|
Server-side errors (5xx). |
Source code in src/mixpanel_data/workspace.py
update_alert
¶
Update a custom alert (PATCH semantics).
| PARAMETER | DESCRIPTION |
|---|---|
alert_id
|
Alert ID (integer).
TYPE:
|
params
|
Fields to update.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
CustomAlert
|
The updated |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Alert not found (404) or validation error (400). |
ServerError
|
Server-side errors (5xx). |
Source code in src/mixpanel_data/workspace.py
delete_alert
¶
Delete a custom alert.
| PARAMETER | DESCRIPTION |
|---|---|
alert_id
|
Alert ID (integer).
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Alert not found (404). |
ServerError
|
Server-side errors (5xx). |
Source code in src/mixpanel_data/workspace.py
bulk_delete_alerts
¶
Bulk-delete custom alerts.
| PARAMETER | DESCRIPTION |
|---|---|
ids
|
List of alert IDs to delete.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Validation error (400). |
ServerError
|
Server-side errors (5xx). |
Source code in src/mixpanel_data/workspace.py
get_alert_count
¶
Get alert count and limits.
| PARAMETER | DESCRIPTION |
|---|---|
alert_type
|
Optional filter by alert type.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
AlertCount
|
|
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
API error (400). |
ServerError
|
Server-side errors (5xx). |
Example
Source code in src/mixpanel_data/workspace.py
get_alert_history
¶
get_alert_history(
alert_id: int,
*,
page_size: int | None = None,
next_cursor: str | None = None,
previous_cursor: str | None = None,
) -> AlertHistoryResponse
Get alert trigger history (paginated).
| PARAMETER | DESCRIPTION |
|---|---|
alert_id
|
Alert ID (integer).
TYPE:
|
page_size
|
Number of results per page.
TYPE:
|
next_cursor
|
Cursor for the next page.
TYPE:
|
previous_cursor
|
Cursor for the previous page.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
AlertHistoryResponse
|
|
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Alert not found (404). |
ServerError
|
Server-side errors (5xx). |
Example
Source code in src/mixpanel_data/workspace.py
test_alert
¶
Send a test alert notification.
| PARAMETER | DESCRIPTION |
|---|---|
params
|
Alert parameters for the test (same shape as create).
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
dict[str, Any]
|
Dictionary with test result status (opaque response). |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Validation error (400). |
ServerError
|
Server-side errors (5xx). |
Example
Source code in src/mixpanel_data/workspace.py
get_alert_screenshot_url
¶
Get a signed URL for an alert screenshot.
| PARAMETER | DESCRIPTION |
|---|---|
gcs_key
|
GCS object key for the screenshot.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
AlertScreenshotResponse
|
|
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Screenshot not found (404). |
ServerError
|
Server-side errors (5xx). |
Example
Source code in src/mixpanel_data/workspace.py
validate_alerts_for_bookmark
¶
validate_alerts_for_bookmark(
params: ValidateAlertsForBookmarkParams,
) -> ValidateAlertsForBookmarkResponse
Validate alerts against a bookmark configuration.
| PARAMETER | DESCRIPTION |
|---|---|
params
|
Validation parameters (alert_ids, bookmark_type, bookmark_params are required). |
| RETURNS | DESCRIPTION |
|---|---|
ValidateAlertsForBookmarkResponse
|
|
ValidateAlertsForBookmarkResponse
|
and invalid count. |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Validation error (400). |
ServerError
|
Server-side errors (5xx). |
Example
Source code in src/mixpanel_data/workspace.py
list_annotations
¶
list_annotations(
*,
from_date: str | None = None,
to_date: str | None = None,
tags: list[int] | None = None,
) -> list[Annotation]
List timeline annotations for the project.
| PARAMETER | DESCRIPTION |
|---|---|
from_date
|
Start date filter (ISO format, e.g.
TYPE:
|
to_date
|
End date filter (ISO format, e.g.
TYPE:
|
tags
|
Tag IDs to filter by.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[Annotation]
|
List of |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
API error (400). |
ServerError
|
Server-side errors (5xx). |
Example
Source code in src/mixpanel_data/workspace.py
create_annotation
¶
Create a new timeline annotation.
| PARAMETER | DESCRIPTION |
|---|---|
params
|
Annotation creation parameters (date, description required).
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Annotation
|
The created |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Validation error (400). |
ServerError
|
Server-side errors (5xx). |
Example
Source code in src/mixpanel_data/workspace.py
get_annotation
¶
Get a single annotation by ID.
| PARAMETER | DESCRIPTION |
|---|---|
annotation_id
|
Annotation ID.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Annotation
|
The |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Annotation not found (404). |
ServerError
|
Server-side errors (5xx). |
Source code in src/mixpanel_data/workspace.py
update_annotation
¶
Update an annotation (PATCH semantics).
| PARAMETER | DESCRIPTION |
|---|---|
annotation_id
|
Annotation ID.
TYPE:
|
params
|
Fields to update (description, tags).
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Annotation
|
The updated |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Annotation not found (404) or validation error (400). |
ServerError
|
Server-side errors (5xx). |
Example
Source code in src/mixpanel_data/workspace.py
delete_annotation
¶
Delete an annotation.
| PARAMETER | DESCRIPTION |
|---|---|
annotation_id
|
Annotation ID.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Annotation not found (404). |
ServerError
|
Server-side errors (5xx). |
Source code in src/mixpanel_data/workspace.py
list_annotation_tags
¶
List annotation tags for the project.
| RETURNS | DESCRIPTION |
|---|---|
list[AnnotationTag]
|
List of |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
API error (400). |
ServerError
|
Server-side errors (5xx). |
Source code in src/mixpanel_data/workspace.py
create_annotation_tag
¶
Create a new annotation tag.
| PARAMETER | DESCRIPTION |
|---|---|
params
|
Tag creation parameters (name required). |
| RETURNS | DESCRIPTION |
|---|---|
AnnotationTag
|
The created |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Validation error (400). |
ServerError
|
Server-side errors (5xx). |
Example
Source code in src/mixpanel_data/workspace.py
list_webhooks
¶
List all webhooks for the current project.
| RETURNS | DESCRIPTION |
|---|---|
list[ProjectWebhook]
|
List of |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
API error (400). |
ServerError
|
Server-side errors (5xx). |
Example
Source code in src/mixpanel_data/workspace.py
create_webhook
¶
Create a new webhook.
| PARAMETER | DESCRIPTION |
|---|---|
params
|
Webhook creation parameters.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
WebhookMutationResult
|
|
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
API error (400). |
ServerError
|
Server-side errors (5xx). |
Example
Source code in src/mixpanel_data/workspace.py
update_webhook
¶
Update an existing webhook.
| PARAMETER | DESCRIPTION |
|---|---|
webhook_id
|
Webhook UUID string.
TYPE:
|
params
|
Fields to update (PATCH semantics).
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
WebhookMutationResult
|
|
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Webhook not found (404). |
ServerError
|
Server-side errors (5xx). |
Example
Source code in src/mixpanel_data/workspace.py
delete_webhook
¶
Delete a webhook.
| PARAMETER | DESCRIPTION |
|---|---|
webhook_id
|
Webhook UUID string.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Webhook not found (404). |
ServerError
|
Server-side errors (5xx). |
Source code in src/mixpanel_data/workspace.py
test_webhook
¶
Test webhook connectivity.
| PARAMETER | DESCRIPTION |
|---|---|
params
|
Webhook test parameters (url is required).
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
WebhookTestResult
|
|
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
API error (400). |
ServerError
|
Server-side errors (5xx). |
Example
Source code in src/mixpanel_data/workspace.py
get_event_definitions
¶
Get event definitions from Lexicon by name.
Retrieves metadata (description, tags, visibility, etc.) for the specified events from the Mixpanel Lexicon.
| PARAMETER | DESCRIPTION |
|---|---|
names
|
List of event names to look up.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[EventDefinition]
|
List of |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Validation error (400). |
ServerError
|
Server-side errors (5xx). |
Example
Source code in src/mixpanel_data/workspace.py
update_event_definition
¶
Update an event definition in Lexicon.
| PARAMETER | DESCRIPTION |
|---|---|
event_name
|
Name of the event to update.
TYPE:
|
params
|
Fields to update (hidden, dropped, merged, verified, tags, description). |
| RETURNS | DESCRIPTION |
|---|---|
EventDefinition
|
The updated |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Event not found (404) or validation error (400). |
ServerError
|
Server-side errors (5xx). |
Example
Source code in src/mixpanel_data/workspace.py
delete_event_definition
¶
Delete an event definition from Lexicon.
| PARAMETER | DESCRIPTION |
|---|---|
event_name
|
Name of the event to delete.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Event not found (404). |
ServerError
|
Server-side errors (5xx). |
Source code in src/mixpanel_data/workspace.py
bulk_update_event_definitions
¶
Bulk-update event definitions in Lexicon.
| PARAMETER | DESCRIPTION |
|---|---|
params
|
Bulk update parameters containing a list of event updates (name + fields to change).
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[EventDefinition]
|
List of updated |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Validation error (400). |
ServerError
|
Server-side errors (5xx). |
Example
Source code in src/mixpanel_data/workspace.py
get_property_definitions
¶
get_property_definitions(
*, names: list[str], resource_type: str | None = None
) -> list[PropertyDefinition]
Get property definitions from Lexicon by name.
Retrieves metadata (description, tags, visibility, etc.) for the specified properties from the Mixpanel Lexicon.
| PARAMETER | DESCRIPTION |
|---|---|
names
|
List of property names to look up.
TYPE:
|
resource_type
|
Optional resource type filter (e.g.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[PropertyDefinition]
|
List of |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Validation error (400). |
ServerError
|
Server-side errors (5xx). |
Example
Source code in src/mixpanel_data/workspace.py
update_property_definition
¶
update_property_definition(
property_name: str, params: UpdatePropertyDefinitionParams
) -> PropertyDefinition
Update a property definition in Lexicon.
| PARAMETER | DESCRIPTION |
|---|---|
property_name
|
Name of the property to update.
TYPE:
|
params
|
Fields to update (hidden, dropped, merged, sensitive, description). |
| RETURNS | DESCRIPTION |
|---|---|
PropertyDefinition
|
The updated |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Property not found (404) or validation error (400). |
ServerError
|
Server-side errors (5xx). |
Example
Source code in src/mixpanel_data/workspace.py
bulk_update_property_definitions
¶
Bulk-update property definitions in Lexicon.
| PARAMETER | DESCRIPTION |
|---|---|
params
|
Bulk update parameters containing a list of property updates (name + fields to change). |
| RETURNS | DESCRIPTION |
|---|---|
list[PropertyDefinition]
|
List of updated |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Validation error (400). |
ServerError
|
Server-side errors (5xx). |
Example
Source code in src/mixpanel_data/workspace.py
list_lexicon_tags
¶
List all Lexicon tags.
| RETURNS | DESCRIPTION |
|---|---|
list[LexiconTag]
|
List of |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
ServerError
|
Server-side errors (5xx). |
Note
The list endpoint may return plain tag name strings without IDs.
In that case, id is set to 0 as a sentinel value. Do not
pass this sentinel to update_lexicon_tag() — use name-based
operations (e.g. delete_lexicon_tag(tag.name)) for tags
obtained from this method.
Source code in src/mixpanel_data/workspace.py
create_lexicon_tag
¶
Create a new Lexicon tag.
| PARAMETER | DESCRIPTION |
|---|---|
params
|
Tag creation parameters (name is required).
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
LexiconTag
|
The created |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Validation error (400) or tag already exists. |
ServerError
|
Server-side errors (5xx). |
Source code in src/mixpanel_data/workspace.py
update_lexicon_tag
¶
Update a Lexicon tag.
| PARAMETER | DESCRIPTION |
|---|---|
tag_id
|
Tag ID (integer).
TYPE:
|
params
|
Fields to update (e.g. name).
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
LexiconTag
|
The updated |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Tag not found (404) or validation error (400). |
ServerError
|
Server-side errors (5xx). |
Source code in src/mixpanel_data/workspace.py
delete_lexicon_tag
¶
Delete a Lexicon tag by name.
| PARAMETER | DESCRIPTION |
|---|---|
tag_name
|
Name of the tag to delete.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Tag not found (404). |
ServerError
|
Server-side errors (5xx). |
Source code in src/mixpanel_data/workspace.py
get_tracking_metadata
¶
Get tracking metadata for an event.
Retrieves information about how an event is being tracked (sources, SDKs, volume, etc.).
| PARAMETER | DESCRIPTION |
|---|---|
event_name
|
Name of the event.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
dict[str, Any]
|
Raw tracking metadata dictionary. |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Event not found (404). |
ServerError
|
Server-side errors (5xx). |
Source code in src/mixpanel_data/workspace.py
get_event_history
¶
Get change history for an event definition.
| PARAMETER | DESCRIPTION |
|---|---|
event_name
|
Name of the event.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[dict[str, Any]]
|
List of history entries (raw dictionaries) showing changes |
list[dict[str, Any]]
|
to the event definition over time. |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Event not found (404). |
ServerError
|
Server-side errors (5xx). |
Example
Source code in src/mixpanel_data/workspace.py
get_property_history
¶
Get change history for a property definition.
| PARAMETER | DESCRIPTION |
|---|---|
property_name
|
Name of the property.
TYPE:
|
entity_type
|
Entity type (e.g.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[dict[str, Any]]
|
List of history entries (raw dictionaries) showing changes |
list[dict[str, Any]]
|
to the property definition over time. |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Property not found (404). |
ServerError
|
Server-side errors (5xx). |
Example
Source code in src/mixpanel_data/workspace.py
export_lexicon
¶
Export Lexicon data definitions.
Exports event and property definitions from Lexicon, optionally filtered by type.
| PARAMETER | DESCRIPTION |
|---|---|
export_types
|
Optional list of types to export (e.g.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
dict[str, Any]
|
Raw export dictionary containing the exported definitions. |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
ServerError
|
Server-side errors (5xx). |
Example
Source code in src/mixpanel_data/workspace.py
list_drop_filters
¶
List all drop filters.
| RETURNS | DESCRIPTION |
|---|---|
list[DropFilter]
|
List of |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
ServerError
|
Server-side errors (5xx). |
Example
Source code in src/mixpanel_data/workspace.py
create_drop_filter
¶
Create a new drop filter.
| PARAMETER | DESCRIPTION |
|---|---|
params
|
Drop filter creation parameters.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[DropFilter]
|
Full list of |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Validation error (400). |
ServerError
|
Server-side errors (5xx). |
Example
Source code in src/mixpanel_data/workspace.py
update_drop_filter
¶
Update a drop filter.
| PARAMETER | DESCRIPTION |
|---|---|
params
|
Drop filter update parameters (must include the filter ID).
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[DropFilter]
|
Full list of |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Filter not found (404) or validation error (400). |
ServerError
|
Server-side errors (5xx). |
Example
Source code in src/mixpanel_data/workspace.py
delete_drop_filter
¶
Delete a drop filter.
| PARAMETER | DESCRIPTION |
|---|---|
drop_filter_id
|
Drop filter ID (integer).
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[DropFilter]
|
Full list of remaining |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Filter not found (404). |
ServerError
|
Server-side errors (5xx). |
Source code in src/mixpanel_data/workspace.py
get_drop_filter_limits
¶
Get drop filter usage limits.
| RETURNS | DESCRIPTION |
|---|---|
DropFilterLimitsResponse
|
|
DropFilterLimitsResponse
|
drop filters for the project. |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
ServerError
|
Server-side errors (5xx). |
Example
Source code in src/mixpanel_data/workspace.py
list_custom_properties
¶
List all custom properties.
| RETURNS | DESCRIPTION |
|---|---|
list[CustomProperty]
|
List of |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Server-side data corruption (e.g. invalid
|
ServerError
|
Server-side errors (5xx). |
Example
Source code in src/mixpanel_data/workspace.py
create_custom_property
¶
Create a new custom property.
| PARAMETER | DESCRIPTION |
|---|---|
params
|
Custom property creation parameters (name, display_formula or behavior, resource_type are required). |
| RETURNS | DESCRIPTION |
|---|---|
CustomProperty
|
The created |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Validation error (400). |
ServerError
|
Server-side errors (5xx). |
Example
ws = Workspace()
prop = ws.create_custom_property(
CreateCustomPropertyParams(
name="Full Name",
display_formula='concat(properties["first"], " ", properties["last"])',
composed_properties={"first": ComposedPropertyValue(resource_type="event"), "last": ComposedPropertyValue(resource_type="event")},
resource_type="event",
)
)
Source code in src/mixpanel_data/workspace.py
get_custom_property
¶
Get a custom property by ID.
| PARAMETER | DESCRIPTION |
|---|---|
property_id
|
Custom property ID (string).
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
CustomProperty
|
The |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Property not found (404). |
ServerError
|
Server-side errors (5xx). |
Source code in src/mixpanel_data/workspace.py
update_custom_property
¶
Update a custom property.
| PARAMETER | DESCRIPTION |
|---|---|
property_id
|
Custom property ID (string).
TYPE:
|
params
|
Fields to update. |
| RETURNS | DESCRIPTION |
|---|---|
CustomProperty
|
The updated |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Property not found (404) or validation error (400). |
ServerError
|
Server-side errors (5xx). |
Example
Source code in src/mixpanel_data/workspace.py
delete_custom_property
¶
Delete a custom property.
| PARAMETER | DESCRIPTION |
|---|---|
property_id
|
Custom property ID (string).
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Property not found (404). |
ServerError
|
Server-side errors (5xx). |
Source code in src/mixpanel_data/workspace.py
validate_custom_property
¶
Validate a custom property definition without creating it.
| PARAMETER | DESCRIPTION |
|---|---|
params
|
Custom property parameters to validate. |
| RETURNS | DESCRIPTION |
|---|---|
dict[str, Any]
|
Validation result as a raw dictionary. |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Validation error (400). |
ServerError
|
Server-side errors (5xx). |
Example
ws = Workspace()
result = ws.validate_custom_property(
CreateCustomPropertyParams(
name="Full Name",
display_formula='concat(properties["first"], " ", properties["last"])',
composed_properties={"first": ComposedPropertyValue(resource_type="event"), "last": ComposedPropertyValue(resource_type="event")},
resource_type="event",
)
)
print(result)
Source code in src/mixpanel_data/workspace.py
list_lookup_tables
¶
List lookup tables.
| PARAMETER | DESCRIPTION |
|---|---|
data_group_id
|
Optional filter by data group ID.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[LookupTable]
|
List of |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
ServerError
|
Server-side errors (5xx). |
Example
Source code in src/mixpanel_data/workspace.py
upload_lookup_table
¶
upload_lookup_table(
params: UploadLookupTableParams,
*,
poll_interval: float = 2.0,
max_poll_seconds: float = 300.0,
) -> LookupTable
Upload a CSV file as a new lookup table.
Performs a 3-step upload process: 1. Obtains a signed upload URL from the API. 2. Uploads the CSV file to the signed URL. 3. Registers the lookup table with the uploaded data.
For files >= 5 MB, the API processes the upload asynchronously. This method automatically polls until processing completes.
| PARAMETER | DESCRIPTION |
|---|---|
params
|
Upload parameters including
TYPE:
|
poll_interval
|
Seconds between status polls for async uploads.
TYPE:
|
max_poll_seconds
|
Maximum seconds to wait for async processing.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
LookupTable
|
The created |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Validation error (400) or file not found. |
ServerError
|
Server-side errors (5xx). |
FileNotFoundError
|
If the CSV file does not exist. |
MixpanelDataError
|
Async processing timed out or failed. |
Example
Source code in src/mixpanel_data/workspace.py
7640 7641 7642 7643 7644 7645 7646 7647 7648 7649 7650 7651 7652 7653 7654 7655 7656 7657 7658 7659 7660 7661 7662 7663 7664 7665 7666 7667 7668 7669 7670 7671 7672 7673 7674 7675 7676 7677 7678 7679 7680 7681 7682 7683 7684 7685 7686 7687 7688 7689 7690 7691 7692 7693 7694 7695 7696 7697 7698 7699 7700 7701 7702 7703 7704 7705 7706 7707 7708 7709 7710 7711 7712 7713 7714 7715 7716 7717 7718 7719 7720 7721 7722 7723 7724 | |
mark_lookup_table_ready
¶
Mark a lookup table as ready after upload.
| PARAMETER | DESCRIPTION |
|---|---|
params
|
Parameters including |
| RETURNS | DESCRIPTION |
|---|---|
LookupTable
|
The updated |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Validation error (400). |
ServerError
|
Server-side errors (5xx). |
Example
Source code in src/mixpanel_data/workspace.py
get_lookup_upload_url
¶
Get a signed URL for uploading lookup table data.
| PARAMETER | DESCRIPTION |
|---|---|
content_type
|
MIME type of the file to upload
(default:
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
LookupTableUploadUrl
|
|
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
ServerError
|
Server-side errors (5xx). |
Source code in src/mixpanel_data/workspace.py
get_lookup_upload_status
¶
Get the processing status of a lookup table upload.
| PARAMETER | DESCRIPTION |
|---|---|
upload_id
|
Upload ID returned from the upload process.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
dict[str, Any]
|
Raw status dictionary with processing details. |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Upload not found (404). |
ServerError
|
Server-side errors (5xx). |
Example
Source code in src/mixpanel_data/workspace.py
update_lookup_table
¶
Update a lookup table.
| PARAMETER | DESCRIPTION |
|---|---|
data_group_id
|
Data group ID of the lookup table.
TYPE:
|
params
|
Fields to update.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
LookupTable
|
The updated |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Table not found (404) or validation error (400). |
ServerError
|
Server-side errors (5xx). |
Example
Source code in src/mixpanel_data/workspace.py
delete_lookup_tables
¶
Delete one or more lookup tables.
| PARAMETER | DESCRIPTION |
|---|---|
data_group_ids
|
List of data group IDs to delete.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Validation error (400). |
ServerError
|
Server-side errors (5xx). |
Source code in src/mixpanel_data/workspace.py
download_lookup_table
¶
download_lookup_table(
data_group_id: int,
*,
file_name: str | None = None,
limit: int | None = None,
) -> bytes
Download lookup table data as raw bytes (CSV).
| PARAMETER | DESCRIPTION |
|---|---|
data_group_id
|
Data group ID of the lookup table.
TYPE:
|
file_name
|
Optional file name filter.
TYPE:
|
limit
|
Optional row limit.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
bytes
|
Raw CSV bytes of the lookup table data. |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Table not found (404). |
ServerError
|
Server-side errors (5xx). |
Example
Source code in src/mixpanel_data/workspace.py
get_lookup_download_url
¶
Get a signed download URL for a lookup table.
| PARAMETER | DESCRIPTION |
|---|---|
data_group_id
|
Data group ID of the lookup table.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str
|
Signed URL string for downloading the lookup table data. |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Table not found (404). |
ServerError
|
Server-side errors (5xx). |
Source code in src/mixpanel_data/workspace.py
list_custom_events
¶
List all custom events.
| RETURNS | DESCRIPTION |
|---|---|
list[EventDefinition]
|
List of |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
ServerError
|
Server-side errors (5xx). |
Source code in src/mixpanel_data/workspace.py
update_custom_event
¶
Update a custom event's lexicon entry (description, tags, etc.).
The Mixpanel data-definitions/events/ endpoint matches updates by
the most specific identifier; for custom events that's the
customEventId. This SDK method requires the id (rather than the
display name) to avoid creating orphan lexicon entries — passing a
name alone causes the server to fabricate a new, unlinked entry.
Get the id from :meth:create_custom_event's return value
(CustomEvent.id) or from the custom_event_id field on entries
returned by :meth:list_custom_events.
| PARAMETER | DESCRIPTION |
|---|---|
custom_event_id
|
Server-assigned custom event ID.
TYPE:
|
params
|
Fields to update. See
:class: |
| RETURNS | DESCRIPTION |
|---|---|
EventDefinition
|
The updated |
EventDefinition
|
event, with |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Event not found (404) or validation error (400). |
ServerError
|
Server-side errors (5xx). |
MixpanelDataError
|
Server returned an entry with a different
|
Example
Source code in src/mixpanel_data/workspace.py
delete_custom_event
¶
Delete a custom event.
Identifies the entry by custom_event_id (not name) for the
same reason :meth:update_custom_event does: a name-only DELETE
against the data-definitions endpoint is ambiguous when multiple
entries share a display name and may silently delete the wrong row,
an auto-derived orphan lexicon entry, or no-op while still
reporting success.
Get the id from :meth:create_custom_event's return value
(CustomEvent.id) or from the custom_event_id field on
entries returned by :meth:list_custom_events.
| PARAMETER | DESCRIPTION |
|---|---|
custom_event_id
|
Server-assigned custom event ID.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Event not found (404). |
ServerError
|
Server-side errors (5xx). |
Source code in src/mixpanel_data/workspace.py
list_schema_registry
¶
List schema registry entries.
| PARAMETER | DESCRIPTION |
|---|---|
entity_type
|
Filter by entity type ("event", "custom_event", "profile"). If None, returns all schemas.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[SchemaEntry]
|
List of |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
RateLimitError
|
Rate limit exceeded (429). |
Example
Source code in src/mixpanel_data/workspace.py
create_schema
¶
Create a single schema definition.
| PARAMETER | DESCRIPTION |
|---|---|
entity_type
|
Entity type ("event", "custom_event", "profile").
TYPE:
|
entity_name
|
Entity name (event name or "$user" for profile).
TYPE:
|
schema_json
|
JSON Schema Draft 7 definition.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
dict[str, Any]
|
Created schema as dict. |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Validation error (400). |
RateLimitError
|
Rate limit exceeded (429). |
Example
Source code in src/mixpanel_data/workspace.py
create_schemas_bulk
¶
Bulk create schemas.
| PARAMETER | DESCRIPTION |
|---|---|
params
|
Bulk creation parameters with entries list and optional truncate flag.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
BulkCreateSchemasResponse
|
Response with |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Validation error (400). |
RateLimitError
|
Rate limit exceeded (429). |
Example
Source code in src/mixpanel_data/workspace.py
update_schema
¶
Update a single schema definition (merge semantics).
| PARAMETER | DESCRIPTION |
|---|---|
entity_type
|
Entity type.
TYPE:
|
entity_name
|
Entity name.
TYPE:
|
schema_json
|
Partial JSON Schema to merge with existing.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
dict[str, Any]
|
Updated schema as dict. |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Entity not found or validation error (400, 404). |
RateLimitError
|
Rate limit exceeded (429). |
Example
Source code in src/mixpanel_data/workspace.py
update_schemas_bulk
¶
Bulk update schemas (merge semantics per entry).
| PARAMETER | DESCRIPTION |
|---|---|
params
|
Bulk update parameters with entries list.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[BulkPatchResult]
|
List of per-entry results with status ("ok" or "error"). |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
RateLimitError
|
Rate limit exceeded (429). |
Example
Source code in src/mixpanel_data/workspace.py
delete_schemas
¶
delete_schemas(
*, entity_type: str | None = None, entity_name: str | None = None
) -> DeleteSchemasResponse
Delete schemas by entity type and/or name.
If both provided, deletes a single schema. If only entity_type, deletes all schemas of that type. If neither, deletes all schemas.
| PARAMETER | DESCRIPTION |
|---|---|
entity_type
|
Filter by entity type.
TYPE:
|
entity_name
|
Filter by entity name (requires entity_type).
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
DeleteSchemasResponse
|
Response with |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Invalid parameters (400). |
RateLimitError
|
Rate limit exceeded (429). |
MixpanelDataError
|
If entity_name is provided without entity_type. |
Example
Source code in src/mixpanel_data/workspace.py
get_schema_enforcement
¶
Get current schema enforcement configuration.
| PARAMETER | DESCRIPTION |
|---|---|
fields
|
Comma-separated field names to return (e.g., "ruleEvent,state"). If None, returns all fields.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
SchemaEnforcementConfig
|
Schema enforcement configuration. |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
No enforcement configured (404). |
Source code in src/mixpanel_data/workspace.py
init_schema_enforcement
¶
Initialize schema enforcement.
| PARAMETER | DESCRIPTION |
|---|---|
params
|
Init parameters with rule_event. |
| RETURNS | DESCRIPTION |
|---|---|
dict[str, Any]
|
Raw API response as dict. |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Already initialized or invalid rule_event (400). |
Example
Source code in src/mixpanel_data/workspace.py
update_schema_enforcement
¶
Partially update enforcement configuration.
| PARAMETER | DESCRIPTION |
|---|---|
params
|
Partial update parameters. |
| RETURNS | DESCRIPTION |
|---|---|
dict[str, Any]
|
Raw API response as dict. |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
No enforcement configured or validation error (400). |
Example
Source code in src/mixpanel_data/workspace.py
replace_schema_enforcement
¶
Fully replace enforcement configuration.
| PARAMETER | DESCRIPTION |
|---|---|
params
|
Complete replacement parameters. |
| RETURNS | DESCRIPTION |
|---|---|
dict[str, Any]
|
Raw API response as dict. |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Validation error (400). |
Example
Source code in src/mixpanel_data/workspace.py
delete_schema_enforcement
¶
Delete enforcement configuration.
| RETURNS | DESCRIPTION |
|---|---|
dict[str, Any]
|
Raw API response as dict. |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
No enforcement configured (404). |
Source code in src/mixpanel_data/workspace.py
run_audit
¶
Run a full data audit (events + properties).
| RETURNS | DESCRIPTION |
|---|---|
AuditResponse
|
Audit response with violations and |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
No schemas defined (400). |
Example
Source code in src/mixpanel_data/workspace.py
run_audit_events_only
¶
Run an events-only data audit (faster).
| RETURNS | DESCRIPTION |
|---|---|
AuditResponse
|
Audit response with event violations only. |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
No schemas defined (400). |
Source code in src/mixpanel_data/workspace.py
list_data_volume_anomalies
¶
list_data_volume_anomalies(
*, query_params: dict[str, str] | None = None
) -> list[DataVolumeAnomaly]
List detected data volume anomalies.
| PARAMETER | DESCRIPTION |
|---|---|
query_params
|
Optional filters (status, limit, event_id, etc.).
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[DataVolumeAnomaly]
|
List of |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
Example
Source code in src/mixpanel_data/workspace.py
update_anomaly
¶
Update the status of a single anomaly.
| PARAMETER | DESCRIPTION |
|---|---|
params
|
Update parameters with id, status, and anomaly_class.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
dict[str, Any]
|
Raw API response as dict. |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Anomaly not found or invalid parameters (400). |
Example
Source code in src/mixpanel_data/workspace.py
bulk_update_anomalies
¶
Bulk update anomaly statuses.
| PARAMETER | DESCRIPTION |
|---|---|
params
|
Bulk update with anomalies list and target status.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
dict[str, Any]
|
Raw API response as dict. |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Invalid parameters (400). |
Example
Source code in src/mixpanel_data/workspace.py
list_deletion_requests
¶
List all event deletion requests.
| RETURNS | DESCRIPTION |
|---|---|
list[EventDeletionRequest]
|
List of |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
Source code in src/mixpanel_data/workspace.py
create_deletion_request
¶
Create a new event deletion request.
| PARAMETER | DESCRIPTION |
|---|---|
params
|
Deletion parameters with event_name, from_date, to_date, and optional filters. |
| RETURNS | DESCRIPTION |
|---|---|
list[EventDeletionRequest]
|
Updated full list of deletion requests. |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Validation error (400). |
Example
Source code in src/mixpanel_data/workspace.py
cancel_deletion_request
¶
Cancel a pending deletion request.
| PARAMETER | DESCRIPTION |
|---|---|
request_id
|
Deletion request ID to cancel.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[EventDeletionRequest]
|
Updated full list of deletion requests. |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Request not found or not cancellable (400). |
Source code in src/mixpanel_data/workspace.py
preview_deletion_filters
¶
Preview what events a deletion filter would match.
This is a read-only operation that does not modify any data.
| PARAMETER | DESCRIPTION |
|---|---|
params
|
Preview parameters with event_name, date range, and optional filters. |
| RETURNS | DESCRIPTION |
|---|---|
list[dict[str, Any]]
|
List of expanded/normalized filters. |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Invalid filter parameters (400). |