Genesys Analytics API pagination getting stuck on cursor

We’ve been trying to export a full month’s worth of conversation details for our compliance logs, and the pagination logic seems completely broken. The endpoint is /api/v2/analytics/conversations/details/query. I’m writing a simple Python script to handle the fetch since we need to process the JSON locally before sending it to our archive. The first request works fine, returning 100 records and a nextPage cursor in the response headers. I pass that cursor into the next request, and it returns another 100 records. But after about three or four pages, the API stops giving me a new cursor. The nextPage header is just gone. The body still has data, but I can’t tell if it’s the last page or if the connection just dropped.

Here is the loop I’m using. It feels standard enough, but maybe I’m missing a specific header requirement for the analytics endpoint compared to the routing APIs I usually touch.

import requests

url = "https://api.mypurecloud.com/api/v2/analytics/conversations/details/query"
headers = {
 "Authorization": f"Bearer {token}",
 "Content-Type": "application/json"
}

payload = {
 "dateRange": {
 "startDate": "2023-10-01T00:00:00.000Z",
 "endDate": "2023-10-02T00:00:00.000Z"
 },
 "viewId": "conversation-details-default"
}

all_data = []
cursor = None

while True:
 if cursor:
 headers["X-Genesys-Page-Cursor"] = cursor
 else:
 headers.pop("X-Genesys-Page-Cursor", None)

 response = requests.post(url, json=payload, headers=headers)
 data = response.json()
 
 if not data.get("data"):
 break
 
 all_data.extend(data["data"])
 cursor = response.headers.get("nextPage")
 
 if not cursor:
 print("No more cursor. Stopping.")
 break

The script exits cleanly, but I’m only getting 400 records when I know there are thousands in that window. Is there a max page limit for this specific endpoint? Or does the cursor expire after a certain time? I tried adding a page parameter instead, but the docs say analytics uses cursors. It’s confusing why it just cuts off. I’ve checked the status codes and they are all 200 OK. Nothing in the logs either. Just silence from the API after a few pages.