Analytics API paging loop stuck at pageNumber 1 despite changing pageSize

Trying to export a full set of queue wait time analytics using the REST API. The goal is to get all records for the last 30 days. I’m using the paging object in the request body, but the response always returns the first page. It doesn’t matter what I set pageNumber to. It just resets or ignores it.

Here is the JSON payload I’m sending to /api/v2/analytics/queues/summary:

{
 "pageSize": 50,
 "pageNumber": 2,
 "dateFrom": "2023-10-01T00:00:00.000Z",
 "dateTo": "2023-10-31T23:59:59.999Z",
 "groupBy": "queue",
 "metrics": ["avgWaitTime"],
 "paging": {
 "pageSize": 50,
 "pageNumber": 2
 }
}

The response comes back with pageNumber: 1 in the paging object. The pageCount says there are 5 pages total. But I can’t get to page 2, 3, or 4. I’ve tried setting pageNumber to 100 just to see what happens. Still page 1.

Things I’ve checked:

  • Auth token is valid. GET requests to other endpoints work fine.
  • Date range is correct. The data exists.
  • Tried removing the top-level pageSize and pageNumber and only using the paging object. Same result.
  • Tried increasing pageSize to 500. Still stuck on page 1.

Is the Analytics API ignoring the pageNumber in the body? Or is there a different way to paginate these large result sets? I need to loop through all pages in a script.

Also noticed that the pageCount in the response is sometimes different from what I expect based on the total records. Not sure if that’s related.

The analytics summary endpoint doesn’t support pagination like that. You need to split your dateRange into smaller chunks instead of trying to page through results.