CXone Reporting API: Filtering agent state history by timestamp

Hey everyone,

I’m trying to pull agent state history for the last 24 hours using the CXone Reporting API (v2). I need to get a list of agents who were in the “Ready” state for more than 10 minutes total.

I’m hitting the /api/v2/reporting/agents/statistics endpoint with a POST request. The documentation says I can use OData filters, but I’m struggling to get the time window right. I want to filter by the start_time of the state history records.

Here’s my current payload:

{
 "interval": "PT1H",
 "group_by": ["agent_id"],
 "filter": {
 "type": "and",
 "conditions": [
 {
 "field": "start_time",
 "op": "gte",
 "value": "2023-10-27T14:00:00Z"
 },
 {
 "field": "start_time",
 "op": "lte",
 "value": "2023-10-28T14:00:00Z"
 }
 ]
 }
}

The API returns a 200 OK, but the data doesn’t seem to respect the start_time filter. I’m getting records from way outside that window. It feels like the start_time field isn’t queryable in the filter object for this endpoint.

Is there a different endpoint for historical state data? Or am I missing a specific OData syntax for time ranges? I’ve tried using startTime (camelCase) too, but that just throws a 400 Bad Request saying the field doesn’t exist.

Any pointers would be great.