Skip to content

Pagination

List endpoints return a consistent envelope and page with an opaque cursor.

Every list endpoint returns the same shape:

{
"data": [ /* ... items for this page ... */ ],
"nextCursor": "eyJpZCI6Im..."
}
  • data is the array of results for the current page.
  • nextCursor is an opaque string. Pass it back as the cursor query parameter to fetch the next page. When it is null, you have reached the end.

Request the first page, then keep passing nextCursor back as cursor until it comes back null:

Terminal window
# First page
curl "https://api.mereon.ai/v1/topics?limit=50" \
-H "Authorization: Bearer $MEREON_TOKEN"
# Next page, using the nextCursor from the previous response
curl "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;
}

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.

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.