HomeGuidesAPI Reference
ChangelogHelp CenterCommunityContact Us
API Reference

Query Metric Aggregates

Query and aggregate event data associated with a metric, including native Klaviyo metrics, integration-specific metrics, and custom events. Queries must be passed in the JSON body of your POST request.

To request campaign and flow performance data that matches the data shown in Klaviyo's UI, we recommend the Reporting API.

Results can be filtered and grouped by time, event, or profile dimensions.

To learn more about how to use this endpoint, check out our new Using the Query Metric Aggregates Endpoint guide.

For a comprehensive list of request body parameters, native Klaviyo metrics, and their associated attributes for grouping and filtering, please refer to the metrics attributes guide.

Rate limits:
Burst: 3/s
Steady: 60/m

Scopes:
metrics:read

Body Params

Retrieve Metric Aggregations

object
required
string
required
object
required
string
required

The metric ID used in the aggregation.

string

Optional pagination cursor to iterate over large result sets

array of strings
required

Measurement key, e.g. unique, sum_value, count

measurements*
string
Defaults to day

Aggregation interval, e.g. "hour", "day", "week", "month"

integer
Defaults to 500

Alter the maximum number of returned rows in a single page of aggregation results

array of strings

Optional attribute(s) used for partitioning by the aggregation function

by
array of strings

Provide fields to limit the returned data

return_fields
array of strings
required

List of filters, must include time range using ISO 8601 format (YYYY-MM-DDTHH:MM:SS.mmmmmm).
These filters follow a similar format to those in GET requests, the primary difference is that this endpoint asks for a list.
The time range can be filtered by providing a greater-or-equal and a less-than filter on the datetime field.

filter*
string
Defaults to UTC

The timezone used for processing the query, e.g. 'America/New_York'.
This field is validated against a list of common timezones from the IANA Time Zone Database.
While most are supported, a few notable exceptions are Factory, Europe/Kyiv and Pacific/Kanton. This field is case-sensitive.

string

Provide a sort key (e.g. -$message)

Headers
string
required
Defaults to 2025-01-15

API endpoint revision (format: YYYY-MM-DD[.suffix])

Responses

Language
Credentials