Get Metric Aggregate

Query & aggregate event data associated with specific metrics, optionally filtering & grouping results by time, event or profile dimensions.
This endpoint lets you form queries in your POST request body rather than query parameters for simpler query syntax.
Request body parameters (all nested under attributes): * return_fields: Provide fields to limit the returned data

  • sort: Provide a sort key (e.g. "-timestamp")
  • page_cursor: Optional pagination cursor to iterate over large result sets
  • measurement: Measurement key, e.g "sum_value", "count", "unique"
    • "sum_value" Performs a summation of the Event Value, optionally partitioned over any dimension provided in the by field
    • "count" Counts the number of events associated to metric provided in the query, optionally partitioned over any dimension provided in the by field
    • "unique" Counts the number of unique customers associated to metric provided in the query, optionally partitioned over any dimension provided in the by field
  • interval: Aggregation interval, e.g. "hour","day","week","month"
  • page_size: Limit the number of returned results
  • by: Optional attribute(s) used for grouping by the aggregation function
  • metric_id: The metric ID used in the aggregation
  • filter: 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 filter on the datetime field, e.g "greater-or-equal(datetime,2021-07-01T00:00:00)" and a less-than filter on the same datetime field, e.g. "less-than(datetime,2022-07-01T00:00:00)".
    Additionally, you can filter on the same list of supported aggregate dimensions using the common filter syntax, e.g. "equals(URL,\"https://www.klaviyo.com/\")" timezone: 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.

    For a comprehensive list of native Klaviyo metrics and their associated attributes for grouping & filtering, please refer to our Native Klaviyo Metrics & Attributes guide for our V1 APIs.

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

Scopes:
Metrics Read

Language
Authentication
Header