Skip to content

Resources

The OpenAQ API uses a resource-based design. Each endpoint returns data specific to that resource. The OpenAQ Python SDK simplifies these calls by exposing resources directly through the client. Every SDK response supports reading data as a Python object, a dictionary, or a JSON string.

from openaq import OpenAQ
with OpenAQ(api_key="replace-with-valid-openaq-api-key") as client:
response = client.instruments.get(instruments_id=2)
from openaq import OpenAQ
with OpenAQ(api_key="replace-with-valid-openaq-api-key") as client:
# client.instruments represents the Instruments resource
response = client.instruments.get(instruments_id=2)

To make the SDK predictable and easy to navigate, every resource exposes a consistent interface. As you browse the individual resource pages, you will see the same design patterns repeated across all endpoints.

Most resources implement two primary methods for interacting with the underlying data:

  • .get(): Used when you know the unique identifier for a specific asset (for example, a specific country or location ID). This targets a single record and requires a path argument.
  • .list(): Used to browse, filter, or page through collections of records. This method accepts optional query arguments and returns all records matching your criteria.

You can access the various aspects of the OpenAQ dataset using the following core client properties:

ResourceClient PropertyPrimary Purpose
Locationsclient.locationsQuery physical monitoring stations to find coordinates, operating hardware, and baseline metrics.
Sensorsclient.sensorsQuery individual measuring units to check reporting intervals, physical locations, and data coverage stats.
Measurementsclient.measurementsQuery raw or aggregated air quality data by fixed intervals or custom time-based averages.
Licensesclient.licensesQuery data usage rules, including permissions for commercial use, attribution, and modification rights.
Manufacturersclient.manufacturersQuery companies that build monitoring hardware and list all of their equipment models.
Instrumentsclient.instrumentsQuery specific hardware details, device names, and whether equipment meets regulatory standards.
Parametersclient.parametersQuery tracked variables (gases, particulates, weather metrics) and pull recent global readings.
Providersclient.providersQuery organizations supplying data feeds and filter them by region or reporting timelines.
Ownersclient.ownersQuery the upstream entities or individuals that own and manage the physical monitoring hardware.
Countriesclient.countriesQuery countries with active monitoring stations to track coverage windows and country codes.