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

# Pagination

> Cursor-based pagination for list endpoints.

## How it works

All list endpoints use **cursor-based pagination**. Each response includes pagination metadata:

```json theme={null}
{
  "data": [...],
  "pagination": {
    "cursor": "eyJpZCI6IjEyMyJ9",
    "hasMore": true,
    "total": 487
  }
}
```

## Requesting pages

Pass the `cursor` from the previous response to fetch the next page:

```bash theme={null}
# First page (default: 50 items)
curl ".../brands?limit=20"

# Next page
curl ".../brands?limit=20&cursor=eyJpZCI6IjEyMyJ9"
```

## Parameters

| Parameter | Type    | Default | Description                   |
| --------- | ------- | ------- | ----------------------------- |
| `limit`   | integer | 50      | Items per page (max 100)      |
| `cursor`  | string  | —       | Cursor from previous response |

## Iterating through all pages

```javascript theme={null}
async function fetchAllBrands(workspaceId) {
  let cursor = null;
  const allBrands = [];

  do {
    const url = new URL(`.../brands`);
    url.searchParams.set('limit', '100');
    if (cursor) url.searchParams.set('cursor', cursor);

    const response = await fetch(url, { headers: { Authorization: `Bearer ${apiKey}` } });
    const { data, pagination } = await response.json();

    allBrands.push(...data);
    cursor = pagination.hasMore ? pagination.cursor : null;
  } while (cursor);

  return allBrands;
}
```
