In the example  API "Search leads by Criteria (https://apidocs.leadsquared.com/search-by-lead-criteria/) ", we do not get the record count or the number of records it has. we won't be able to do the manual pagination if we don't get the number of records in the response. 


In this case, there are two approaches:

1. There is a limit of 999 records per page. So you can call the API in an infinite loop with the page index incrementing each time to extract the response of each page with the page size as 999 and whenever the record count of the page is less than 999, you can stop the loop and end the API calls.


2. You can run the API in an infinite loop with an incrementing page index and whenever the response is null, exit the loop.

In both the approaches, you will not have to manually do the pagination also.


Reference ticket-https://support.leadsquared.com/a/tickets/114358