# GraphQL cursor pagination method

## Overview

GraphQL cursor pagination is a method for paginating GraphQL APIs.&#x20;

Here, we send a GraphQL query requesting a list of items. This query includes parameters such as the number of items to fetch and any filtering or sorting criteria required. In response, requested items are received, together with cursor information (each item in the response is associated with a cursor, which is typically a unique identifier for that item).&#x20;

{% hint style="info" %}
The GraphQL cursor pagination method was developed for the [Shopify GraphQL API](https://shopify.dev/docs/api/usage/pagination-graphql) however, the same principles apply for other GraphQL systems.
{% endhint %}

## GraphQL cursor options

<table><thead><tr><th width="284">Option</th><th>Summary</th></tr></thead><tbody><tr><td>EndCursor path</td><td><p>Always defined in the following form:<br><br><code>data.</code><mark style="color:red;"><code>{type}</code></mark><code>.pageInfo.endCursor</code><br><br>Here, the <code>{type}</code> element should be replaced with the type  that's defined by the schema - for example: </p><p></p><p><code>data.products.pageInfo.endCursor</code></p></td></tr><tr><td>HasNextPage path</td><td><p>Always defined in the following form:</p><p></p><p><code>data.</code><mark style="color:red;"><code>{type}</code></mark><code>.pageInfo.hasNextPage</code><br><br>Here, the <code>{type}</code> element should be replaced with the type  that's defined by the schema - for example: </p><p></p><p><code>data.products.pageInfo.hasNextPage</code></p><p></p></td></tr></tbody></table>

## GraphQL cursor pagination - endpoint body requirements

The GraphQL cursor pagination method works in conjunction with a query on the endpoint body, which determines required settings. For example:

{% code overflow="wrap" %}
```graphql
{"query":"{products(first: 250, {{pagination_cursor}}) {edges { node { id title } } pageInfo { hasNextPage startCursor endCursor }}}","variables":{}}
```
{% endcode %}

If you need to change the existing query for an endpoint, you should [edit the connector ](../../../../../../connectors-and-instances/working-with-connectors/updating-a-connector)and access [body options](../body) for the required endpoint. &#x20;

## When does pagination stop?

Pagination continues until `hasNextPage`  is returned as `false`.
