Pagination
Lists return data and nextCursor. Pass the cursor back for the next page.
Every list endpoint answers the same shape:
{
"data": [ { "id": "…" } ],
"nextCursor": "eyJ2IjoiMjAyNi0xMS0wNFQxMDowMDowMC4wMDBaIiwiaWQiOiIwMTk1…"
}nextCursor is null on the last page. To get the next page, send it back as cursor, with the same filters:
curl "https://feedhorizon.com/api/v1/posts?limit=50&cursor=eyJ2IjoiMjAyNi0x…" \
-H "Authorization: Bearer fh_YOUR_API_KEY"limitis 1 to 100, default 20.- Cursors are opaque. Do not build or change them; a changed cursor is refused with
invalid_cursor. - Pages stay stable while posts are added or removed, unlike page numbers.
- Small lists (profiles, accounts, webhooks, API keys, invites) return everything at once with
nextCursor: null.
async function* allPosts(apiKey) {
let cursor = null;
do {
const url = new URL('https://feedhorizon.com/api/v1/posts');
url.searchParams.set('limit', '100');
if (cursor) url.searchParams.set('cursor', cursor);
const res = await fetch(url, { headers: { Authorization: `Bearer ${apiKey}` } });
const page = await res.json();
yield* page.data;
cursor = page.nextCursor;
} while (cursor);
}