# Pagination

{% hint style="info" %}
Pagination is currently available only for Operator API  [Get a List of Rewards](/developer-docs/operator-api-reference/freebets-api.md#get-a-list-of-rewards) endpoint.
{% endhint %}

In Hub88 **Operator API**, pagination functionality is provided with cursors. \
Cursor pagination is a method of paginating through large result sets using **encoded cursors** rather than page numbers. It is more efficient than traditional offset-based pagination, particularly for datasets that are frequently updated or high in volume.

For example, instead of requesting page `2` or `3`, you retrieve the **next set of results** by passing a `cursor` token returned to you in the previous response. Parameters used for pagination are: `limit`, `cursor`, `next_cursor` and `previous_cursor`.&#x20;

In short,&#x20;

* cursors are **encoded strings**. You should **not decode or alter them.**
* for pagination requests need to include a `cursor` and `limit` parameters.
* if `next_cursor` is missing from the response, it indicates that there are **no more results.**
* similarly, if `previous_cursor` is absent, you are at the **start of the dataset**.

***

### Request Format

The following fields are supported in the **request body:**

| Field    | Type               | Description                                                                                                                              |
| -------- | ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------- |
| `cursor` | string (optional)  | An encoded string that identifies the position of the last item in the previous page. If omitted, the first page of results is returned. |
| `limit`  | integer (optional) | The number of results per page. Must be between `50` and `100`. Defaults to `50` if lower, and to `100` if higher.                       |

#### Example Request

```json
{
  "cursor": "eyJvZmZzZXQiOjEwMH0=", 
  "limit": 75
}
```

***

### Response Format

The response will include the following pagination metadata:

| Field             | Type    | Description                                                          |
| ----------------- | ------- | -------------------------------------------------------------------- |
| `next_cursor`     | string  | The cursor to retrieve the next page of results.                     |
| `previous_cursor` | string  | The cursor to retrieve the previous page of results (if applicable). |
| `limit`           | integer | The applied limit for the current request.                           |

Use `next_cursor` or `previous_cursor` in subsequent requests to navigate through the dataset.

&#x20;Example response structure

```json
"pagination": {
    "next_cursor": "eyJpZCI6OTAC0wNS0xMFQxMzozMDoyMVoifQ",
    "previous_cursor": "ey09876bhdGVkX2F0IjoiMjAyNC0wNS0xMFQxMzozMDoyMVoifQ",
    "limit": "50"
  }
```

***

### Limit Rules

* Minimum valu&#x65;**:** `50`
* Maximum value: `100`
* If `limit` is **less than 50**, it will be automatically set to **50**.
* If `limit` is **greater than 100**, it will be capped at **100**.

***

### Sample Pagination Flow

1. **Initial request (no cursor):**

   ```json
   "pagination": {
       "limit": "50"
     }
   ```
2. **Next page request structure:**\
   Use the value of `next_cursor` from the previous response:

   <pre class="language-json"><code class="lang-json"><strong>"pagination": {
   </strong>  "cursor": "eyJvZmZzZXQiOjUwMH0=",
     "limit": 50
   }
   </code></pre>
3. **Previous page request structure:**\
   Use the value of  `previous_cursor` from the previous response:

   ```json
   "pagination": {
     "cursor": "eyJvZmZzZXQiOjB9",
     "limit": 50
   }
   ```

***

### Troubleshooting

* **No results returned?** You may have paged beyond the last item. Try using `previous_cursor` instead.
* **Invalid cursor?** Ensure you are using the exact `next_cursor` or `previous_cursor` returned by the API. Do not modify it.
* **Unexpected limit behaviour?** Remember that limits outside the 50–100 range will be automatically adjusted.


---

# 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://docs.hub88.io/developer-docs/hub88-apis/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.
