When retrieving large datasets from the Kariz API, results are automatically paginated to optimize performance and response times. Pagination allows you to retrieve data in manageable chunks while providing a clear way to access subsequent records.
Kariz uses token-based pagination that’s consistent across all supported e-commerce channels. When a response contains more data than can be returned in a single request, Kariz will:
- Return a subset of the total results (default is 10 items per page)
- Include a `next_page_token` in the response to indicate more data is available
- Provide a `next_page_token_url` that can be used directly for the next request
Using the Next Page Token
A response that doesn’t include a `next_page_token` field indicates you’ve reached the last page of results or the entire dataset was small enough to be returned in a single response.
// Initial request
const initialResponse = await fetch('https://api.trykariz.com/api/KarizClientApp/Unified/Products?channel=shopify&tpUserId=user123');
const data = await initialResponse.json();
// Process the first page of results
processData(data.Output.result);
// Check if there are more pages
if (data.Output.next_page_token) {
// Request the next page using the token
const nextPageResponse = await fetch(
'https://api.trykariz.com/api/KarizClientApp/Unified/Products?channel=shopify&tpUserId=user123&next_page_token=' + data.Output.next_page_token
);
const nextPageData = await nextPageResponse.json();
// Process the next page of results
processData(nextPageData.Output.result);
}
Response Structure
A paginated response will contain the following pagination-related fields:
{
"Output": {
"result": [
// Array of products or orders
],
"next_page_token": "eyJsYXN0X2lkIjo1OTU0NDYxMzM1ODI3LCJsYXN0X3ZhbHVlIjoiMjAyNC0wOS0xMyAxNDo0NzoxMy4xNDAwNTEiLCJkaXJlY3Rpb24iOiJuZXh0In0",
"next_page_token_url": "https://api.trykariz.com/api/KarizClientApp/Unified/Products?channel=shopify&tpUserId=user123&next_page_token=eyJsYXN0X2lkIjo1OTU0NDYxMzM1ODI3LCJsYXN0X3ZhbHVlIjoiMjAyNC0wOS0xMyAxNDo0NzoxMy4xNDAwNTEiLCJkaXJlY3Rpb24iOiJuZXh0In0"
}
}
Controlling Page Size
You can adjust the number of results per page by using the `limit` parameter in your request:
GET https://api.trykariz.com/api/KarizClientApp/Unified/Products?channel=shopify&tpUserId=user123&limit=25
The maximum limit value is 100 items per page. Some channels may limit responses to 50 items per page, in which case, we follow their limit. If you specify a higher value, it will be capped at 100.