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

# Pagination

> How to page through large result sets using the start offset and the paging response object.

# Pagination

Each `/scrape` call returns a **single page of 25 items**. To retrieve more results, increment the `start` offset and call again.

## How it works

The `start` parameter controls which page of results you get:

| `start` value | What you get                   |
| ------------- | ------------------------------ |
| `0`           | Items 1–25 (first page)        |
| `25`          | Items 26–50 (second page)      |
| `50`          | Items 51–75 (third page)       |
| ...           | ...                            |
| `2475`        | Items 2476–2500 (maximum page) |

### Rules

* `start` must be a **multiple of 25** (0, 25, 50, 75, ...)
* `start` maximum is **2475**
* Each response always returns **25 items or fewer** (the last page may be partial)

<Warning>
  If `start` exceeds the total available results minus one page size, the API returns an empty `data` array. Always check `paging.total` to know when to stop.
</Warning>

## The `paging` response object

Every successful response includes a `paging` object telling you the total available results:

```json theme={null}
{
  "success": true,
  "data": [ ... ],
  "total_scraped": 25,
  "pages_processed": 1,
  "paging": {
    "total": 500,
    "start": 0,
    "count": 25
  }
}
```

| Field          | Meaning                                 |
| -------------- | --------------------------------------- |
| `paging.total` | Total results available for this search |
| `paging.start` | The offset this response started at     |
| `paging.count` | Items per page (always 25)              |

## Example: paginate through all results

Here's a Python example that loops through every page until all results are collected:

```python theme={null}
import requests

url = "https://api.nickautomations.com/linkedin/scrape"
headers = {
    "x-api-key": "<your-api-key>",
    "Content-Type": "application/json",
}

payload = {
    "cookies": 'li_at=AQED...; JSESSIONID="ajax:0988250529423116538"',
    "url": "https://www.linkedin.com/sales/search/people?query=...",
    "scraper_type": "contacts",
}

all_results = []
start = 0
page_size = 25

while True:
    payload["start"] = start
    response = requests.post(url, json=payload, headers=headers)
    data = response.json()

    if not data["success"] or not data["data"]:
        break

    all_results.extend(data["data"])
    print(f"Page at start={start}: got {data['total_scraped']} items (total so far: {len(all_results)})")

    total_available = data["paging"]["total"]
    start += page_size

    # Stop if we've fetched everything or hit the max offset
    if start >= total_available or start > 2475:
        break

    # Be polite between pages (see Rate Limiting guide)
    import time
    time.sleep(6)

print(f"Done. Collected {len(all_results)} items out of {total_available} total.")
```

<Note>
  The example above adds a 6-second delay between pages. This keeps you safely under the default rate limit. See [Rate Limiting](/guides/rate-limiting) for details.
</Note>

## Pagination limits

LinkedIn Sales Navigator caps search results. Even if `paging.total` reports a large number, you cannot paginate past `start=2475`:

* **Maximum start offset**: `2475`
* **Maximum retrievable items**: `2500` (100 pages × 25 items)

If `paging.total` exceeds 2500, you can only access the first 2500 results. To reach the rest, narrow your search filters in Sales Navigator to split results into smaller sets.

## Next steps

* [Scrape API Reference](/api-reference/scrape) — full request/response schema
* [Rate Limiting](/guides/rate-limiting) — pace your pagination requests
* [Getting Cookies](/guides/getting-cookies) — refresh expired session cookies
