Pagination
A list that can grow without bound is paged by cursor. Each page comes back with a
next_cursor. Send it as cursor to get the next page, and stop when it is null.
A cursor is an opaque string. Do not build one, change one or keep one for later: it marks a place in one list, read one way. Change a filter and you start again without one.
Which endpoints page
| Endpoint | Where the cursor goes | The page |
|---|---|---|
POST/v1/tables/{id}/records/query | cursor in the body | records, up to limit |
GET/v1/activity | cursor in the query | items, up to limit |
GET/v1/billing/invoices | cursor in the query | invoices, 20 a page |
GET/v1/billing/credits | cursor in the query | grants, 20 a page |
The other lists come back whole, because a workspace holds a bounded number of them: tables, skills, collections, connections, profiles, connect links, members, folders.
Two lists are capped rather than paged. GET/v1/media returns the newest 200 matches
and a total, so narrow it with its filters when total is larger than the page.
GET/v1/skills/{id}/versions returns the newest versions up to its limit.
The loop
Reading the whole call log, 200 at a time:
const headers = { Authorization: `Bearer ${process.env.FLC_API_KEY}` };
let cursor = null;
do {
const url = new URL('https://api.floconnector.com/v1/activity');
url.searchParams.set('limit', '200');
if (cursor) url.searchParams.set('cursor', cursor);
const response = await fetch(url, { headers });
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const page = await response.json();
for (const call of page.items) {
// one tool call, as metadata
}
cursor = page.next_cursor;
} while (cursor);A record query pages the same way, except that the cursor travels in the body, beside the same
where and sort you started with. This is the first page; add "cursor" with the next_cursor
it returns for the second:
A page stays put
New calls landing in the log while you read do not shift the page you are on: a cursor marks a place in the list, not a page number.
Each request counts against the key's read budget, so a long read is paced by rate limits: ask for the largest page an endpoint allows rather than many small ones.