GET /agents/states returns empty array for active agent

I’m trying to pull real-time agent state data for my WFM adherence script. The agent is definitely logged in and taking calls. I can see the green dot in the dashboard. But when I hit the API, I get nothing.

Here is the call:

GET /api/v2/analytics/agents/12345678-1234-1234-1234-123456789012/status

The response is a 200 OK, but the sessions array is empty.

{
 "userId": "12345678-1234-1234-1234-123456789012",
 "sessions": []
}

I’ve checked the OAuth token. It has analytics:read scope. The agent ID is correct. I copied it from the URL of the agent profile page.

Is there a delay in the API? Or do I need a different scope to see the actual state? I tried adding interaction:read but that didn’t change anything.

Also, I noticed the documentation says this endpoint might return empty if the agent is in a queue that isn’t monitored. We are using custom queues. Could that be it?

Here is the Python snippet I am using to verify the token and make the call:

from genesyscloud import api_client, analytics_api

client = api_client.ApiClient(configuration)
analytics = analytics_api.AnalyticsApi(client)

try:
 resp = analytics.get_analytics_agents_user_id_status(
 user_id="12345678-1234-1234-1234-123456789012"
 )
 print(resp.sessions)
except Exception as e:
 print(e)

Nothing in the logs. Just empty list.