Posta uses cursor-based pagination for endpoints that return lists of objects. This guide explains how to work with paginated responses and retrieve large datasets efficiently.Documentation Index
Fetch the complete documentation index at: https://docs.posta.co/llms.txt
Use this file to discover all available pages before exploring further.
How pagination works
When you make a request to an endpoint that returns multiple objects, you can control the number of items returned and navigate through pages using two parameters:pageSize: The number of items to return per page.nextToken: A cursor for the next page of results.
- Treat
nextTokenas an opaque identifier that’s only used to retrieve the next items in a list and not for other programmatic purposes. nextTokenshould not be persisted as it’s only valid for the given pagination.
Using pagination
Initial request
For your first request, you typically only need to specify thepageSize:
Subsequent requests
The response will include anextToken if there are more results available. Use this token in your next request to retrieve the next page:
nextToken from each response until you receive a response without a nextToken, indicating you’ve reached the end of the results.
Response format
A paginated response will have the following structure:Best practices
- Consistent page size: Keep the
pageSizeconsistent between requests for predictable behavior. - Handle missing tokens: If a response doesn’t include a
nextToken, you’ve reached the end of the results. - Error handling: Implement proper error handling for cases where a
nextTokenmight become invalid. - Iterate efficiently: Use a loop or recursive function to automatically fetch all pages when needed.
Limitations
- The maximum
pageSizeis 100 items.