Hello@red3i,
Welcome to the Klaviyo Community!
This is something supported under our query metric aggregate endpoint. I would suggest taking a read through our (New) Using the Query Metric Aggregates Endpoint Developer Guide which covers this and offer some example calls.
For example, to query unique opens for all sent messages you can use:
{
"data": {
"type": "metric-aggregate",
"attributes": {
"measurements": [
"unique"
],
"filter": [
"greater-or-equal(datetime,2022-01-01)",
"less-than(datetime,2022-12-31)"
],
"by": ["$message"],
"interval": "month",
"timezone": "US/Eastern",
"metric_id": "QhyxVR"
}
}
}
For unique opens for a specific message, you can use:
{
"data": {
"type": "metric-aggregate",
"attributes": {
"measurements": [
"unique"
],
"filter": [
"greater-or-equal(datetime,2022-01-01)",
"less-than(datetime,2022-12-31)",
"equals($message,\"01GAQWA31SZKABEZJNXDBGW2F1\")"
],
"interval": "month",
"timezone": "US/Eastern",
"metric_id": "QhyxVR"
}
}
}
I hope this helps!
David