# Limit-offset pagination method

## Overview

This method is similar to the [page number parameter](/product-documentation/developer-hub/connector-builder/building-your-own-connector/4-endpoints/endpoint-options/pagination/page-number-parameter-pagination-method.md) approach. However, instead of appending a page number to the request URL, an offset parameter is used to indicate how many results have been returned so far (i.e. the start point for required data).&#x20;

This method is rather like a database search: *give me 5 records starting from the 15th record*.

## Limit-offset options

<table><thead><tr><th width="284">Option</th><th>Summary</th></tr></thead><tbody><tr><td>Limit parameter path</td><td>Enter the dot notation path for the data element in your response which contains the maximum number of items that the API should return in a single page of a paginated response. Commonly (though not necessarily), this would be a path to a <code>limit</code> field.   </td></tr><tr><td>Offset parameter path</td><td>Enter the dot notation path for the data element in your response which contains the required offset - i.e. how many items should be skipped before the next page starts. Commonly (though not necessarily), this would be a path to a <code>page</code> field.   </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>Count parameter path</td><td>If required, enter the dot notation path for the data element in your response which contains the current count of records that have come back from the system. Commonly (though not necessarily), this would be a path to a <code>count</code> field. This value is not required for some APIs, therefore it's an optional field.    </td></tr><tr><td>Total parameter path</td><td>Enter the dot notation path for the data element in your response which contains the total number of records that will be returned in this response, so we know when to stop paginating. Commonly (though not necessarily), this would be a path to a <code>total</code> field. This value is not required for some APIs, therefore it's an optional field.    </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 path</td><td><code>limit</code></td></tr><tr><td>Offset parameter path</td><td><code>offset</code></td></tr><tr><td>Limit</td><td><code>5</code></td></tr><tr><td>Count parameter path</td><td><code>meta.count</code></td></tr><tr><td>Total parameter path</td><td><code>meta.total</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=5&offset=0
```

{% endcode %}

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

{% code lineNumbers="true" %}

```json
{
  "data": [
    {"name": "Gordon"},
    {"name": "Izzy"},
    {"name": "Mike"},
    {"name": "Ralph"},
    {"name": "Rex"}
  ],
  "meta": {
    "total": 50,
    "count": 5,
    "limit": 5,
    "offset": 5
  }
}
```

{% endcode %}

Requests for subsequent pages would increment the `offset` value by the `limit` value - for example:

{% code lineNumbers="true" %}

```
GET https://my.shop/api/customers??limit=5&offset=5
```

{% endcode %}

...and then:

{% code lineNumbers="true" %}

```
GET https://my.shop/api/customers??limit=5&offset=10
```

{% endcode %}

...and so on until 50 items (i.e. the `total parameter path value`) are returned.

## 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/limit-offset-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.
