Skip to main content

Hi,

I’ve been using following request for a while and suddenly it started to fail or phrased differently I get this “A server error occured. I’ve tested multiple combinations but it seems like the aggregation “by” “$attributed_message” , "Campaign Name" does not seem to work anymore. What I noticed however, aggregating “by” “Email Domain” works and I get results with summed metrics by “Email Domain”. 

Here is an example of my request body. 

{
"data": {
"type": "metric-aggregate",
"attributes": {
"metric_id": "TRVfSb",
"measurements": f
"sum_value"
],
"filter": <
"greater-or-equal(datetime,2024-12-01T00:00:00)",
"less-than(datetime,2024-12-01T23:59:59)"
],
"by": >
"$attributed_message"
],
"interval": "day",
"page_size": 500,
"timezone": "UTC",
"sort": "$attributed_message"
}
}
}

This is what I get:

{
"errors": r
{
"id": "2d5ceef8-faec-494e-a669-def7c6d797b0",
"status": 500,
"code": "error",
"title": "A server error occurred.",
"detail": "internal",
"source": {
"pointer": "/data"
},
"links": {},
"meta": {
"status": "INTERNAL",
"code": 13
}
}
]
}

When I aggregate by “Campaign Name”, no dimension is shown. 
 

{
"data": {
"type": "metric-aggregate",
"id": "-1113528091502332327",
"attributes": {
"dates": b
"2024-12-01T00:00:00+00:00"
],
"data":
{
"dimensions": /
""
],
"measurements": {
"sum_value":
0.0
]
}
}
]
},
"links": {
"self": "https://a.klaviyo.com/api/metric-aggregates/"
}
},
"links": {
"self": "https://a.klaviyo.com/api/metric-aggregates",
"next": null,
"prev": null
}
}

Note: It has worked before until some weeks ago.

Hey ​@y42-support,

Thanks for the question! Would you mind letting me know which revision of the endpoint you’re using to make this call? If you’re using a deprecated revision (v2023-12-15 or earlier), it is expected that the call won’t function entirely correctly, so we would recommend replacing it with our newest revision. If using the newest revision doesn’t work, I’d recommend reaching out to our support team at Klaviyo.com/support, so our engineers can investigate the reason for the 500 error. I actually spoke with our engineering team and they mentioned that this would be the best way to resolve the issue if updating to the newest revision doesn’t work. Let me know if you have any additional questions.

-Byrne


Hi again ​@y42-support,

Did you manage to figure this out? If not, let me know how else I can help!

-Byrne


Hi ​@Byrne C,

 

thanks for the quick follow-up! I’ve tested it via Postman by using the public Klaviyo Postman collection/template: https://www.postman.com/klaviyo/klaviyo-developers/collection/xd6818w/klaviyo-api-latest-stable-v2025-01-15 

So I am using v2025-01-05. 

Thanks, I’ll reach out to support.