> For the complete documentation index, see [llms.txt](https://docs.one-record.fr/one-record/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.one-record.fr/one-record/about-the-api/pagination.md).

# Pagination

One Record API implements pagination to efficiently manage and navigate through large datasets, ensuring a smooth and scalable experience. Pagination allows applications to fetch subsets of records, making data retrieval more manageable and reducing server load. This document outlines the use of `page[cursor]` and `page[limit]` parameters for pagination in the API requests.

### **Understanding Pagination Parameters**

<details>

<summary><strong><code>page[limit]</code></strong></summary>

This parameter specifies the maximum number of records to return in a single request.

The maximum allowable limit is set to **200** items.&#x20;

Requests attempting to exceed this limit will be automatically adjusted to the maximum allowable value.

</details>

<details>

<summary><strong><code>page[cursor]</code></strong></summary>

This parameter is used to navigate through the records by providing a reference cursor from which the next set of records should be retrieved.

#### Data Retrieval Process

An initial request might not include a cursor parameter, indicating that it is at the beginning of the dataset. The response will include a cursor in the `metadata` object's `next` value. This cursor should be used in subsequent requests to continue retrieving data efficiently. Once last page reached, the `next` value will be `null`.

</details>

### **How to Use Pagination**

* **First Request**: the first request is sent without specifying a `page[cursor]`parameter. The `page[limit]` can be set to retrieve a number of records per page, up to a maximum of 200.
* **Subsequent Requests**: the `next` cursor received in the previous response `metadata` is used to make the next request. It is included in the `page[cursor]` parameter to fetch the next set of data.

### **Example Request without Cursor**

{% tabs %}
{% tab title="GET Limit 100" %}

```
GET /<resource>?page[limit]=100
```

{% endtab %}

{% tab title="Example response" %}

<pre><code><strong>"data": [],
</strong><strong>"metadata": {
</strong>    "count": 100,
    "current": "0190012c-7f90-7c7b-a393-2a20a09485b7",
    "next": "0190012c-7f90-7c7b-a393-2a20a09485b7"
}
</code></pre>

{% endtab %}
{% endtabs %}

This request fetches the first 100 records based on `page[limit]` parameter. The response will include a cursor in the `metadata.next` value for fetching the next 100 records.

### Example Request with Cursor

{% tabs %}
{% tab title="GET with Cursor" %}

```
GET /<resource>?page[limit]=100&page[cursor]=<cursor_value>
```

{% endtab %}

{% tab title="Example response" %}

```
"data": [],
"metadata": {
    "count": 100,
    "current": "0190012c-7f90-7c7b-a393-2a20a09485b7",
    "next": "0190012c-7f90-7c7b-a393-2a20a09485b7"
}
```

{% endtab %}
{% endtabs %}

Following the initial request, the subsequent 100 records can be retrieved by utilizing both the `page[limit]` parameter and the `page[cursor]` parameter with the value of `metadata.next` obtained from the previous response. Once the last page is reached, the value of `next` in `metadata` will be `null`.
