Retrieving API data in a paginated API


I have been successful retrieving data from the following API but just single pages.

Here are the api docs

The specific URL I am pulling from is:

The issue that I have is that the data is paginated and I do not know how to create a query for paginated data with an unknown number of pages. I tried chatgpt to create it but I kept getting token errors.

Thank you