Getting 400 Bad Request on /api/v2/analytics/queues/realtime with Python SDK

Hey folks,

Trying to pull real-time queue stats for our WFM dashboard. Specifically need the waiting count and agents available for a specific queue. I’m using the Python SDK (genesyscloud).

Here’s the snippet:

from genesyscloud import analytics_api

api_instance = analytics_api.AnalyticsApi(api_client)
queue_id = 'my-queue-id-here'
try:
 result = api_instance.get_queue_realtime_statistics(queue_id=queue_id)
 print(result)
except Exception as e:
 print("Exception: %s\n" % e)

The error I’m getting is:

400 Bad Request: Invalid queueId format

I’ve double-checked the ID. It works fine in the Genesys Cloud UI. Also works when I hit /api/v2/queues/{queueId} directly. Is there a specific format needed for the realtime stats endpoint? Or maybe I’m missing a parameter?

Also, the docs mention a group_by parameter but it seems optional. I’m not using it. Just want the raw queue stats.

Any ideas? I’ve been stuck on this for an hour. Need this data for a live adherence view we’re building. Thanks in advance.

Missing the divisionId parameter usually triggers that 400. The SDK defaults to null which breaks the query. Also, double check the view param. It needs to be set to REALTIME explicitly.

result = api_instance.get_queue_realtime_statistics(
 queue_id=queue_id,
 division_id='your-division-id',
 view='REALTIME'
)