Pagination
The KC api uses standard pagination to handle large datasets efficiently. When endpoints return multiple items, they are paginated to improve performance and reduce response times.
Pagination parameters
Most endpoints that return lists support the following pagination parameters:
_start— the starting position/index (default:0)._limit— number of items to retrieve (default:20).
Response format
Paginated responses include metadata about the pagination in the response:
{
"response": [...],
"pagination": {
"totalRecords": 1526,
"perPage": 20,
"totalPages": 77,
"start": 0,
"currentPage": 1
}
}
Example usage
Here are examples of how to use pagination parameters:
- Get first 20 items (default):
GET /api/v1/users - Get items 20–39 (second page):
GET /api/v1/users?_start=20&_limit=20 - Get 10 items starting from position 50:
GET /api/v1/users?_start=50&_limit=10
Best practices
- Check
currentPageagainsttotalPagesto determine if there are more pages available. - Use reasonable
_limitvalues (typically 10–100 items) to balance performance and usability. - Calculate the next
_startvalue by adding the current_limitto the currentstart. - Use
totalRecordsto show users the total number of items available. - Implement proper error handling for cases where the requested range doesn't exist.
- Consider caching frequently accessed pages to improve performance.