Pagination, sorting and filters
Pages or cursor, stable sorting, multi-value filters and incremental sync.
Every API list is paginated, sortable and filterable with the same parameters. Two ways to walk it: by page, to display, or by cursor, to synchronize.
By page
page (starting at 1) and pageSize (25 by default, 100 at most):
GET/partners
curl 'https://quosuite.com/api/public/v1/quosuite/partners?role=CLIENT&page=2&pageSize=50' \
-H "Authorization: Bearer $QUOSUITE_API_KEY"{
"success": true,
"data": {
"items": [ "…" ],
"pagination": { "page": 2, "pageSize": 50, "totalItems": 132, "totalPages": 3, "hasMore": true }
},
"timestamp": "2026-10-02T09:15:00.000Z"
}Simple and handy for a screen (“page 2 of 3”). But on a collection that changes during the walk, an item created between two pages shifts what follows: duplicate or miss. To synchronize, use the cursor.
By cursor
On large collections — documents, articles, partners, payments, stock movements, webhook log — ask for limit (1 to 100), then pass pagination.nextCursor back in cursor with the same filters and the same sort, until nextCursor: null:
curl 'https://quosuite.com/api/public/v1/quosuite/sales/invoices?limit=100&sort=updatedAt,id&updatedSince=2026-10-01T00%3A00%3A00Z' \
-H "Authorization: Bearer $QUOSUITE_API_KEY"{
"success": true,
"data": {
"items": [ "…" ],
"pagination": { "limit": 100, "nextCursor": "c1.eyJzIjoidXBkYXRlZEF0OmFzYyxpZDphc2MiLCJmIjoi…", "hasMore": true }
},
"timestamp": "2026-10-02T09:15:00.000Z"
}by page (page, pageSize) | by cursor (limit, cursor) | |
|---|---|---|
| items created during the walk | shift the pages: duplicates or misses | no effect on what follows |
| cost of a far page | grows with depth | constant |
total (totalItems) | yes | no — that is what makes it fast |
| jump to page N | yes | no: next only |
- The cursor is opaque: pass it back as is. It does not expire.
- Changing filters or sort along the way answers 400
INVALID_CURSORrather than an inconsistent page. Mixingpage/pageSizewithlimit/cursoranswers 400VALIDATION_FAILED. - Short lists (reference data, POS, treasury, staff) only offer page pagination.
async function* walk(path, params) {
let cursor = null;
do {
const query = new URLSearchParams({ ...params, limit: '100', ...(cursor ? { cursor } : {}) });
const response = await fetch(`https://quosuite.com/api/public/v1/quosuite${path}?${query}`, {
headers: { Authorization: `Bearer ${process.env.QUOSUITE_API_KEY}` },
});
const payload = await response.json();
if (!response.ok) throw new Error(`${payload.error.code}: ${payload.error.message}`);
yield* payload.data.items;
cursor = payload.data.pagination.nextCursor;
} while (cursor);
}
for await (const invoice of walk('/sales/invoices', { sort: 'updatedAt,id', updatedSince: '2026-10-01T00:00:00Z' })) {
console.log(invoice.number, invoice.status);
}Sorting
sort takes comma-separated fields, - for descending order: sort=-date,number. Each route lists the fields it accepts in its description; another field answers 400 (detail.allowed). End with id for a total order, hence stable pagination: sort=-date,id.
Filtering
- Multi-value filters are comma-separated:
status=VALIDATED,PARTIALLY_PAID. - Date ranges are inclusive:
dateFrom=2026-01-01&dateTo=2026-03-31covers the whole of March 31. - An unknown parameter is refused (400): a misspelled filter never returns “everything”.
Synchronizing
updatedSince only returns items created or updated since an instant (inclusive). With sort=updatedAt,id and the cursor, it is the recommended form of an incremental sync:
- store the start instant of each run;
- on the next run, walk
updatedSince=<stored instant>to the end; - process each item idempotently (an item may come back if it was updated during the walk).
Webhooks bring freshness; updatedSince catches up on what a down receiver would have missed. Together they lose nothing — see Receive webhooks.