Pagination and filtering
Last updated:
How to page through Data API lists with take and cursor, and filter them with query parameters.
How do I page through a list?
List endpoints that can return many rows, such as GET /v1/users, are cursor-paginated:
take: how many rows to return, from 1 to 200. The default is 50.cursor: leave it out for the first page. For the next page, pass thenextCursorof the page before.
Each page answers { "data": [...], "nextCursor": "..." }. When nextCursor is null, you have every row. Rows come back oldest first, so a new row always lands on a later page.
let cursor = null;
const users = [];
do {
const url = new URL('https://api.propvista.io/v1/users');
url.searchParams.set('take', '200');
if (cursor) url.searchParams.set('cursor', cursor);
const response = await fetch(url, { headers: { Authorization: `Bearer ${process.env.PROPVISTA_API_KEY}` } });
const page = await response.json();
users.push(...page.data);
cursor = page.nextCursor;
} while (cursor);Treat nextCursor as opaque: pass it back exactly as you received it.
A search, such as GET /v1/projects with q or bedrooms, comes back best match first instead, and also answers total, the count of every match. Page it the same way, repeating the same search parameters with each nextCursor; a cursor from a different query gets 400 Bad Request.
How do I filter a list?
Filters are query parameters, listed on each endpoint's page in the API reference. For example, GET /v1/entitlements takes status:
curl "https://api.propvista.io/v1/entitlements?status=ACTIVE" \
-H "Authorization: Bearer $PROPVISTA_API_KEY"To match several values, repeat the parameter: ?status=ACTIVE&status=TRIAL. Leave it out to get every row. An unknown value gets 400 Bad Request naming the parameter.
