Export
The Export API allows you to retrieve event data and chart data from your OpenPanel projects.
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.
Include the following headers with your requests:
openpanel-client-id
: Your OpenPanel client IDopenpanel-client-secret
: Your OpenPanel client secret
Example:
Events
Get events from a specific project within a date range.
Endpoint: GET /export/events
Parameters:
- project_id (required): The ID of the project
- event (optional): Filter by event name(s). Can be a single event or an array of events.
- start (optional): Start date (format: YYYY-MM-DD)
- end (optional): End date (format: YYYY-MM-DD)
- page (optional, default: 1): Page number for pagination
- limit (optional, default: 50, max: 50): Number of events per page
- includes (optional): Additional fields to include in the response
Example:
Query Parameters
Parameter | Type | Description | Example |
---|---|---|---|
projectId | string | The ID of the project to fetch events from | abc123 |
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: 50) | 25 |
includes | string or string[] | Additional fields to include in the response | profile or ["profile","meta"] |
Example Request
Response
Charts
Retrieve chart data for a specific project.
Endpoint
Query Parameters
Parameter | Type | Description | Example |
---|---|---|---|
projectId | string | The ID of the project to fetch chart data from | abc123 |
events | string[] | Array of event names to include in the chart | ["sign_up","purchase"] |
breakdowns | object[] | Array of breakdown configurations | [{"name":"country"}] |
interval | string | Time interval for data points | day |
range | string | Predefined date range | last_7_days |
previous | boolean | Include data from the previous period | true |
startDate | string | Custom start date (ISO format) | 2024-04-01 |
endDate | string | Custom end date (ISO format) | 2024-04-30 |
chartType | string | Type of chart to generate | linear |
metric | string | Metric to use for calculations | sum |
limit | number | Limit the number of results | 10 |
offset | number | Offset for pagination | 0 |
Example Request
Response
The response will include chart data with series, metrics, and optional previous period comparisons based on the input parameters.
Funnel
Retrieve funnel data for a specific project.
Endpoint
Query Parameters
Parameter | Type | Description | Example |
---|---|---|---|
projectId | string | The ID of the project to fetch funnel data from | abc123 |
events | object[] | Array of event configurations for the funnel steps | [{"name":"sign_up","filters":[]}] |
range | string | Predefined date range | last_30_days |
startDate | string | Custom start date (ISO format) | 2024-04-01 |
endDate | string | Custom end date (ISO format) | 2024-04-30 |
Example Request
Response
The response will include funnel data with total sessions and step-by-step breakdown of the funnel progression.
Notes
- All date parameters should be in ISO format (YYYY-MM-DD).
- The
range
parameter accepts values liketoday
,yesterday
,last_7_days
,last_30_days
,this_month
,last_month
,this_year
,last_year
,all_time
. - The
interval
parameter accepts values likeminute
,hour
,day
,month
. - The
chartType
parameter can belinear
or other supported chart types. - The
metric
parameter can besum
,average
,min
, ormax
.
Remember to replace YOUR_CLIENT_ID
and YOUR_CLIENT_SECRET
with your actual OpenPanel API credentials.