Skip to content

Paging

Endpoints that can return many items answer a page at a time. Each answer has the items and a nextCursor. Send that cursor back to get the next page. When nextCursor is null, you have everything.

Endpoint Items limit
GET /pages pages 1 to 100, 50 if left out
POST /databases/{databaseId}/query rows 1 to 100, 25 if left out

GET /search answers with the best matches only, up to limit (1 to 50, 10 if left out), and has no cursor.

Reading five pages two at a time takes three requests:

You send Lyra answers
GET /pages?parentId=…&limit=2 Pages 1 and 2, and nextCursor: "A"
GET /pages?parentId=…&limit=2&cursor=A Pages 3 and 4, and nextCursor: "B"
GET /pages?parentId=…&limit=2&cursor=B Page 5, and nextCursor: null, so you’re done
  • Keep the other parameters the same when you send a cursor. For GET /pages, send it as the cursor query parameter. For a database query, send it as cursor in the body next to the same filter and sorts.
  • A cursor is a string to send back as it is. Don’t build or change one; Lyra answers 422 invalid_input for a cursor it didn’t make.
  • Pages come in the order they have in the sidebar, and rows in the order of your sorts. The cursor remembers where you stopped, not a count, so pages and rows that don’t change while you read come exactly once. One that is added, moved or changed in a sorted value while you read can be missed or come twice.

List the pages inside a page, two at a time:

Terminal window
curl -s "https://app.lyra-docs.com/api/v1/pages?parentId=$PARENT_ID&limit=2" \
-H "Authorization: Bearer $LYRA_TOKEN"
{
"pages": [
{
"id": "01a237e9-550d-70a0-b164-97c92faf422c",
"title": "January",
"icon": null,
"kind": "doc",
"url": "https://app.lyra-docs.com/p/01a237e9-550d-70a0-b164-97c92faf422c",
"parentId": "01a237e9-54f0-724d-8384-10dc3625173f",
"teamspaceId": null,
"hasChildren": false,
"updatedAt": "2026-12-02T17:59:28.378Z",
"expiresAt": null
},
{ "id": "01a237e9-552a-703f-84ce-06b653a097b5", "title": "February", "...": "..." }
],
"nextCursor": "WyJhMSIsIjAxYTIzN2U5LTU1MmEtNzAzZi04NGNlLTA2YjY1M2EwOTdiNSJd"
}

Send nextCursor back for the next two:

Terminal window
curl -s "https://app.lyra-docs.com/api/v1/pages?parentId=$PARENT_ID&limit=2&cursor=$NEXT_CURSOR" \
-H "Authorization: Bearer $LYRA_TOKEN"

Which list you get depends on what you pass:

Pass You get
parentId The pages inside that page
teamspaceId The pages at the top of that teamspace
Neither Your private pages

In JavaScript, loop until nextCursor is null. This uses the lyra helper from the quickstart:

async function listAllPages(parentId) {
const pages = []
let cursor = null
do {
const params = new URLSearchParams({ parentId, limit: '100' })
if (cursor) params.set('cursor', cursor)
const answer = await lyra('GET', `/pages?${params}`)
pages.push(...answer.pages)
cursor = answer.nextCursor
} while (cursor)
return pages
}

The same for database rows. The filter and sorts stay the same on every request:

async function openTasks(databaseId) {
const rows = []
let cursor = null
do {
const answer = await lyra('POST', `/databases/${databaseId}/query`, {
filter: { op: 'and', items: [{ propertyId: 'Status', operator: 'not_equals', value: 'Done' }] },
sorts: [{ propertyId: 'Due', direction: 'asc' }],
limit: 100,
...(cursor ? { cursor } : {}),
})
rows.push(...answer.rows)
cursor = answer.nextCursor
} while (cursor)
return rows
}

Each request counts against your token’s rate limit, so ask for the largest limit that suits you.