How to paginate through large result sets using cursor-based pagination.
List endpoints return paginated results to maintain performance. TalentScreen uses cursor-based pagination for consistent results even as data changes.
| Name | Type | Required | Description |
|---|---|---|---|
| limit | integer | Optional | Number of results per page (default: 20, max: 100) |
| cursor | string | Optional | Cursor from previous response to fetch next page |
Paginated responses include data array, pagination metadata, and next_cursor for fetching subsequent pages.
{
"data": [
{ "id": "exam_123", "title": "Backend Developer Test" },
{ "id": "exam_124", "title": "Frontend Engineer Test" }
],
"pagination": {
"total": 47,
"limit": 20,
"has_more": true,
"next_cursor": "eyJpZCI6ImV4YW1fMTI0In0="
}
}Use the next_cursor value from each response to fetch subsequent pages. When has_more is false, you have retrieved all results.
async function fetchAll(endpoint) {
const results = [];
let cursor = null;
do {
const url = cursor
? `${endpoint}?cursor=${cursor}`
: endpoint;
const response = await fetch(url, { headers });
const data = await response.json();
results.push(...data.data);
cursor = data.pagination.next_cursor;
} while (cursor);
return results;
}Set an appropriate limit based on your use case. Smaller limits mean more requests but faster responses. Larger limits reduce requests but may take longer per page.
Request only the page size you need. Cache results when appropriate. Use filtering and sorting parameters to reduce total result count. Monitor rate limits when paginating through large datasets.
Was this article helpful?