Working on a distributed tracing bridge between our Python backend and NICE CXone. I’m trying to map agent states to OpenTelemetry spans for latency analysis.
The issue is that GET /agents/states returns an empty array [] even when I can see the agent logged in via the CXone UI.
Here’s the flow:
- Get OAuth token via client credentials.
- Call
GET /api/v2/agents/states.
Response:
[]
Status code 200. No errors. Just empty.
I’ve verified the token is valid by calling GET /api/v2/users/me which returns user details correctly. The user ID matches the agent ID I’m querying.
I’m using the Python SDK nice_cxone.api.agents_api.
from nice_cxone.api.agents_api import AgentsApi
agents_api = AgentsApi(configuration)
result = agents_api.get_agents_states()
print(result.body) # Returns []
I also tried the raw HTTP request:
import requests
headers = {
'Authorization': f'Bearer {access_token}',
'Accept': 'application/json'
}
response = requests.get('https://api.cxone.com/api/v2/agents/states', headers=headers)
print(response.json()) # Returns []
I’ve checked the following:
- Agent is logged in.
- Agent is available (not on break).
- Token has
agent:readscope. - User ID is correct.
Is there a specific permission I’m missing? Or is this endpoint restricted to certain orgs?
I need this data to correlate agent availability with call wait times in my tracing pipeline. If I can’t get the state, I can’t build the span context properly.