Skip to content
BENIBIX Learn

Pagination

Development🔌 APIsAPI Design Practices

Also known as Paging, Cursor Pagination, Offset Pagination

Splitting a long list into pages, so an API sends a few at a time.

Think of it like

Think of it like a book. You read one page at a time, not the whole book on one huge sheet.

Example

Lucy's shop has 50,000 products. Her API sends 20 at a time, and the app asks for the next page as the user scrolls.

Why it matters

Sending 50,000 rows at once is slow for the server and the phone. Pages keep each answer small and fast.

Definition

Pagination splits a long list of results into pages. The API then sends a few at a time. The client asks for a page with query parameters, like ?page=2&limit=20. Some APIs use an offset, a count of rows to skip. Others hand back a cursor, a marker that says where the next page starts. Cursors stay correct even when new rows are added while you page.

Example code

url
https://api.example.com/products?page=2&limit=20
Ask for the second page, 20 products long.

Common mistake

Using page numbers on a list that changes fast. New items push old ones down, and users see repeats.

Key takeaways

  1. 1
    A few at a time. One page per request.
  2. 2
    Offset or cursor. Two ways to say where.
  3. 3
    Cursors stay right. When rows are added.