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

# Pagination

> How to paginate through API results

# Pagination

List endpoints return paginated results. Use `current_page` and `per_page` query parameters to navigate.

## Parameters

| Parameter      | Default | Range | Description             |
| -------------- | ------- | ----- | ----------------------- |
| `current_page` | 1       | 1+    | Page number to retrieve |
| `per_page`     | 100     | 1–200 | Items per page          |

## Response Format

```json theme={null}
{
  "pagination": {
    "total_entries": 11234,
    "current_page": 1,
    "total_pages": 113,
    "next_page": "/v1/projects/?current_page=2&per_page=100"
  },
  "data": [...]
}
```

| Field           | Description                                 |
| --------------- | ------------------------------------------- |
| `total_entries` | Total number of matching items              |
| `current_page`  | Current page number                         |
| `total_pages`   | Total number of pages                       |
| `next_page`     | URL for the next page (`null` on last page) |

## Example: Paginating Through All Projects

```python theme={null}
import requests

API_KEY = "vcm_live_your_key"
headers = {"X-API-KEY": API_KEY}
base_url = "https://api.vcm.fyi/v1"

page = 1
all_projects = []

while True:
    response = requests.get(
        f"{base_url}/projects/",
        headers=headers,
        params={"current_page": page, "per_page": 200}
    )
    data = response.json()
    all_projects.extend(data["data"])

    if data["pagination"]["next_page"] is None:
        break
    page += 1

print(f"Fetched {len(all_projects)} projects")
```

## Sorting

Most list endpoints support a `sort` parameter:

```
GET /v1/projects/?sort=-issued
GET /v1/projects/?sort=+country&sort=-retired
```

* `+field` or `field` — ascending order
* `-field` — descending order
* Multiple sort fields are applied in order
