Auto-pagination
List methods in the Telnyx API are paginated. You can use thefor await … of syntax to iterate through items across all pages:
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Check out our upcoming events and meetups! View events →
Iterate through paginated Telnyx API list results with the Node.js SDK’s auto-pagination helpers.
for await … of syntax to iterate through items across all pages:
async function fetchAllAccessIPAddressResponses(params) {
const allAccessIPAddressResponses = [];
// Automatically fetches more pages as needed.
for await (const accessIPAddressResponse of client.accessIPAddress.list({
'page[number]': 1,
'page[size]': 50,
})) {
allAccessIPAddressResponses.push(accessIPAddressResponse);
}
return allAccessIPAddressResponses;
}
let page = await client.accessIPAddress.list({ 'page[number]': 1, 'page[size]': 50 });
for (const accessIPAddressResponse of page.data) {
console.log(accessIPAddressResponse);
}
// Convenience methods are provided for manually paginating:
while (page.hasNextPage()) {
page = await page.getNextPage();
// ...
}
Was this page helpful?