/api/v2/analytics/conversations/details/query pagination: cursor vs page behavior in Node SDK

It’s 2 AM here, brain is fried. We’re trying to pull a massive chunk of conversation details for a custom retention job. The Node.js SDK seems to be fighting us on the pagination logic for /api/v2/analytics/conversations/details/query.

Documentation mentions nextPageToken for cursor-based pagination, but the SDK method queryConversationDetails keeps expecting a page parameter if we don’t pass a token. Or it just loops infinitely.

Here’s the setup:

const response = await client.analytics.queryConversationDetails({
 body: {
 dateFrom: '2023-10-01T00:00:00.000Z',
 dateTo: '2023-10-02T00:00:00.000Z',
 pageSize: 100
 },
 cursor: nextPageToken // Trying to use cursor here
});

The response comes back with pagination object, but nextPageToken is null after the first page even though we know there’s more data. total says 5000 records.

We’re seeing this in the logs:
Received 100 records. nextPageToken is undefined. Retrying with page=2...

If we switch to page: 2, the API throws a 400 Bad Request saying cursor is required for this view. It’s confusing because the analytics summary endpoints work fine with page numbers, but details seem locked to cursors.

Does the SDK actually support the cursor pattern for details queries, or do we need to roll our own HTTP client to handle the nextPageToken extraction manually? The request object in the SDK doesn’t expose the raw cursor string easily, and we don’t want to parse the URL manually.

Also, the dateTo field seems to shift if we pass the wrong format. JSON looks correct though.

{
 "pagination": {
 "nextPageToken": null,
 "total": 5000,
 "count": 100
 }
}

Just stuck on the token extraction now.