TanqoryDocs

Pagination

Lists in the Admin API come in pages. Ask for a page size, then follow the cursor.

A field that returns many items, such as products or orders, is a connection: it returns one page at a time, and you ask for the next page with a cursor. Connections follow the GraphQL Cursor Connections Specification.

Reading every page of a connection
  1. Your app server → Admin API products(first: 10)
  2. Admin API first is 250 at most If not: an error, invalid_pagination_argument
  3. Admin API → Your app server 10 edges, hasNextPage: true, endCursor
  4. Your app server → Admin API products(first: 10, after: endCursor)
  5. Admin API → Your app server The next 10, hasNextPage: true, a new endCursor
  6. Your app server → Admin API products(first: 10, after: the new endCursor)
  7. Admin API → Your app server The last items, hasNextPage: false
  8. Your app server Stops

Ask for a page

GraphQL
query Products($after: String) {
  products(first: 10, after: $after) {
    edges { node { id title } }
    pageInfo { hasNextPage endCursor }
  }
}
ArgumentMeaning
firstHow many items, counted from the start or from after
afterThe endCursor of the page before; leave it out for the first page
last, beforeThe same backwards, from the end or from before
query, sortKey, reverseFilter and order, where the field offers them; see its page in the reference

The answer:

JSON
{
  "data": {
    "products": {
      "edges": [
        { "node": { "id": "gid://tanqory/Product/01a1dcb0-7022-7580-86b0-ad652431da0b", "title": "Linen Throw" } }
      ],
      "pageInfo": { "hasNextPage": true, "endCursor": "eyJsYXN0X2lkIjoi..." }
    }
  }
}

pageInfo also has hasPreviousPage and startCursor. Each edge can return its own cursor too.

Read every page

While hasNextPage is true, send the same query with after set to the last endCursor:

Node.js
// Node.js 18 or later: every product title, 10 at a time.
const url = `https://api.tanqory.com/admin/2026-10/stores/${process.env.STORE_ID}/graphql`;
const query = `query Products($after: String) {
  products(first: 10, after: $after) {
    edges { node { id title } }
    pageInfo { hasNextPage endCursor }
  }
}`;
let after = null;
do {
  const res = await fetch(url, {
    method: 'POST',
    headers: { Authorization: `Bearer ${process.env.TANQORY_ACCESS_TOKEN}`, 'Content-Type': 'application/json' },
    body: JSON.stringify({ query, variables: { after } }),
  });
  const { data, errors } = await res.json();
  if (errors) throw new Error(errors[0].message);
  for (const { node } of data.products.edges) console.log(node.title);
  after = data.products.pageInfo.hasNextPage ? data.products.pageInfo.endCursor : null;
} while (after);

Both print the title of every product in the store, ten per request.

Good to know

  • Treat a cursor as opaque: store it and send it back, never build or change one.

  • Bigger pages cost more of your rate limit; see Rate limits and query cost. extensions.cost in each answer shows what a page used.

  • To count without reading every page, use a count field where one exists, such as productsCount { count }.

  • first and last take at most 250; more is an invalid_pagination_argument error.

Built from commit c0b3fb3fdef7 · API version 2026-10