Pagination
Navigate through large result sets using cursor-based pagination.
The Admin API uses cursor-based pagination for all list queries. Instead of page numbers, you use opaque cursors to move forward through results — reliable even when data changes between requests.
How it works
Every list query accepts two pagination arguments:
| Argument | Type | Description |
|---|---|---|
first | Int | Number of items to return (default 25) |
after | String | Cursor pointing to the item after which to start |
The response's pageInfo carries the paging metadata, and each edge has a cursor.
First page
query {
products(first: 3) {
edges {
node {
id
name
}
cursor
}
pageInfo {
hasNextPage
endCursor
total
}
}
}Response
{
"data": {
"products": {
"edges": [
{ "node": { "id": "1", "name": "Cotton T-Shirt" }, "cursor": "eyJpZCI6MX0=" },
{ "node": { "id": "2", "name": "Denim Jeans" }, "cursor": "eyJpZCI6Mn0=" },
{ "node": { "id": "3", "name": "Running Shoes" }, "cursor": "eyJpZCI6M30=" }
],
"pageInfo": {
"hasNextPage": true,
"endCursor": "eyJpZCI6M30=",
"total": 128
}
}
}
}Next page
Pass the previous response's endCursor as after:
query {
products(first: 3, after: "eyJpZCI6M30=") {
edges {
node {
id
name
}
}
pageInfo {
hasNextPage
endCursor
}
}
}Loop until hasNextPage is false. Never construct cursors yourself — they're opaque.
Pagination with filters
Filters and pagination compose — keep the filters identical across pages:
query {
products(first: 10, active: yes, after: "eyJpZCI6M30=") {
edges { node { id name } }
pageInfo { hasNextPage endCursor }
}
}The full-walk pattern
after = null
loop:
page = products(first: 100, after: after)
items += page.edges
if !page.pageInfo.hasNextPage: break
after = page.pageInfo.endCursorUse pageInfo.total for progress reporting — it's the total matching count, not the page size.