Payluk uses pagination to efficiently return large collections of data. Instead of returning all records at once, paginated endpoints return a subset of results along with metadata that helps you navigate through pages.
Pagination improves performance, reduces response size, and provides a consistent way to fetch large datasets.
Paginated endpoints return a response with two main sections:
- **pagination** – Metadata describing the current page and navigation state
- **data** – The list of records for the current page
### Sample Paginated Response
```json
{
"status": 200,
"message": "Customers fetched successfully",
"data": {
"pagination": {
"count": 2,
"pages": 5,
"isLastPage": false,
"nextPage": 2,
"previousPage": null
},
"data": [
// Array of records for the current page
]
}
}Pagination Fields Explained
pagination
paginationThe pagination object contains metadata about the current result set.
| Field | Type | Description |
|---|---|---|
count | number | Number of records returned in the current response |
pages | number | Total number of available pages |
isLastPage | boolean | Indicates whether the current page is the last page |
nextPage | number | null | The next page number to request, or null if none |
previousPage | number | null | The previous page number to request, or null if none |
data
dataThe data array contains the actual records returned for the current page.
Each object in the array represents a resource specific to the endpoint (e.g. customers, escrows, transactions).
Navigating Pages
To retrieve the next or previous page:
- Use the value provided in
nextPageorpreviousPage - Pass the page number as a query parameter in your request
Example
GET /customers?page=2
If nextPage is null, there are no more pages available.
Best Practices
- Always rely on the
paginationobject instead of guessing page numbers - Stop requesting pages when
isLastPageistrue - Handle empty result sets gracefully
- Avoid requesting very large page sizes to maintain performance
Pagination ensures predictable, efficient, and scalable access to large datasets across Payluk APIs.
