Hey everyone,
Trying to pull real-time queue statistics for a custom dashboard widget. The goal is to get current wait times and agent availability without relying on the standard UI components.
I’m hitting the CXone Reporting API endpoint:
GET /api/v2/analytics/reporting/queue-stats/real-time
The authentication seems fine. I’m using a service account with the analytics:reports:read scope. Basic queries work, but when I add the queueIds filter, the response comes back as a 500 Internal Server Error.
Here is the request payload I’m sending:
{
"interval": "now-1h",
"groupBy": ["queueId"],
"select": ["queueId", "averageWaitTime", "agentsLoggedin"],
"where": [
{
"dimension": "queueId",
"operator": "in",
"value": ["queue-uuid-1", "queue-uuid-2"]
}
]
}
I’ve double-checked the queue UUIDs. They are valid. I also tried removing the where clause to get all queues, which returns a 200 OK. The error only happens when filtering.
Is there a limit on the number of queue IDs in the in operator? Or is the interval format wrong for real-time data? The docs are a bit sparse on this specific combination.
Any ideas?
You’re hitting that 500 because the endpoint is choking on the query structure, not the auth. Real-time queue stats are sensitive to how you format the groupBy and select parameters. If you send a malformed JSON body or miss a required field in the query object, the backend throws a generic internal error instead of a helpful 400.
Try switching to a POST request with a strict JSON payload. It’s way more reliable than chaining query params for complex filters. Also, double-check that your service account has the analytics:reports:read scope, but more importantly, ensure it has permission to view the specific queues you’re querying.
Here’s a working curl example that usually clears this up:
curl -X POST "https://api.mynice.com/api/v2/analytics/reporting/queue-stats/real-time" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"interval": "PT1H",
"select": [
{ "name": "queue.id", "type": "id" },
{ "name": "queue.name", "type": "string" },
{ "name": "queue.queued", "type": "number" },
{ "name": "queue.wait", "type": "number" }
],
"groupBy": ["queue.id"],
"where": [
{
"field": "queue.id",
"op": "eq",
"value": "YOUR_QUEUE_ID_HERE"
}
]
}'
If that still 500s, check the response headers. Sometimes it’s a backend timeout if you’re querying too many queues at once. Break it down into smaller batches.