Guide
Pagination
Lists return a page of results and a cursor for the next one.
Every list returns { data, nextCursor }. Pass nextCursor back as cursor to get the next page; it is null on the last page. limit sets the page size, 1 to 100, 25 by default.
Cursors are keyset cursors: they hold your place by the sort key, not by a count. A busy day of updates never makes you skip or repeat a record while you page.
curl "https://api.thelobbynews.com/v1/bills?congress=119&limit=100&cursor=eyJ2IjoxLC..." \
-H "Authorization: Bearer lobby_live_..."Staying in sync
To keep your own copy current, list bills with updatedSince set to the time of your last run, and page until nextCursor is null. Only bills Congress.gov changed since then come back.
Every page, in code
let cursor = null;
do {
const url = "https://api.thelobbynews.com/v1/bills?congress=119&limit=100" + (cursor ? `&cursor=${cursor}` : "");
const res = await fetch(url, {
headers: { Authorization: `Bearer ${process.env.LOBBY_API_KEY}` },
});
const { data, nextCursor } = await res.json();
for (const item of data) save(item);
cursor = nextCursor;
} while (cursor);