CXone OData query for agent state history returning empty results

Hey everyone,

I’m trying to pull agent state history for the last 24 hours using the CXone Reporting API v2. I’ve got a Python script that constructs an OData query, but it’s returning an empty dataset even though I know agents were logged in and changing states during that window.

The endpoint I’m hitting is /api/v2/reporting/agents/state-history. I’m passing the start and end timestamps in UTC, filtered by the user ID.

Here’s the request payload I’m sending:

{
 "startDateTime": "2023-10-25T00:00:00Z",
 "endDateTime": "2023-10-26T00:00:00Z",
 "groupBy": "agentId",
 "filter": "agentId eq '12345-6789-0000-0000-000000000000'"
}

The API returns a 200 OK, but the data array is just []. I’ve double-checked the user ID and the time range. Is there a specific granularity or grouping parameter I’m missing? Or maybe the state history data isn’t available for real-time queries in the same way as interaction data?

I’ve also tried removing the filter to see if I get any data for the whole team, but it still comes back empty. Feels like I’m hitting a permission wall or a data retention quirk.

Anyone else wrestled with this? I’ve got the reporting:read scope on my token. Not sure what else to check.