Trying to build a custom interval report for our agent desktop using the Analytics Conversations Aggregates endpoint. The goal is to pull conversation metrics in 15-minute chunks for the last 24 hours so we can visualize real-time load.
I’ve been messing with the query payload for a bit. The request hits POST /api/v2/analytics/conversations/aggregates but consistently returns a 400 Bad Request. The error message is vague, just saying invalid_query.
Here’s the JSON body I’m sending:
{
"interval": "PT15M",
"groupBy": [
"conversation.type"
],
"select": [
{
"name": "totalDuration",
"type": "sum"
},
{
"name": "count",
"type": "count"
}
],
"timeRange": {
"from": "2023-10-26T00:00:00.000Z",
"to": "2023-10-27T00:00:00.000Z"
}
}
The docs say interval should be an ISO 8601 duration. PT15M looks right. I tried changing it to PT1H just to test and it worked fine. But anything under an hour seems to break it. I also tried adding "timeUnit": "minutes" but that field doesn’t seem to exist in the schema.
Am I missing a required parameter for sub-hour intervals? Or is there a limit on the granularity for this specific endpoint? The SDK wrapper analyticsApi.postAnalyticsConversationsAggregates throws the same error, so it’s not a client-side issue.
Checked the logs. Nothing helpful there either.