Analytics Aggregates query returns empty data despite valid query params

So I’m seeing a very odd bug with the Analytics Conversations Aggregates API. I’m building a Pulumi component to provision custom reports, but I need to validate the query payload via the API first. The endpoint is POST /api/v2/analytics/conversations/aggregates. I’m sending a standard JSON body to get hourly wrap-up code counts. The request returns HTTP 200, but the data array in the response is always empty. I’ve verified the same query works in the UI and Postman with a manual token.

Here is the payload I’m sending:

{
 "groupings": ["wrapupCode"],
 "interval": "PT1H",
 "startDate": "2023-10-01T00:00:00.000Z",
 "endDate": "2023-10-01T23:59:59.999Z",
 "metrics": ["wrapupCode.count"],
 "select": ["wrapupCode", "count"],
 "filter": {
 "type": "and",
 "clauses": [
 {
 "type": "equals",
 "field": "mediaType",
 "value": "voice"
 }
 ]
 }
}

My TypeScript code uses axios with a bearer token fetched from the client_credentials flow. The token is fresh. I’m in Europe/London timezone, but I’m passing UTC ISO strings as required. The select field matches the groupings and metrics. I’ve checked the wrapupCode values exist in the org. The API docs say empty data means no matches, but I know there were calls.

  • I tried removing the filter clause entirely. The response still returns empty data. This suggests the issue might not be the filter logic.
  • I swapped the metrics to conversation.count and groupings to an empty array. Still empty. The count metric in the response header is 0.

I suspect there’s a subtle mismatch in the date format or the metric definition. The wrapupCode.count metric looks correct per the docs. Is there a known issue with the aggregates API returning empty sets for certain metric combinations? Or am I missing a required header for programmatic access? The error isn’t a 4xx, so validation passes. It’s just silent failure.