> ## Documentation Index
> Fetch the complete documentation index at: https://qwady.wiki/llms.txt
> Use this file to discover all available pages before exploring further.

# Pagination

> Page-based pagination with navigation links

## Overview

Borough uses page-based pagination. Pages are **1-indexed** (first page is `page=1`).

## Parameters

| Parameter | Type    | Default | Description                            |
| --------- | ------- | ------- | -------------------------------------- |
| `page`    | integer | 1       | Page number (1-indexed)                |
| `perPage` | integer | 10      | Results per page (max depends on tier) |

Pass an explicit `perPage` (up to your tier max) for larger pages.

## Response metadata

```json theme={null}
{
  "data": [...],
  "meta": {
    "total": 342,
    "page": 2,
    "perPage": 50,
    "links": {
      "self": "https://borough.qwady.app/v1/search/rentals?page=2&perPage=50",
      "first": "https://borough.qwady.app/v1/search/rentals?page=1&perPage=50",
      "last": "https://borough.qwady.app/v1/search/rentals?page=7&perPage=50",
      "prev": "https://borough.qwady.app/v1/search/rentals?page=1&perPage=50",
      "next": "https://borough.qwady.app/v1/search/rentals?page=3&perPage=50"
    }
  }
}
```

* **`total`**: Total number of matching results across all pages
* **`page`**: Current page number
* **`perPage`**: Results per page
* **`links`**: Navigation URLs for self, first, last, prev (null on first page), and next (null on last page)

## Max perPage by tier

| Tier     | Max perPage |
| -------- | ----------- |
| Free     | 10          |
| Starter  | 50          |
| Pro      | 500         |
| Business | 500         |

## SDK auto-pagination

The TypeScript SDK supports automatic pagination via async iterators:

```typescript theme={null}
const results = await borough.rentals.search({ areas: '120' });

// Iterate across all pages automatically
for await (const listing of results) {
  console.log(listing.address.street);
}

// Or collect into an array with an optional limit
const all = await results.toArray({ limit: 200 });
```
