Skip to main content
Solved

Metric-Aggregates API for campaign/flow no longer works (400 Bad Request)

  • June 4, 2025
  • 2 replies
  • 61 views

Forum|alt.badge.img

I’m trying to reproduce the old approach of querying /metrics + /metric-aggregates to get daily counts broken down by attributed campaign or flow (e.g. “Opened Email by $attributed_campaign”). In previous versions, a POST to:

https://a.klaviyo.com/api/metric-aggregates

 

used to return a valid response. Now, with the same revision: 2025-04-15 header and “2025-05-01T00:00:00” date formats, I get a 400 Bad Request (“Invalid input.”). Likewise, a simple GET /metrics?filter=equals(integration.name,"Klaviyo")&fields[metric]=id,name also returns 400.

Questions:

  1. Does /metric-aggregates still support grouping by $attributed_campaign or $attributed_flow in the latest API? If so, what is the minimal working request (headers + body)?

  2. Is there a required header or content type I’m missing (e.g. content-type: application/vnd.api+json)?

  3. If the Metrics API no longer allows campaign/flow grouping, what is the recommended alternative for programmatically retrieving “per-campaign” or “per-flow” aggregates today?

Best answer by emma.owens

Hi ​@Felipe_dev ! 

Based on our documentation here, it does look like we still offer attribution parameters as an option in the payload. Can you send over a screenshot of the API call and the return error - you should be able to locate this in your account by going to this link: https://www.klaviyo.com/developer-tools/logs?statusCode=400 ! 

2 replies

emma.owens
Community Manager
Forum|alt.badge.img+20
  • Community Manager
  • Answer
  • June 5, 2025

Hi ​@Felipe_dev ! 

Based on our documentation here, it does look like we still offer attribution parameters as an option in the payload. Can you send over a screenshot of the API call and the return error - you should be able to locate this in your account by going to this link: https://www.klaviyo.com/developer-tools/logs?statusCode=400 ! 


Byrne C
Community Manager
Forum|alt.badge.img+27
  • Community Manager
  • June 9, 2025

Hey ​@Felipe_dev,

Are you still returning an error when calling this endpoint? If so, let us know - we can take a look to see what’s happening if you send over a screenshot of the API call, with any sensitive data redacted.