# API Pagination

Some endpoints in the TRADE API support **page-based pagination**, allowing you to retrieve large datasets in smaller, more manageable chunks.\
This helps optimize performance and reduce the load on both client and server sides.

> ⚠️ **Important:**\
> Pagination is only available for endpoints that are explicitly defined with pagination in the API specification.\
> Currently, this applies to:\
> [**`POST /Participants/Get`**](/u/trade/integration/apis/metadata.md#post-participants-get)

### **Pagination Parameters**

#### **1. Page**

Specifies **which page of results** to retrieve.

* The count starts at **1**.
* Each page contains a defined number of participants according to the `PageSize` value.
* If the page number exceeds the total number of pages, an empty result set will be returned.

**Limits:**

* **Minimum:** 1
* **Maximum:** 2147483647
* **Default:** 1

#### **2. PageSize**

Defines **how many participants** are returned per page.\
Choosing the right page size helps you balance between data load and performance.

**Limits:**

* **Minimum:** 1
* **Maximum:** 1000
* **Default:** 100

### **Example Usage**

| Use Case                                    | Parameters                 | Description                                       |
| ------------------------------------------- | -------------------------- | ------------------------------------------------- |
| Retrieve the first 100 participants         | `Page = 1, PageSize = 100` | Gets the first set of results                     |
| Retrieve the next 100 participants          | `Page = 2, PageSize = 100` | Gets the second batch of results                  |
| Retrieve a smaller batch of 50 participants | `Page = 1, PageSize = 50`  | Useful for quick testing or partial data requests |

### **How to Retrieve All Results**

If you need to retrieve all participants:

1. Start with `Page = 1`.
2. Check the number of records returned.
3. If it equals your `PageSize`, increment the `Page` value and send another request.
4. Continue until the returned dataset is empty or smaller than your `PageSize`.

This ensures you systematically retrieve all available data without overloading your system.

### **Best Practices**

* Always specify both `Page` and `PageSize` in your request body.
* Use moderate `PageSize` values for better response times.
* Avoid requesting extremely large pages to prevent timeouts.


---

# 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.lsports.eu/u/trade/integration/apis/api-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.
