Pagination

View saved

Why paginate

Unbounded list endpoints time out and waste bandwidth. Return a page plus a way to get the next one.

Offset / limit

Simple and common. Deep offsets get slower on large tables.

GET /api/books?limit=20&offset=40

Cursor / page tokens

Return an opaque cursor for the next page—often more scalable.

{
  "data": [ ... ],
  "next_cursor": "eyJpZCI6NDJ9"
}

Include totals carefully

Exact totals can be expensive. Sometimes has_more is enough.

Comments

One comment per signed-in account. Comments are saved with this page’s URL.