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

# Pagination

> Handling queries with large responses

## Basics

* By default, search endpoints for Profiles and Companies return 100 items per page.
* The amount can be controlled via the `limit` parameter.
* The maximum is 1000 items.

## Pagination

When the number of items in the search results exceeds the page limit, a `pagination_token` is returned. This token allows iterating through multiple pages of search results.

The pagination token supports Point in Time (PIT) functionality. PIT takes a "snapshot" of the data at a specific moment, creating a fixed view of the index and preventing changes from affecting your search results when iterating across pages. PIT expires 5 minutes after the search query.

Control PIT with the `stable_pagination` parameter. When `false`, the search results don't use PIT — you may encounter the same items on subsequent pages, but response times are faster.

Use `"stable_pagination": true` only for queries where you expect many results and need to iterate through all of them (for example, pulling all profiles with a certain job title or all employees of a large company). For targeted queries, use `"stable_pagination": false`. You can also increase `limit` (max 1000) to avoid pagination altogether.

### Example

**Initial search request**

```json theme={null}
{
  "query": {
    "match_phrase": {
      "profile_info.current_company_name": {
        "value": "google"
      }
    }
  },
  "stable_pagination": true
}
```

**Response**

```json theme={null}
{
  "ids": [
    "d18d9b89-af5d-492c-8ec0-f4ecd06673c7",
    "58965b08-95d2-4023-a0f9-373bedc16d68",
    "5a7ba72f-d60c-4ef8-acbb-1424e025361e",
    "02d2bca9-c43d-4adc-b10e-cb91421d74f5",
    "02d52528-fdc6-4f29-8639-c1c1f6072799",
    "02d5f637-f048-41d1-aea5-8d9c64a09ea1"
  ],
  "total_count": 451647,
  "pagination_token": "eyJzYXAiOnsic2VhcmNoX2FmdGVyIjpbeyJmaWVsZCI6Il9zY29yZSIsInZhbHVlIjoxMC4yNTQ3ODF9LHsiZmllbGQiOiJwcm9maWxlX2luZm8uaWQiLCJ2YWx1ZSI6IjAyZDVmNjM3LWYwNDgtNDFkMS1hZWE1LThkOWM2NGEwOWVhMSJ9XX19"
}
```

**Request for the next page**

```json theme={null}
{
  "query": {
    "match_phrase": {
      "profile_info.current_company_name": {
        "value": "google"
      }
    }
  },
  "stable_pagination": true,
  "pagination_token": "eyJzYXAiOnsic2VhcmNoX2FmdGVyIjpbeyJmaWVsZCI6Il9zY29yZSIsInZhbHVlIjoxMC4yNTQ3ODF9LHsiZmllbGQiOiJwcm9maWxlX2luZm8uaWQiLCJ2YWx1ZSI6IjAyZDVmNjM3LWYwNDgtNDFkMS1hZWE1LThkOWM2NGEwOWVhMSJ9XX19"
}
```
