Efficiently retrieve large sets of data
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.
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.nextToken
as an opaque identifier that’s only used to retrieve the next items in a list and not for other programmatic purposes.nextToken
should not be persisted as it’s only valid for the given pagination.For your first request, you typically only need to specify the pageSize
:
The response will include a nextToken
if there are more results available. Use this token in your next request to retrieve the next page:
Continue using the nextToken
from each response until you receive a response without a nextToken
, indicating you’ve reached the end of the results.
A paginated response will have the following structure:
pageSize
consistent between requests for predictable behavior.nextToken
, you’ve reached the end of the results.nextToken
might become invalid.pageSize
is 100 items.Setting a very large pageSize
may impact API performance and response times. We recommend using a moderate page size and iterating through results as needed.
Efficiently retrieve large sets of data
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.
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.nextToken
as an opaque identifier that’s only used to retrieve the next items in a list and not for other programmatic purposes.nextToken
should not be persisted as it’s only valid for the given pagination.For your first request, you typically only need to specify the pageSize
:
The response will include a nextToken
if there are more results available. Use this token in your next request to retrieve the next page:
Continue using the nextToken
from each response until you receive a response without a nextToken
, indicating you’ve reached the end of the results.
A paginated response will have the following structure:
pageSize
consistent between requests for predictable behavior.nextToken
, you’ve reached the end of the results.nextToken
might become invalid.pageSize
is 100 items.Setting a very large pageSize
may impact API performance and response times. We recommend using a moderate page size and iterating through results as needed.