/

Core concepts

Pagination

List endpoints return pages of results with a cursor. Pass next_cursor back to get the next page.

Applies to

v1 + v2

→

Changed in v2

Code written for v1 needs a small update for this topic. The migration guide shows each change side by side.

Page through messages
// Placeholder: Fernway is a fictional API.
let cursor
do {
const page = await fernway.messages.list({ limit: 100, cursor })
page.data.forEach((m) => console.log(m.id, m.status))
cursor = page.next_cursor
} while (cursor)

Cursor pagination

List endpoints return data, has_more and next_cursor. Pass next_cursor as the cursor parameter to fetch the next page. Cursors are opaque strings, so store them as-is and don't build your own.

Page size

Set limit between 1 and 100. The default is 25. Larger pages mean fewer requests but slower responses, so 100 is best for back-office jobs and 25 for user-facing lists.

Changed in v2

v1 used page and per_page numbers. v2 replaces them with cursors, which stay correct when new records arrive while you page.

i

Placeholder API

Fernway is a fictional product used to show how this template works. Replace these docs with your own in the CMS.

Create a free website with Framer, the website builder loved by startups, designers and agencies.