Query Event Data
GET {{baseUrl}}/v1/metric/:metric_id/export?start_date=&end_date=&unit=day&measurement=count&where=[["$attributed_flow","=","FLOW_ID"]]&by=$attributed_flow&count=25
Exports event data from Klaviyo, optionally filtering and segmenting on available event properties. Note that the only comparison operator currently supported is =. To ensure a correct response, enter parameters in the curl request as they are ordered below:
Request Params
| Key | Datatype | Required | Description |
|---|---|---|---|
start_date | null | ||
Beginning of timeframe to pull event data for. The default value is 1 month ago. Can also accept a 10-digit UNIX timestamp. When sending a start_date, you must also send an end_date |
Ex: 1610524800 OR 2021-01-13
|
| end_date | null | |
End of timeframe to pull event data for. The default is the current day, or 1 month from start_date, whichever is sooner. Can also accept a 10-digit UNIX timestamp. When sending an end_date, you must also send a start_date. Must be at most 31 days after start_date
Ex: 1612080000 OR 2021-01-31
|
| unit | string | | Granularity to bucket data points into - one of day, week, or month. Defaults to day. |
| measurement | string | |
Type of metric to fetch - one of unique, count, value, or sum. Defaults to count. For sum a property name to operate on must be supplied as a JSON-encoded list like ["sum","ItemCount"]
|
| where | string | | Optional, JSON-encoded list. Conditions to use to filter the set of events. A max of 1 condition can be given. where and by parameters cannot be specified at the same time.
ex: [["$attributed_flow","=","FLOW_ID"]]
|
| by | string | | The name of a property to segment the event data on. where and by parameters cannot be specified at the same time. Cannot be used alongside where parameter. |
| count | number | | Maximum number of segments to return. Default = 25, MAX = 1000 |
HEADERS
| Key | Datatype | Required | Description |
|---|---|---|---|
Accept | string |
RESPONSES
status: OK
{"metric":{"object":"metric","name":"Placed Order","integration":{"category":"eCommerce","object":"integration","name":"Shopify"},"created":"2015-02-12 18:02:34","updated":"2015-02-12 18:51:41"},"start_date":"2015-01-01 00:00:00","end_date":"2015-01-31 00:00:00","unit":"weekly","measurement":"c","by":"","where":"","results":[{"segment":"Everyone","data":[{"date":"2015-01-13 00:00:00","values":[5]},{"date":"2015-01-14 00:00:00","values":[5]}]}]}