Skip to content

API Overview

The mixpanel_data Python API provides programmatic access to all library functionality.

Explore on DeepWiki

🤖 Python API Reference →

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

View Workspace API

Auth Module

Credential and account management:

  • ConfigManager — Manage accounts in config file
  • Credentials — Credential container with secrets
  • AccountInfo — Account metadata (without secrets)

View Auth API

Exceptions

Structured error handling:

  • MixpanelDataError — Base exception
  • APIError — HTTP/API errors
  • ConfigError — Configuration errors
  • TableExistsError / TableNotFoundError — Storage errors

View Exceptions

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...

View Result Types

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