Organization / Guides

Pagination

Page through long lists with cursors.

Forward pagination

Request first items and retain endCursor. On the next request, pass it asafter. Continue while hasNextPage is true.

query Orders($first: Int!, $after: String) {
orders(first: $first, after: $after) {
edges {
cursor
node { id reference }
}
pageInfo { hasNextPage endCursor }
}
}

Connection arguments

firstNumber of items to fetch forward
afterReturn items after this cursor
lastNumber of items to fetch backward
beforeReturn items before this cursor

Supply first or last; the maximum page size is 250. Cursors are opaque: pass them back as you received them.