Cursor vs Page for /api/v2/analytics/conversations/details/query

Trying to pull full conversation details for a QA review period. The docs say this endpoint supports both page and cursor pagination. Which one is actually stable for this specific query?

I started with page-based because it’s easier to reason about in a loop. It works fine for the first 100 records. Then I hit the next page and the data looks shuffled. Not sorted by timestamp like I expected.

Here is the request body:

{
 "dateFrom": "2023-10-01T00:00:00.000Z",
 "dateTo": "2023-10-02T00:00:00.000Z",
 "groupBy": ["conversationId"],
 "filter": [{"type": "equals", "path": "wrapupCode", "value": "QA-Review"}]
}

I set page=2 in the query params. The response comes back with 100 items but the conversationIds are different from what I saw in the first batch. It feels like the underlying index shifted between calls.

If I switch to cursor, do I just grab the nextPage.cursor value and pass it in the next request? The documentation is vague on whether cursor handles the sorting stability better than page numbers.

Also, is there a hard limit on how many pages I can chain before the gateway drops the connection? I’m seeing 504s after about 15 sequential calls. Is that a timeout issue or am I hammering the API too hard?

Drop the page param entirely. It’s unstable for large datasets because the underlying query can shift between requests. Use cursor-based pagination instead. You’ll get a nextPageCursor in the response. Pass that back into your next request to keep the stream consistent. No shuffling.

val response = client.analyticsApi.postAnalyticsConversationsDetailsQuery(queryBody)
val cursor = response.nextPageCursor