# Pagination

URL: /docs/developers/pagination

## Page through collections [#page-through-collections]

List operations that return many rows take `page` and `limit` query parameters. Each resource page lists the filters its operations accept, such as [opinions and answers](/docs/developers/feedback/sync#opinionslist-filters) or [delivery links](/docs/developers/collect/delivery-links#see-who-responded).

### Choose `page` and `limit` [#choose-page-and-limit]

| Parameter | Default | Allowed values |
| --- | --- | --- |
| `page` | `1` | Whole numbers from `1` |
| `limit` | `10` | Whole numbers from `1` through `100` |

This request fetches the second page of 50 unanswered opinions, newest first:

**TypeScript SDK**

```ts
import { opinions } from '@orvelt/business';

const result = await opinions.list({
  projectId: 'PROJECT_ID',
  page: 2,
  limit: 50,
  sort: 'newest',
  replyStatus: 'unreplied',
});
```

**Python SDK**

```python
import os
from orvelt_business import Orvelt

with Orvelt(business_api_key=os.environ["ORVELT_BUSINESS_API_KEY"]) as client:
    page = client.opinions.list(
        project_id="PROJECT_ID",
        page=2,
        limit=50,
        sort="newest",
        reply_status="unreplied",
    )
```

**cURL**

```bash
curl --request GET \
  --url "$ORVELT_API_BASE_URL/project/PROJECT_ID/opinions?page=2&limit=50&sort=newest&replyStatus=unreplied" \
  --header "x-api-key: $ORVELT_BUSINESS_API_KEY"
```

### Read the `pagination` object [#read-the-pagination-object]

Paged responses include `pagination`:

```json
{ "page": 2, "limit": 50, "total": 137, "totalPages": 3 }
```

Stop requesting pages when `page` equals `totalPages`. All filters combine with AND before pagination, so `pagination.total` counts only matching rows. `query` is a text search of up to 200 characters. Concurrent inserts or edits can shift page-based results.

The Python SDK returns a page wrapper for `opinions.list`, `answers.list`, and `link.list`. The response is in `.result`; `.next()` keeps the original filters and returns `None` after the last page. For async calls, use `await page.next()`.

**TypeScript SDK**

```ts
import { opinions } from '@orvelt/business';

for (let page = 1; ; page += 1) {
  const result = await opinions.list({ projectId: 'PROJECT_ID', page, limit: 100 });
  if (result.error) throw new Error(result.error.message);
  console.log({ count: result.data.opinions.length });
  if (page >= result.data.pagination.totalPages) break;
}
```

**Python SDK**

```python
import os
from orvelt_business import Orvelt

with Orvelt(business_api_key=os.environ["ORVELT_BUSINESS_API_KEY"]) as client:
    page = client.opinions.list(project_id="PROJECT_ID", limit=100)
    while page is not None:
        print({"count": len(page.result.opinions)})
        page = page.next()
```

## Filter by date [#filter-by-date]

The opinion and answer list operations take `dateFrom` and `dateTo` as Unix timestamps in milliseconds.

### Convert dates to milliseconds [#convert-dates-to-milliseconds]

**TypeScript SDK**

```ts
const dateFrom = Date.parse('2026-01-01T00:00:00Z');
const dateTo = Date.parse('2026-02-01T00:00:00Z');
```

**Python SDK**

```python
from datetime import datetime, timezone

date_from = int(datetime(2026, 1, 1, tzinfo=timezone.utc).timestamp() * 1000)
date_to = int(datetime(2026, 2, 1, tzinfo=timezone.utc).timestamp() * 1000)
```

Pass these as `date_from` and `date_to` in Python.

Dates must be whole-number timestamps from `0` through `8640000000000000`. Either boundary may be omitted, and both are inclusive. `dateFrom` must not be later than `dateTo`, or the request returns `400`. Convert time zones in your application so that repeated exports cover the same range, and deduplicate by resource ID when polling overlapping ranges.