Concepts
Pagination
Lists come a page at a time, newest first, with a cursor to the next page.
curl "https://api.coherenceltd.com/v1/briefs?limit=50" \
-H "Authorization: Bearer $COHERENCE_API_KEY"{
"data": [ … ],
"next_cursor": "c_9KdA2"
}Pass next_cursor as cursor to get the next page. It is null on the last one. limit is 1–100 and defaults to 20.
let cursor = null;
do {
const url = new URL('https://api.coherenceltd.com/v1/briefs');
url.searchParams.set('limit', '100');
if (cursor) url.searchParams.set('cursor', cursor);
const res = await fetch(url, { headers: { Authorization: `Bearer ${key}` } });
const page = await res.json();
handle(page.data);
cursor = page.next_cursor;
} while (cursor);