REST API how to paginate through all contacts?

Your software
My Mautic version is: 4.4.9
My PHP version is: 8.0.29
My Database type and version is: 10.6.12-MariaDB-0ubuntu0.22.04.1

Your problem
My problem is:

I am trying to use the /contacts endpoint to return tens and hundreds of thousands of contacts. Of course it returns a limited batch (default 30). I can’t practically increase that value to 100,000 of course, so I want to paginate through the results.

I was hoping to use the “start” parameter, however that does not seem to be a usable solution, since each time I call GET to /contacts I may get a different result - i.e. there is no context of the query saved.

Can anyone provide an example of how pagination through a list of contacts should work?

These errors are showing in the log: none

Solved my own problem. I ended up ordering by ID, and incrementing the start parameter by the batch size with each call to the /contacts endpoint. I have Python code if anyone needs an example.