Export
The Export API allows you to retrieve event data and chart data from your OpenPanel projects for analysis, reporting, and data integration.
Authentication
To authenticate with the Export API, you need to use your clientId
and clientSecret
. Make sure your client has read
or root
mode. The default client does not have access to the Export API.
For detailed authentication information, see the Authentication guide.
Include the following headers with your requests:
openpanel-client-id
: Your OpenPanel client IDopenpanel-client-secret
: Your OpenPanel client secret
Base URL
All Export API requests should be made to:
Common Query Parameters
Most endpoints support the following query parameters:
Parameter | Type | Description | Default |
---|---|---|---|
projectId | string | The ID of the project (alternative: project_id ) | Required |
startDate | string | Start date (ISO format: YYYY-MM-DD) | Based on range |
endDate | string | End date (ISO format: YYYY-MM-DD) | Based on range |
range | string | Predefined date range (7d , 30d , today , etc.) | None |
Endpoints
Get Events
Retrieve individual events from a specific project within a date range. This endpoint provides raw event data with optional filtering and pagination.
Query Parameters
Parameter | Type | Description | Example |
---|---|---|---|
projectId | string | The ID of the project to fetch events from | abc123 |
profileId | string | Filter events by specific profile/user ID | user_123 |
event | string or string[] | Event name(s) to filter | screen_view or ["screen_view","button_click"] |
start | string | Start date for the event range (ISO format) | 2024-04-15 |
end | string | End date for the event range (ISO format) | 2024-04-18 |
page | number | Page number for pagination (default: 1) | 2 |
limit | number | Number of events per page (default: 50, max: 1000) | 100 |
includes | string or string[] | Additional fields to include in the response | profile or ["profile","meta"] |
Include Options
The includes
parameter allows you to fetch additional related data:
profile
: Include user profile informationmeta
: Include event metadata and configuration
Example Request
Response
Get Charts
Retrieve aggregated chart data for analytics and visualization. This endpoint provides time-series data with advanced filtering, breakdowns, and comparison capabilities.
Query Parameters
Parameter | Type | Description | Example |
---|---|---|---|
projectId | string | The ID of the project to fetch chart data from | abc123 |
events | object[] | Array of event configurations to analyze | [{"name":"screen_view","filters":[]}] |
breakdowns | object[] | Array of breakdown dimensions | [{"name":"country"}] |
interval | string | Time interval for data points | day |
range | string | Predefined date range | 7d |
previous | boolean | Include data from the previous period for comparison | true |
startDate | string | Custom start date (ISO format) | 2024-04-01 |
endDate | string | Custom end date (ISO format) | 2024-04-30 |
Event Configuration
Each event in the events
array supports the following properties:
Property | Type | Description | Required | Default |
---|---|---|---|---|
name | string | Name of the event to track | Yes | - |
filters | Filter[] | Array of filters to apply to the event | No | [] |
segment | string | Type of segmentation | No | event |
property | string | Property name for property-based segments | No | - |
Segmentation Options
event
: Count individual events (default)user
: Count unique users/profilessession
: Count unique sessionsuser_average
: Average events per userone_event_per_user
: One event per user (deduplicated)property_sum
: Sum of a numeric propertyproperty_average
: Average of a numeric propertyproperty_min
: Minimum value of a numeric propertyproperty_max
: Maximum value of a numeric property
Filter Configuration
Each filter in the filters
array supports:
Property | Type | Description | Required |
---|---|---|---|
name | string | Property name to filter on | Yes |
operator | string | Comparison operator | Yes |
value | array | Array of values to compare against | Yes |
Filter Operators
is
: Exact matchisNot
: Not equal tocontains
: Contains substringdoesNotContain
: Does not contain substringstartsWith
: Starts withendsWith
: Ends withregex
: Regular expression matchisNull
: Property is null or emptyisNotNull
: Property has a value
Breakdown Dimensions
Common breakdown dimensions include:
Dimension | Description | Example Values |
---|---|---|
country | User's country | United States , Canada |
region | User's region/state | California , New York |
city | User's city | San Francisco , New York |
device | Device type | Desktop , Mobile , Tablet |
browser | Browser name | Chrome , Firefox , Safari |
os | Operating system | macOS , Windows , iOS |
referrer | Referrer URL | google.com , facebook.com |
path | Page path | / , /dashboard , /pricing |
Time Intervals
minute
: Minute-by-minute datahour
: Hourly aggregationday
: Daily aggregation (default)week
: Weekly aggregationmonth
: Monthly aggregation
Date Ranges
30min
: Last 30 minuteslastHour
: Last hourtoday
: Current dayyesterday
: Previous day7d
: Last 7 days30d
: Last 30 days6m
: Last 6 months12m
: Last 12 monthsmonthToDate
: Current month to datelastMonth
: Previous monthyearToDate
: Current year to datelastYear
: Previous year
Example Request
Example Advanced Request
Response
Error Handling
The API uses standard HTTP response codes. Common error responses:
400 Bad Request
401 Unauthorized
403 Forbidden
404 Not Found
429 Too Many Requests
Rate limiting response includes headers indicating your rate limit status.
Rate Limiting
The Export API implements rate limiting:
- 100 requests per 10 seconds per client
- Rate limit headers included in responses
- Implement exponential backoff for retries
Data Types and Formats
Event Properties
Event properties are stored as key-value pairs and can include:
- Built-in properties:
path
,origin
,title
,url
,hash
- UTM parameters:
utm_source
,utm_medium
,utm_campaign
,utm_term
,utm_content
- Custom properties: Any custom data you track with your events
Property Access
Properties can be accessed in filters and breakdowns using dot notation:
properties.custom_field
: Access custom propertiesprofile.properties.user_type
: Access profile propertiesproperties.__query.utm_source
: Access query parameters
Date Handling
- All dates are in ISO 8601 format
- Timezone handling is done server-side based on project settings
- Date ranges are inclusive of start and end dates
Geographic Data
Geographic information is automatically collected when available:
country
: Full country nameregion
: State/province/regioncity
: City namelongitude
/latitude
: Coordinates (when available)
Device Information
Device data is collected from user agents:
device
: Device type (Desktop, Mobile, Tablet)browser
: Browser name and versionos
: Operating system and versionbrand
/model
: Device brand and model (mobile devices)
Notes
- Event data is typically available within seconds of tracking
- All timezone handling is done server-side based on project settings
- Property names are case-sensitive in filters and breakdowns
Remember to replace YOUR_CLIENT_ID
and YOUR_CLIENT_SECRET
with your actual OpenPanel API credentials.