# Pagination

Serply API uses cursor-based pagination for efficient result retrieval.

## Example Using Cursors

When making a request, you can specify pagination parameters:

```bash
curl --header 'X-Api-Key: YOUR_API_KEY' \
  "https://api.serply.io/v1/search?q=query&page=1&per_page=10"
```

The response will include pagination metadata:

```json
{
  "results": [...],
  "pagination": {
    "page": 1,
    "per_page": 10,
    "total": 100,
    "total_pages": 10,
    "next_cursor": "abc123",
    "prev_cursor": null
  }
}
```

## Using Cursors

To fetch the next page, use the `next_cursor` value:

```bash
curl --header 'X-Api-Key: YOUR_API_KEY' \
  "https://api.serply.io/v1/search?q=query&cursor=abc123"
```

## Best Practices

- Use appropriate `per_page` values (default is 10, max is 100)
- Store cursors if you need to resume pagination
- Handle cases where `next_cursor` is null (last page)
