Pagination & sorting
Lists are paged, sorted and filtered by the server. There is no endpoint that returns your whole table — and no reason to want one: sorting a page you fetched yourself sorts only what you loaded, and counting it lies about the total.
The list envelope
curl "https://api.onivos.com/contacts?page=2&limit=50&sort=display_name:asc" \
-H "Authorization: Bearer onv_test_xxxxxxxx"{
"data": {
"items": [{ "id": "175041000000000001", "display_name": "Aaron Blake" }],
"total": 1284,
"page": 2,
"limit": 50
}
}| Field | Meaning |
|---|---|
items | The rows on this page. |
total | How many rows match the filters — not how many are on this page. |
page | Echo of the requested 1-based page. |
limit | Echo of the applied page size. |
approx | Present and true when total is an estimate (see below). |
Parameters
| Parameter | Type | Default | Notes |
|---|---|---|---|
page | integer | 1 | 1-based. Values below 1 clamp to 1. |
limit | integer | 25 | Page size. Maximum 200 — a larger value clamps, it does not error. |
sort | string | per endpoint | field:asc or field:desc. |
Filters are per endpoint — q for search, plus resource-specific ones like lifecycle on contacts or status on orders. Each reference page lists what its endpoint accepts.
Sorting
sort is field:direction:
?sort=created_at:desc
?sort=display_name:ascOnly whitelisted fields are sortable, and the whitelist is per endpoint. An unknown field is ignored, not rejected — the endpoint's default ordering applies instead. If a sort seems to have no effect, it is not on that endpoint's list. Without sort, most lists return newest first.
Sorting is stable: where the sort column can tie (a name, a score, a count), a unique tiebreaker is appended, so a row can never appear on two pages or on none.
Big lists: approx
An exact count over a very large unfiltered table costs more than the page itself. Past roughly ten thousand rows, an unfiltered list returns an estimated total and sets approx: true — render it as "about 12,000", not "12,000".
Any narrowing filter (a search, a status, a date range) brings the exact count back, since the count is then bounded by the filter.
Deep paging
Offset paging degrades the further you go: page 400 still has to walk past the first 399 pages' worth of rows. For a full export, prefer:
- the export endpoints, where the pillar has one (contacts, records, products); or
- cursor paging on Data Object records, which is built for exactly this.
The one exception: Data Object records
GET /objects/{key}/records returns a different, richer envelope because it supports cursor paging over very large tables:
{
"data": {
"rows": [{ "id": "175041000000000900" }],
"total": 84210,
"approx": true,
"page": 1,
"limit": 100,
"nextCursor": "eyJzIjpudWxsLCJpZCI6IjE3NTA0…"
}
}Rows are in rows (not items), and to walk the whole object you follow nextCursor instead of incrementing page:
curl "https://api.onivos.com/objects/orders/records?limit=200&cursor=eyJzIjpudWxsLCJpZCI6IjE3NTA0…" \
-H "Authorization: Bearer onv_live_xxxxxxxx"nextCursor is null on the last page. Passing an explicit page switches that endpoint back to offset mode and stops returning a cursor. Details and the filter grammar: Records.