Trying to pull agent state history for the last 24 hours via the CXone Reporting API v2. The endpoint is GET /api/v2/reporting/agents/statistics. I’m passing the date range in the query string, but the response only returns the last 1 hour. Here’s the query:
GET /api/v2/reporting/agents/statistics?dateFrom=2023-10-01T00:00:00.000Z&dateTo=2023-10-01T23:59:59.999Z&interval=PT1H
The response is truncated. Any ideas?
The docs for /api/v2/reporting/agents/statistics specify that the interval parameter controls granularity, not the total fetch window. You’re getting one hour because PT1H is the interval size, but the API might be capping results or your token is expiring mid-request. Actually, the real issue is likely the interval value combined with how the backend paginates. If you want a full day, try PT1M or PT5M to get more data points, then aggregate locally.
Also, check your OAuth token. If it expires before the request completes, you get partial data. The doc says:
“The access token must be valid for the duration of the request.”
Here’s a curl test with a shorter interval:
curl -X GET "https://api.mypurecloud.com/api/v2/reporting/agents/statistics?dateFrom=2023-10-01T00:00:00.000Z&dateTo=2023-10-01T23:59:59.999Z&interval=PT5M" \
-H "Authorization: Bearer YOUR_TOKEN"
If it still cuts off, you’re hitting a rate limit or token refresh issue. Check the X-RateLimit-Remaining header.