How-to guides
Paginate through results
Fetch every item from a list field using first, after and pageInfo.
List fields such as restaurants return a …Page type with edges and pageInfo.
Fetch the first page
query {
restaurants(first: 25) {
edges { cursor node { id } }
pageInfo { hasNextPage endCursor }
}
}Fetch the next page
Pass pageInfo.endCursor as after:
query Next($after: String) {
restaurants(first: 25, after: $after) {
edges { node { id } }
pageInfo { hasNextPage endCursor }
}
}Repeat until hasNextPage is false.
Tip
Keep page sizes moderate and only select the fields you need — smaller responses are faster.