Skip to content

Pagination

The OpenAQ platform holds vast amounts of data. Because of this, the API returns data in smaller subsets. Pagination helps you fetch large datasets across multiple requests.

The OpenAQ Python SDK supports page and limit arguments for all resources that use a list() method.

  • page - the page number to retrieve. Defaults to 1. Must exceed zero.
  • limit - the number of results per page. Defaults to 100. Must range from 1 to 1000.

To retrieve the first 50 results:

locations = client.locations.list(page=1, limit=50)

To retrieve the next 50 results, increment page:

locations = client.locations.list(page=2, limit=50)

Every response includes a meta object with metadata. The meta.found field shows the total number of matching records. Use this value to calculate the total page count.

If meta.found returns ‘>1000’, you cannot calculate the exact page count in advance. Narrow your query using filters like countries_id or parameters_id to reduce the dataset size. See the meta object reference for all available fields.

The Paging Results page provides examples on how to use the meta object and pagination logic.