CXone Reporting API v2 OData filter for agent state history last 24h

Trying to pull agent state history for the last 24 hours via the CXone Reporting API v2. I need to feed this into my OTel pipeline to correlate trace spans with specific agent availability states. The endpoint is /api/v2/reporting/agents/queues/ranges but I’m struggling with the correct OData syntax for the time window and state filtering.

Here’s the current request structure. The query returns empty results even though I know activity happened.

GET /api/v2/reporting/agents/queues/ranges?interval=PT1H&groupBy=agentId&filter=stateId eq 'READY' and startTime ge 2023-10-27T00:00:00Z

The docs mention using $filter for OData but the syntax for combining time ranges with state IDs isn’t clear. Is there a specific format for the timestamp or a different endpoint that exposes raw state changes instead of aggregated ranges?

You’re hitting the wrong endpoint for state history. Use /api/v2/analytics/agents/queues/ranges and filter by $filter=stateType eq 'agent' and state eq 'available'.