Pagination
Get an API keyLists (GET /v1/posts, GET /v1/media) are returned newest first, one page at a time. limit sets the page size, from 1 to 100 (20 by default).
{
"data": [ … ],
"nextCursor": "WyIyMDI2LTEwLTI3VDE1OjExOjU5LjAxN1oiLCIx…"
}Pass nextCursor as cursor to read the next page. When nextCursor is absent, you reached the end.
let cursor;
do {
const url = new URL('https://api.sofia-post.com/api/v1/posts');
url.searchParams.set('limit', '100');
if (cursor) url.searchParams.set('cursor', cursor);
const page = await globalThis.fetch(url, { headers: { Authorization: `Bearer ${key}` } }).then((r) => r.json());
handle(page.data);
cursor = page.nextCursor;
} while (cursor);A cursor is opaque: never build or change one. A cursor Sofia did not return answers 400 invalid_cursor.