# Pagination

Some API endpoints return large datasets. To ensure efficient and manageable responses, these endpoints support **cursor-based pagination**. This allows clients to retrieve results in chunks and navigate through pages as needed. The response data includes a `meta` object that contains **pagination-specific metadata**.

### Pagination Parameters

Below is a list of **optional** request parameters to control pagination of the response data.

<table><thead><tr><th width="167.7427978515625">Parameter</th><th width="130.17144775390625">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>cursor</code></td><td>string</td><td>If the <code>meta</code> object contains a <code>next_cursor</code> field, it indicates that more records are available. To fetch the next set of records, include the <code>cursor</code> parameter in your request with the value of <code>next_cursor</code>. If the <code>next_cursor</code> field is not present, it means there are no more records to retrieve.</td></tr><tr><td><code>limit</code></td><td>integer</td><td>This parameter allows you to override the default limit of records returned, up to the <code>max_allowed_limit</code> specified in the response's <code>meta</code> object.</td></tr><tr><td><code>reverse_order</code></td><td>boolean</td><td>This parameter can be used to reverse the order in which the data is returned, useful for fetching the latest records first.</td></tr></tbody></table>

### Response Example

```json
{
    "data": [
        ...
    ],
    "meta": {
        "limit": 10,
        "max_allowed_limit": 50,
        "next_cursor": "eyJpZCI6MTA4MDMsIl9iYWNrd2FyZCI6ZmFsc2V9"
    }
}
```

* `limit` - The **default** number of records returned.
* `max_allowed_limit` - The **maximum** allowed limit of records per page.
* `next_cursor` - The token to use for retrieving the **next set** of records (see cursor request parameter).

{% hint style="info" %}
The `next_cursor` field will indicate **if there are more records** to return. If not, the field will not be included in the response metadata.
{% endhint %}

### Example Request

<mark style="color:blue;">`GET`</mark> `/v2/finplus/debtmanagement/financialtransactions?reverse_order=1&limit=100`

#### **Fetching the Next Page**

<mark style="color:blue;">`GET`</mark> `/v2/finplus/debtmanagement/financialtransactions?reverse_order=1&cursor=abc123&limit=100`


---

# 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://apidocs.d6plus.co.za/v2/getting-started/pagination.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.
