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)
- Business Context — Read and write the markdown documentation that grounds AI assistants (org and project scopes, 50,000-char cap)
- Session Replay — Discover, sign, fetch, and analyze rrweb session recordings; project them into session-level DataFrames and an LLM-friendly action timeline
Key Features¶
Entity CRUD¶
Manage dashboards, reports (bookmarks), and cohorts programmatically via the Mixpanel App API (workspace-scoped):
import mixpanel_headless 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_headless 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_headless 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.
Business Context¶
Read and write the markdown documentation that grounds AI assistants. Two scopes (level="organization" shared across the org, level="project" per-project), 50,000-character cap enforced client-side before any HTTP call.
import mixpanel_headless as mp
ws = mp.Workspace()
# Read
project_ctx = ws.get_business_context(level="project")
org_ctx = ws.get_business_context(level="organization") # auto-resolves org_id
# Read both in one round-trip
chain = ws.get_business_context_chain()
# Write (full-replace; pass "" to clear)
ws.set_business_context("# About Acme\n…", level="project")
ws.clear_business_context(level="organization")
Project-scope writes require edit_project_info permission; org-scope writes require edit_project_info at the org level. See the Business Context guide for full coverage of input modes, error handling, and cross-project audit patterns.
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].
Session Replay¶
Discover a user's rrweb session recordings, fetch the raw event stream from the signed CDN, and project them into analysis-ready DataFrames. The methods: list_replays, events_for_replay / events_for_replays, sign_replay / sign_replays, fetch_replay / fetch_replays, stream_replay, replays_for_user, and analyze_replay.
import mixpanel_headless as mp
ws = mp.Workspace()
# Discovery + fetch + Mixpanel-event join in one call → a ReplayBundle
bundle = ws.replays_for_user("user-42", from_date="2025-01-01", to_date="2025-01-31")
print(bundle.sessions_df) # one row per session: duration, n_clicks, n_errors
print(bundle.top_clicks(10)) # most-clicked elements (focus interactions excluded)
print(bundle.replays[0].summary_markdown) # LLM-friendly action timeline
# Single replay, with the raw rrweb stream for the JS player
replay = ws.fetch_replay("0190ebde-d50d-71b1-804c-ec1b4a533ef9")
player_json = replay.to_rrweb_player_json()
Signed CDN URLs are bearer credentials: SignedReplay masks them in repr / str and the library never logs them. A SESSION_RECORDING_SENSITIVE_DATA 403 raises SessionReplayAccessError. See the Session Replay guide for the full surface, the mp replays CLI, and the DataFrame schemas.
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_headless 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_headless.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_headless/workspace.py
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 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 | |
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_headless 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_headless/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_headless/workspace.py
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 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 | |
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_headless/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_headless/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_headless/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_headless/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 across the cached /me view, then
GET /projects/{pid}/workspaces/public, then the projects metadata
index — each applying the shared preference of
:func:~mixpanel_headless._internal.me.select_workspace_id (global
view, then "All Project Data", then default, then first visible, then
first). See :meth:MixpanelAPIClient.resolve_workspace_id for the
full source-by-source rules and error behavior.
| RETURNS | DESCRIPTION |
|---|---|
int
|
The resolved workspace ID. |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If credentials are not available. |
WorkspaceScopeError
|
If no workspace could be resolved for the project from any source. |
Source code in src/mixpanel_headless/workspace.py
events
¶
events(
*,
limit: int | None = None,
from_date: str | None = None,
to_date: str | None = None,
) -> list[str]
List event names in the Mixpanel project.
Defaults to the widest window the underlying
/events/names endpoint will accept: limit=5000 (the
server-side ceiling), from_date=2000-01-01 (the API's
earliest accepted year — pre-2000 values come back as
"invalid date, bad year"), and to_date set to today.
The endpoint is gated by the per-project
max_data_history_days feature; if the wide from_date
is rejected (HTTP 403, "Date range exceeds N days into the
past"), the call automatically retries with today - N days.
Note that this method reflects events seen during the queried
window — it is not the schema registry. Events that were
registered in Lexicon but never fired in the window are
absent. For the full registered schema, use the Lexicon
endpoints (e.g. :meth:get_event_definitions).
Results are cached per (limit, from_date, to_date) triple
for the lifetime of the Workspace.
| PARAMETER | DESCRIPTION |
|---|---|
limit
|
Maximum events to return. Defaults to the server-side ceiling (5000).
TYPE:
|
from_date
|
TYPE:
|
to_date
|
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[str]
|
Alphabetically sorted list of event names. |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If API credentials not available. |
AuthenticationError
|
If credentials are invalid. |
QueryError
|
403 errors unrelated to date-range gating, or
any other 4xx the |
Source code in src/mixpanel_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/workspace.py
schema_graph
¶
schema_graph(
*,
include_density: bool = False,
include_user_properties: bool = True,
force_refresh: bool = False,
) -> SchemaGraphResult
Gather the full Lexicon schema and event<->property relationships.
Adapts the power-tools getSchema view: one call returns the project's
event definitions, event properties, and user properties, plus the
adjacency between events and the properties that appear on them. The
result is a typed :class:SchemaGraphResult with DataFrame views
(events_df, properties_df, relationships_df) and a
to_graph() networkx export.
Group properties are not gathered yet (headless has no data-groups listing to enumerate them).
Results are cached for the lifetime of the Workspace.
| PARAMETER | DESCRIPTION |
|---|---|
include_density
|
Request the property-level density (
TYPE:
|
include_user_properties
|
Also gather user properties.
TYPE:
|
force_refresh
|
Bypass the cache and re-fetch.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
A
|
class:
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If API credentials are not available. |
AuthenticationError
|
If credentials are invalid. |
Example
Source code in src/mixpanel_headless/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_headless/workspace.py
1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 | |
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_headless/workspace.py
1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 | |
get_business_context
¶
get_business_context(
*,
level: Literal["organization", "project"] = "project",
organization_id: int | None = None,
) -> BusinessContext
Read business context content at the given scope.
Calls GET /api/app/projects/{pid}/business-context (when
level="project") or
GET /api/app/organizations/{org_id}/business-context
(when level="organization"). Returns a populated
BusinessContext with content="" when no context is set.
| PARAMETER | DESCRIPTION |
|---|---|
level
|
TYPE:
|
organization_id
|
Optional explicit org ID, only honored
when
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
BusinessContext
|
|
BusinessContext
|
current state. |
BusinessContext
|
org-level returns; |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
|
ConfigError
|
Credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
API error (400, 403, 404). |
ServerError
|
Server-side errors (5xx). |
WorkspaceScopeError
|
|
MixpanelHeadlessError
|
API response is missing the |
Example
Source code in src/mixpanel_headless/workspace.py
10089 10090 10091 10092 10093 10094 10095 10096 10097 10098 10099 10100 10101 10102 10103 10104 10105 10106 10107 10108 10109 10110 10111 10112 10113 10114 10115 10116 10117 10118 10119 10120 10121 10122 10123 10124 10125 10126 10127 10128 10129 10130 10131 10132 10133 10134 10135 10136 10137 10138 10139 10140 10141 10142 10143 10144 10145 10146 10147 10148 10149 10150 10151 10152 10153 10154 10155 10156 10157 10158 10159 10160 10161 10162 10163 | |
set_business_context
¶
set_business_context(
content: str,
*,
level: Literal["organization", "project"] = "project",
organization_id: int | None = None,
) -> BusinessContext
Replace business context content at the given scope.
Validates len(content) <= BUSINESS_CONTEXT_MAX_CHARS (50,000)
client-side BEFORE the HTTP call so callers fail fast and avoid
a wasted round-trip to the server (which enforces the same limit
and returns 400 above it). Then calls
PUT /api/app/projects/{pid}/business-context (project) or
PUT /api/app/organizations/{org_id}/business-context (org).
The PUT is full-replace — pass an empty string to clear (or use
clear_business_context for clarity).
| PARAMETER | DESCRIPTION |
|---|---|
content
|
New markdown content. Empty string clears the context at this scope.
TYPE:
|
level
|
TYPE:
|
organization_id
|
Optional explicit org ID, only honored
when
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
BusinessContext
|
|
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
|
BusinessContextValidationError
|
|
ConfigError
|
Credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Caller lacks |
ServerError
|
Server-side errors (5xx). |
WorkspaceScopeError
|
|
MixpanelHeadlessError
|
API response is missing the |
Example
Source code in src/mixpanel_headless/workspace.py
10165 10166 10167 10168 10169 10170 10171 10172 10173 10174 10175 10176 10177 10178 10179 10180 10181 10182 10183 10184 10185 10186 10187 10188 10189 10190 10191 10192 10193 10194 10195 10196 10197 10198 10199 10200 10201 10202 10203 10204 10205 10206 10207 10208 10209 10210 10211 10212 10213 10214 10215 10216 10217 10218 10219 10220 10221 10222 10223 10224 10225 10226 10227 10228 10229 10230 10231 10232 10233 10234 10235 10236 10237 10238 10239 10240 10241 10242 10243 10244 10245 10246 10247 10248 10249 10250 | |
clear_business_context
¶
clear_business_context(
*,
level: Literal["organization", "project"] = "project",
organization_id: int | None = None,
) -> BusinessContext
Clear business context at the given scope.
Convenience wrapper that calls
set_business_context("", level=..., organization_id=...).
Useful for documenting intent — equivalent to passing an empty
string explicitly.
| PARAMETER | DESCRIPTION |
|---|---|
level
|
TYPE:
|
organization_id
|
Optional explicit org ID for
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
BusinessContext
|
|
BusinessContext
|
echoed back from the server). |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
|
ConfigError
|
Credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Caller lacks |
ServerError
|
Server-side errors (5xx). |
WorkspaceScopeError
|
|
Source code in src/mixpanel_headless/workspace.py
get_business_context_chain
¶
Read both organization and project business context together.
Issues exactly one App API request to
GET /api/app/projects/{pid}/business-context/chain —
a server-side convenience that returns both scopes for the
active project. organization.organization_id is populated
on a best-effort basis from the cached /me response (in-memory
or disk); when the cache is cold it is left as None rather
than triggering an extra /me round-trip. Callers that need a
guaranteed org ID should use get_business_context(level=
"organization"), which performs full resolution.
| RETURNS | DESCRIPTION |
|---|---|
BusinessContextChain
|
|
BusinessContextChain
|
|
BusinessContextChain
|
context is set at that scope. |
BusinessContextChain
|
|
BusinessContextChain
|
|
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
Credentials are not available. |
AuthenticationError
|
Invalid credentials (401). |
QueryError
|
Caller lacks project access (403, 404) or other API error (400). |
ServerError
|
Server-side errors (5xx). |
MixpanelHeadlessError
|
API response is missing |
Example
Source code in src/mixpanel_headless/workspace.py
10296 10297 10298 10299 10300 10301 10302 10303 10304 10305 10306 10307 10308 10309 10310 10311 10312 10313 10314 10315 10316 10317 10318 10319 10320 10321 10322 10323 10324 10325 10326 10327 10328 10329 10330 10331 10332 10333 10334 10335 10336 10337 10338 10339 10340 10341 10342 10343 10344 10345 10346 10347 10348 10349 10350 10351 10352 10353 10354 10355 10356 10357 | |
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_headless/workspace.py
2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 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 | |
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_headless/workspace.py
2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 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 | |
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_headless/workspace.py
3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 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 | |
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_headless/workspace.py
3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 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 | |
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_headless/workspace.py
4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 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 | |
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_headless/workspace.py
4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 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 | |
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_headless/workspace.py
3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 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 | |
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_headless/workspace.py
3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 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 | |
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_headless/workspace.py
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 9467 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 | |
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_headless/workspace.py
9568 9569 9570 9571 9572 9573 9574 9575 9576 9577 9578 9579 9580 9581 9582 9583 9584 9585 9586 9587 9588 9589 9590 9591 9592 9593 9594 9595 9596 9597 9598 9599 9600 9601 9602 9603 9604 9605 9606 9607 9608 9609 9610 9611 9612 9613 9614 9615 9616 9617 9618 9619 9620 9621 9622 9623 9624 9625 9626 9627 9628 9629 9630 9631 9632 9633 9634 9635 9636 9637 9638 9639 9640 9641 9642 9643 9644 9645 9646 9647 9648 9649 9650 9651 9652 9653 9654 9655 9656 9657 9658 9659 9660 9661 9662 9663 9664 9665 9666 9667 9668 9669 9670 9671 9672 9673 9674 9675 9676 9677 9678 9679 9680 9681 | |
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_headless/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_headless/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_headless/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_headless/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_headless/workspace.py
activity_feed
¶
activity_feed(
distinct_ids: list[str],
*,
from_date: str | None = None,
to_date: str | None = None,
limit: int | None = None,
include_events: list[str] | None = None,
exclude_events: list[str] | None = None,
sentinel_event: dict[str, Any] | None = None,
paging_window: int | None = None,
search: str | None = None,
search_properties: list[dict[str, Any]] | None = None,
use_custom_events: bool = False,
) -> ActivityFeedResult
Get activity feed for specific users.
Returns a user's events sorted chronologically (oldest-first within a
page). When limit is set, the most recent events come first; use the
sentinel_event cursor (carried on the result) to page backward to
older events. Backed by the stream/bookmark endpoint; also filterable by
event name or full-text search.
| PARAMETER | DESCRIPTION |
|---|---|
distinct_ids
|
List of user identifiers.
TYPE:
|
from_date
|
Optional start date filter (
TYPE:
|
to_date
|
Optional end date filter (
TYPE:
|
limit
|
Optional max events to return (server ceiling 15000).
TYPE:
|
include_events
|
Optional event names to include; mutually exclusive
with
TYPE:
|
exclude_events
|
Optional event names to exclude; mutually exclusive
with
TYPE:
|
sentinel_event
|
Optional pagination cursor from a prior result's
TYPE:
|
paging_window
|
Optional days (<= 30) bounding each page's scan window.
TYPE:
|
search
|
Optional full-text search string applied to events.
TYPE:
|
search_properties
|
Optional property descriptors to restrict the
TYPE:
|
use_custom_events
|
When
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ActivityFeedResult
|
ActivityFeedResult with user events plus a |
ActivityFeedResult
|
( |
| RAISES | DESCRIPTION |
|---|---|
ConfigError
|
If API credentials not available. |
QueryError
|
If both |
Example
Source code in src/mixpanel_headless/workspace.py
1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 | |
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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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). |
MixpanelHeadlessError
|
If the API response is not a valid dashboard dict. |
Source code in src/mixpanel_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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 |
|---|---|
MixpanelHeadlessError
|
If |
BookmarkValidationError
|
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_headless/workspace.py
5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 | |
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_headless/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 |
|---|---|
BookmarkValidationError
|
If |
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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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, display_name, 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_headless/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_headless/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_headless/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_headless/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, display_name, description, example_value, resource_type). |
| 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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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. |
MixpanelHeadlessError
|
Async processing timed out or failed. |
Example
Source code in src/mixpanel_headless/workspace.py
7740 7741 7742 7743 7744 7745 7746 7747 7748 7749 7750 7751 7752 7753 7754 7755 7756 7757 7758 7759 7760 7761 7762 7763 7764 7765 7766 7767 7768 7769 7770 7771 7772 7773 7774 7775 7776 7777 7778 7779 7780 7781 7782 7783 7784 7785 7786 7787 7788 7789 7790 7791 7792 7793 7794 7795 7796 7797 7798 7799 7800 7801 7802 7803 7804 7805 7806 7807 7808 7809 7810 7811 7812 7813 7814 7815 7816 7817 7818 7819 7820 7821 7822 7823 7824 | |
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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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). |
MixpanelHeadlessError
|
Server returned an entry with a different
|
Example
Source code in src/mixpanel_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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). |
MixpanelHeadlessError
|
If entity_name is provided without entity_type. |
Example
Source code in src/mixpanel_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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_headless/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). |