Promptles
GTM & Business Tools

Pagination

intermediate

Definition

When an API returns data in pages rather than all at once. If you request a list of 10,000 contacts, the API might return 100 at a time along with a cursor or page token that says 'send this value in your next request to get the next 100.' Your code needs to loop through pages until there are no more results. Forgetting to paginate means you only process the first page and silently miss the rest.

In the wild

HubSpot's contacts API returns 100 contacts per page and includes a 'paging.next.after' value. Your script keeps making requests, passing the 'after' value each time, until the response no longer includes a next page: meaning you have fetched every contact.

More from GTM & Business Tools