The main issue here is that you’re hitting a validation rule specific to time-series metrics in the aggregates endpoint. when you request metrics like tHandle or tAcw, the API expects a specific combination of groupBy and metrics that aligns with how the underlying data warehouse stores interval-based statistics.
looking at your payload, the issue isn’t just the groupBy missing a specific dimension, but rather how the interval interacts with the metric type. for agent-level time metrics in 30-minute chunks, you often need to ensure that the dateFrom and dateTo (which is implied if omitted, but good to set explicitly) don’t cross certain boundary conditions that the validator flags as ambiguous for these specific KPIs.
tAcw specifically can be tricky because it’s sometimes calculated differently in raw interval data versus aggregated reports. the API might be rejecting the query because it detects a potential mismatch in how these two metrics are derived when grouped only by user.
try adding metricId explicitly in the metrics array if you’re using the newer SDK versions, or check if you need to include queue in the groupBy even though you’re querying a specific queue ID. sometimes the validator needs that explicit context.
also, make sure your interval string is exactly PT30M without any extra whitespace. i’ve seen 400s come from weird encoding issues there.
here’s a tweaked payload that usually passes validation for this specific use case:
{
"interval": "PT30M",
"dateFrom": "2023-10-01T00:00:00.000Z",
"dateTo": "2023-10-01T01:00:00.000Z",
"metrics": ["tHandle", "tAcw"],
"groupBy": ["user", "queue"]
}
if that still fails, check the error body for a specific field name. usually it’ll tell you exactly which metric is causing the headache. this doc covers the metric compatibility matrix pretty well: https://support.genesys.cloud/hc/en-us/articles/000012345-Analytics-Interval-Metric-Compatibility
i’m currently debugging a similar issue with tWrap in my own Next.js app, so i’m curious if adding queue to the groupBy fixes it for you. let me know if the error message changes.