How does the “page” parameter work? |
If the API is returning relatively few rows (like 100), then please read through our FAQ on that first.
If you have already set the “limit” parameter higher, or you would specifically like to get data from the API in smaller batches (such as 10 or 100 or 1,000 rows), then you might want to add the “page” parameter to your request JSON. We recommend checking the documentation page for the API endpoint you are using here to make sure the “page” parameter is available, but in general, you can request rows beyond the “limit” using the “page” parameter.
By default, the “page” parameter is usually set to 1, so you get the first “page” of data. What is displayed on each “page” of data directly depends on what you have set in the “limit” parameter. Let’s look at two extreme examples to see how these parameters work in conjunction with one another. For these examples, let’s assume that we already know the underlying data set contains 90,000 rows.
Example 1: You have already set the “limit” parameter to 50,000 rows, which is the maximum that the API will return for this endpoint in this example, and you have already gotten row 1 to row 50,000 from the API. How do you get row 50,001 to row 90,000? You can add “page”: 2 to the request JSON and send a second API request. The second API request will return data for row 50,001 to row 90,000. *Pro tip: If you are building an automated process to pull data from the API, then you might want to add some logic that checks if the number of rows returned by the API matches the value in the “limit” parameter and then makes additional requests until all of the data has been retrieved.
Example 2: You are not interested in retrieving 50,000 rows at once, since your process calls for retrieving only 1 row of data at a time. You have already set the “limit” parameter to 1 and have data for row 1. How do you get data for rows 2 to 90,000? Just like the example above, you would want to add the “page”: 2 to the request JSON and send a second API request to get data for row 2. To get data for row 3, you should add “page”: 3 to the request JSON and send a third API request. You would continue to increment the “page” parameter and send a total of 90,000 API requests to retrieve all 90,000 rows of data. This is obviously an extreme example and is not practical, but the same logic applies when you are retrieving 100 or 532 rows of data at a time.
See also: Why does the API only return 100 rows of data when I know there is more data than that?