API Design Interview Question

What is pagination in an API?

Updated 2026-08-16 · Beginner friendly
Quick answer

Pagination is breaking a large list of results into smaller pages instead of returning everything at once. If a query could return a million rows, sending them all would be slow and heavy, so the API returns a page at a time. The two common styles are offset based, using page and size, and cursor based, using a pointer to the next item.

Key takeaways
  • Pagination splits a large result set into smaller pages.
  • Offset pagination uses a page number, while cursor pagination uses a pointer to the last item.
  • It improves performance and avoids sending huge responses at once.

The two common styles

Offset pagination is easy to build and understand. Cursor pagination performs better on huge datasets and avoids skipping or repeating items when new rows are added while the user pages through.

In the interview

If asked which is better for large or fast changing data, say cursor based. Explaining that offset pagination can skip or duplicate rows when data changes shows you have thought past the basics.

Frequently asked questions

What is the difference between offset and cursor pagination?

Offset uses a position and page size but can skip or repeat rows when data changes, while cursor uses a stable pointer and handles changing data better.

Why not return all results at once?

Large responses are slow, use more memory, and strain the network. Pagination keeps each response small and predictable.

Want the full API Design guide?

Read every API Design concept with notes, diagrams, and code in one place. Track your progress as you go.

Open the API Design guide All API Design questions