CXone Reporting API: Filtering agent state history for last 24 hours with OData

I’m building a custom dashboard component using the Embeddable Client App SDK that needs to show an agent’s state changes over the past 24 hours. The goal is to replicate the ‘Agent State History’ view but with a custom UI layer. I’m hitting the /api/v2/analytics/details/agents endpoint, which seems to be the right place for this data.

The tricky part is constructing the OData query string to filter by time and specific agent states correctly. I want to avoid pulling massive datasets and filtering client-side, so I’m trying to push as much logic as possible to the server via the $filter parameter. My current attempt looks like this:

GET /api/v2/analytics/details/agents?interval=PT1H&dateTo=2023-10-27T10:00:00.000Z&dateFrom=2023-10-26T10:00:00.000Z&$filter=agentState eq 'Ready'

The response comes back, but it feels sparse. I’m getting aggregated counts per interval, not the granular state transitions I need for a timeline view. I’ve tried adding groupBy=agentState to see if that breaks it down further, but the result is still just a sum of time in state, not the sequence of changes.

Is there a way to query the actual state change events rather than the aggregated analytics data? Or am I stuck using the /api/v2/analytics/details/agents endpoint and having to reconstruct the timeline by comparing intervals? The documentation is a bit vague on whether this endpoint supports event-level granularity or if it’s strictly for aggregated reporting.

Also, the SDK doesn’t seem to have a specific method for this, so I’m making raw HTTP calls through the client’s API wrapper. If I’m on the wrong endpoint, what’s the alternative? I don’t want to poll the conversation history API since that doesn’t capture idle states or breaks effectively.