Analytics API aggregation query returning null for queue groups

How do I structure the groupBy parameter for a POST to /api/v2/analytics/users/summary to group by queue and media type? Sending this payload returns null values for the queue field even though the data exists in the UI.

{
 "groupBy": ["queue.id", "mediaType"],
 "filter": "mediaType in (\"voice\")"
}

The response comes back 200 OK but the buckets are empty.

You’re likely hitting a permission scope issue or using the wrong attribute path for the summary endpoint. The users/summary endpoint doesn’t always respect queue.id in the groupBy if the user isn’t actively assigned or if the time window is too small.

Try switching to the conversations/summary endpoint instead. It’s much more reliable for queue-level aggregations. Also, ensure your filter includes the date range explicitly in the query body, not just the media type.

Here’s a working payload structure:

{
 "interval": "2023-10-01T00:00:00.000Z/2023-10-02T00:00:00.000Z",
 "filter": "queue.id eq 'your-queue-id-here' AND mediaType eq 'voice'",
 "groupBy": ["mediaType"],
 "select": ["talkDuration", "holdDuration", "wrapupDuration"]
}

If you absolutely need user-level data grouped by queue, you have to pull the user-to-queue mapping separately and merge it client-side. The API doesn’t join those tables on the fly for summary queries. Check your OAuth token scopes too. analytics:view isn’t enough if you’re querying specific user details without users:view.