Pagination
List endpoints return a consistent envelope and page with an opaque cursor.
The list envelope
Section titled “The list envelope”Every list endpoint returns the same shape:
{ "data": [ /* ... items for this page ... */ ], "nextCursor": "eyJpZCI6Im..."}datais the array of results for the current page.nextCursoris an opaque string. Pass it back as thecursorquery parameter to fetch the next page. When it isnull, you have reached the end.
Paging through results
Section titled “Paging through results”Request the first page, then keep passing nextCursor back as cursor until it
comes back null:
# First pagecurl "https://api.mereon.ai/v1/topics?limit=50" \ -H "Authorization: Bearer $MEREON_TOKEN"
# Next page, using the nextCursor from the previous responsecurl "https://api.mereon.ai/v1/topics?limit=50&cursor=eyJpZCI6Im..." \ -H "Authorization: Bearer $MEREON_TOKEN"A simple loop in JavaScript:
async function fetchAll(path) { const results = []; let cursor = null; do { const params = new URLSearchParams({ limit: '100' }); if (cursor) params.set('cursor', cursor); const res = await fetch(`https://api.mereon.ai/v1/${path}?${params}`, { headers: { Authorization: `Bearer ${process.env.MEREON_TOKEN}` }, }); const page = await res.json(); results.push(...page.data); cursor = page.nextCursor; } while (cursor); return results;}The limit parameter
Section titled “The limit parameter”List endpoints accept a limit between 1 and 100 (default 50). Search accepts a
limit between 1 and 50 (default 10), and returns a single ranked page rather
than a cursor.
Treat cursors as opaque
Section titled “Treat cursors as opaque”A cursor is an internal token, not a stable offset or id. Do not try to parse, build, or store it long-term. Use only the values the API hands back, within the same listing.