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

# Cursor pagination

> How to paginate list and search endpoints.

Every list and search response includes:

```json theme={"system"}
{
  "has_more": true,
  "next_cursor": "opaque_cursor_token",
  "limit": 10
}
```

Continue paginating until:

```json theme={"system"}
{ "has_more": false, "next_cursor": null }
```

## GET endpoints

Pass `cursor` as a query parameter.

### First request

```bash theme={"system"}
curl "https://api.octolane.com/v1/accounts?limit=10" \
  -H "x-api-key: your-api-key"
```

### Next request

```bash theme={"system"}
curl "https://api.octolane.com/v1/accounts?limit=10&cursor=<next_cursor>" \
  -H "x-api-key: your-api-key"
```

## POST search endpoints

Pass `cursor` in the request body. Keep `filters`, `sort`, `limit`, and (for opportunities) `pipeline_id`/`stage_id` identical between pages.

### First request

```json theme={"system"}
{
  "pipeline_id": "pipeline_uuid",
  "limit": 10,
  "sort": { "field": "updated_at", "direction": "desc" }
}
```

### Next request

```json theme={"system"}
{
  "pipeline_id": "pipeline_uuid",
  "limit": 10,
  "sort": { "field": "updated_at", "direction": "desc" },
  "cursor": "next_cursor_from_previous_response"
}
```

<Warning>
  Cursors are valid only when paired with the **same query**: `query`, `filters`, `sort`, `limit`, and (for opportunities) `pipeline_id` / `stage_id`. Changing any of these invalidates the cursor.
</Warning>
