What is Pagination?
Turkish: Pagination
Pagination is a design pattern that breaks large datasets into manageable chunks for performant data delivery in API responses.
What Is Pagination?
Pagination is the practice of splitting large lists and datasets into smaller chunks instead of returning everything at once. It keeps both user interfaces and API responses fast, controlled, and predictable.
For example, an orders API should not return two million records in one request. It can provide data in chunks using parameters such as limit=50 and page=3, or with a cursor that points to the next segment.
Pagination Types
- Offset pagination: Uses
limitandoffset; simple, but can slow down at high offsets. - Page-based pagination: Uses
pageandper_page; easy to understand for classic list screens. - Cursor pagination: Uses a token based on the last seen record; better for changing datasets.
- Keyset pagination: Moves through ordered, indexed fields; efficient for high-volume data.
Responses may include total count, next page link, previous page link, or a next_cursor value. Total counts can be expensive in some databases, so they should not be required on every endpoint.
Business Use
Pagination is used in order lists, customer records, log viewers, product catalogs, report results, and search pages. If designed poorly, users may see duplicate records, new rows may shift the list, or the API may time out.
In REST API design, pagination parameters, default limit, maximum limit, sorting field, and consistent error format should be documented from the start.