# Page number parameter pagination method

## Overview

In this method, the required page number is included as a parameter in the API request, and is incremented in each request to get the next page. &#x20;

## Page number parameter options

<table><thead><tr><th width="284">Option</th><th>Summary</th></tr></thead><tbody><tr><td>Limit parameter name</td><td>Enter the name of the query parameter to be passed into the URL to tell the receiving system the maximum number of items that the API should return in a single page of a paginated response. A commonly used name is: <code>limit</code> but <code>total</code> or <code>count</code> are also popular.</td></tr><tr><td>Limit parameter path</td><td>Enter the dot notation path to the limit parameter name.</td></tr><tr><td>Page parameter name</td><td>Enter the name of the query parameter to be passed into the URL to tell the receiving system the required page number. A commonly used name is: <code>page</code>.</td></tr><tr><td>Limit</td><td>Enter the number of items to be returned per page. For example: <code>10</code>.</td></tr><tr><td>Path to the data in the response</td><td>If required, you can add a dot notation path to an element in the payload that you would expect to contain data if the data pull has not completed. For example, if you are pulling orders, you might expect to see data in an <code>orders</code> element of the response. <br><br>This is a 'belts and braces' option to handle edge cases where a system continues to send data of some type, even when there is no more required data to be pulled - so pagination would never stop. If you don't want to use this option, click the <strong>allow empty</strong> button.</td></tr></tbody></table>

## Example

Suppose we set the following options:

<table><thead><tr><th width="284">Option</th><th>Value</th></tr></thead><tbody><tr><td>Limit parameter name</td><td><code>limit</code></td></tr><tr><td>Page parameter name</td><td><code>page</code></td></tr><tr><td>Limit</td><td><code>10</code></td></tr><tr><td>Path to the data in the response</td><td><code>data</code></td></tr></tbody></table>

...and we send a request to get the first page of data:

{% code lineNumbers="true" %}

```
GET https://my.shop/api/customers?limit=10&page=1
```

{% endcode %}

The response will include the first page of data (sometimes with metadata regarding pagination). For example:

{% code lineNumbers="true" %}

```json
{
  "data": [
    {"id": 1, "name": "Alice"},
    {"id": 2, "name": "Bob"},
    {"id": 3, "name": "Charlie"},
    {"id": 4, "name": "Lyn"},
    {"id": 5, "name": "John"},
    {"id": 6, "name": "Gordon"},
    {"id": 7, "name": "Izzy"},
    {"id": 8, "name": "Mike"},
    {"id": 9, "name": "Ralph"},
    {"id": 10, "name": "Rex"}
  ],
  "meta": {
    "totalItems": "150",
    "itemsPerPage": "10"
  }
}
```

{% endcode %}

Our request for the next page of results would be:

{% code lineNumbers="true" %}

```
GET https://my.shop/api/customers?limit=10&page=2
```

{% endcode %}

## When does pagination stop?

Pagination continues until the last page, when there is no more data to return.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://doc.wearepatchworks.com/product-documentation/developer-hub/connector-builder/building-your-own-connector/4-endpoints/endpoint-options/pagination/page-number-parameter-pagination-method.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
