I’m trying to build a custom interval report via the Analytics API to pull conversation aggregates. The goal is to correlate these metrics with our OpenTelemetry traces, so I need the traceId included in the response payload.
I’m hitting POST /api/v2/analytics/conversations/aggregates with a query that looks structurally identical to what the reporting UI generates, but the traceId field is completely missing from the returned records.
Here’s the JSON payload I’m sending:
{
"dateFrom": "2023-10-01T00:00:00.000Z",
"dateTo": "2023-10-02T00:00:00.000Z",
"interval": "PT1H",
"metrics": [
"handledCount",
"avgHandleTime"
],
"groupings": [
{"dimension": "traceId", "limit": 100}
],
"queryFilter": {
"type": "and",
"predicates": [
{
"dimension": "conversationType",
"operator": "eq",
"value": "voice"
}
]
}
}
The API returns a 200 OK, no validation errors. The response has the standard structure with records, but inside each record object, there’s no traceId key. It just has metricValues and the handledCount/avgHandleTime data.
I’ve double checked that the conversations in this date range actually have traceIds attached (I can see them in the conversation detail logs). I’m using a standard OAuth token with analytics:view scope.
Is traceId a reserved dimension that can’t be used in aggregations? Or am I missing a specific flag in the query body to force the inclusion of custom metadata fields?
I’ve tried adding traceId to the metrics array as well, but that just throws a 400 Bad Request saying it’s not a valid metric.