Pagination
On this page
How TNID list queries page: plain lists with limit, cursor-paginated twins with paginationInfo and nextCursor, and page-number lists for 10DLC.
TNID has three list shapes. Pick by name.
Plain lists: limit
Queries such as b2bConnections, spamReports, companies and users take a limit and return a plain array. They are fine for small result sets and for the examples in this guide. There is no way to fetch the next batch.
Cursor lists: paginated… queries
Every list that can grow has a cursor-paginated twin whose name starts with paginated, for example paginatedB2bConnections, paginatedSpamReports, paginatedReceivedC2cConnectionRequests, paginatedUserGroups, paginatedClientSecrets and paginatedSentimentAnalysisResults. Documents, forms, AI tasks and group members are cursor-paginated by default.
They take limit and cursor and return paginationInfo plus records:
query ($limit: Int, $cursor: String) {
paginatedB2bConnections(limit: $limit, cursor: $cursor) {
paginationInfo {
limit
nextCursor
}
records {
id
type
connectedCompany {
id
legalName
}
}
}
}
First call with {"limit": 50}. Each response carries paginationInfo.nextCursor; pass it back as cursor to get the next page. When nextCursor is null you have everything. The default limit is 20.
cursor = None
while True:
page = client.execute(query, {"limit": 50, "cursor": cursor})["paginatedB2bConnections"]
for record in page["records"]:
handle(record)
cursor = page["paginationInfo"]["nextCursor"]
if cursor is None:
break
Cursors are opaque strings. Do not store them across sessions or build them by hand; restart from the first page instead.
Page-number lists: 10DLC
tenDlcBrands and tenDlcCampaigns use page and pageSize and return page, totalRecords and records. Increment page until page * pageSize >= totalRecords. See 10DLC Brands.
Finding the paginated variant
The API Reference lists each plain query next to its paginated twin, and the Queries definition page shows every argument.