API Overview¶
The mixpanel_data Python API provides programmatic access to all library functionality.
Explore on DeepWiki
Ask questions about API methods, explore usage patterns, or get help with specific functionality.
Import Patterns¶
# Recommended: import with alias
import mixpanel_data as mp
ws = mp.Workspace()
result = ws.segmentation(...)
# Direct imports
from mixpanel_data import Workspace, FetchResult, MixpanelDataError
# Auth utilities
from mixpanel_data.auth import ConfigManager, Credentials
Core Components¶
Workspace¶
The main entry point for all operations:
- Discovery — Explore events, properties, funnels, cohorts
- Fetching — Download events and profiles to local storage
- Streaming — Stream data directly without storage (ETL, pipelines)
- Local Queries — SQL queries against DuckDB
- Live Queries — Real-time analytics from Mixpanel API
- Introspection — Examine local tables and schemas
Auth Module¶
Credential and account management:
- ConfigManager — Manage accounts in config file
- Credentials — Credential container with secrets
- AccountInfo — Account metadata (without secrets)
Exceptions¶
Structured error handling:
- MixpanelDataError — Base exception
- APIError — HTTP/API errors
- ConfigError — Configuration errors
- TableExistsError / TableNotFoundError — Storage errors
Result Types¶
Typed results for all operations:
- FetchResult — Fetch operation results
- SegmentationResult — Time-series data
- FunnelResult — Funnel conversion data
- RetentionResult — Retention cohort data
- And many more...
Type Aliases¶
The library exports these type aliases:
from mixpanel_data import CountType, HourDayUnit, TimeUnit
# CountType: Literal["general", "unique", "average", "median", "min", "max"]
# HourDayUnit: Literal["hour", "day"]
# TimeUnit: Literal["day", "week", "month", "quarter", "year"]
Complete API Reference¶
- Workspace — Main facade class
- Auth — Authentication and configuration
- Exceptions — Error handling
- Result Types — All result dataclasses