We’re hitting a wall trying to pull live queue metrics for our dashboard. The goal is simple: show the number of people waiting and agents available in real-time. I’m using the GET /api/v2/analytics/queues/realtime endpoint as documented, but the waiting count always comes back as zero, even when I can see calls stacking up in the PureCloud UI.
Here’s the request setup. I’m passing the date_from and date_to parameters to define a 1-minute window for the current time. The timestamp format looks right based on the docs.
import requests
import jwt
from datetime import datetime, timedelta
# ... auth token generation omitted ...
headers = {
'Authorization': f'Bearer {token}',
'Content-Type': 'application/json'
}
now = datetime.utcnow()
window_start = (now - timedelta(minutes=1)).strftime('%Y-%m-%dT%H:%M:%S.000Z')
window_end = now.strftime('%Y-%m-%dT%H:%M:%S.000Z')
params = {
'date_from': window_start,
'date_to': window_end,
'group_by': 'QUEUE'
}
response = requests.get('https://api.mypurecloud.com/api/v2/analytics/queues/realtime', headers=headers, params=params)
print(response.json())
The response structure is valid JSON, no 4xx or 5xx errors. It returns a list of queues. But inside the metrics object, waiting is consistently 0. The agents_available seems to fluctuate correctly.
I’ve double-checked the queue ID. I’m also trying the GET /api/v2/queues endpoint to get the current state, but that only gives me the queue definition, not the live stats.
Is there a specific interval parameter I need to set for the realtime endpoint? The docs mention interval but don’t give examples for the realtime specific path. Or is this API just meant for historical data and I’m looking in the wrong place for live stats?
I’ve tried changing the group_by to NONE but that just aggregates everything. We need per-queue data. Any ideas why the waiting count is flatlining?