We use cookies to improve your experience and analyze site traffic. By clicking “Accept”, you agree to our use of cookies.

Learn more about our privacy practices
Corvo
Português

Pagination

Opaque cursor pagination on every list endpoint.

Every listing returns { "data": [...], "pagination": { "limit", "hasMore", "nextCursor" } }. There is no page, pageSize, offset or total.

How to paginate

  • First call: GET /v1/companies?limit=50. limit accepts integers from 1 to 1000 (default 50); invalid values return 400 with ERROR_INVALID_LIMIT, never silently truncated.
  • Next pages: send cursor=<nextCursor> keeping exactly the same filters. You may change limit between pages.
  • At the end, hasMore is false and nextCursor is null. An empty list returns data: [].
  • The cursor is opaque and versioned: do not edit, build or reuse it on another collection, tenant or filter (400 with ERROR_INVALID_CURSOR).
  • Reads use current data with no snapshot between requests: items inserted later do not show up when continuing a descending listing, and a cursor keeps working if its record is deleted.

javascript

async function listAllCompanies() {
  const all = [];
  let cursor;

  do {
    const url = new URL(`${BASE_URL}/companies`);
    url.searchParams.set("limit", "100");
    if (cursor) url.searchParams.set("cursor", cursor);

    const res = await fetch(url, {
      headers: { "X-API-Key": process.env.CORVO_API_KEY },
    });
    const { data, pagination } = await res.json();
    all.push(...data);
    cursor = pagination.hasMore ? pagination.nextCursor : undefined;
  } while (cursor);

  return all;
}