Skip to content

Instruments

The Instruments resource provides information about the air quality measuring devices that gather the data at each monitoring location. You can use it to get an instrument’s available details: name, manufacturer, and whether it is used for regulatory purposes.

The Instruments resource provides the following methods:

  • get() - For accessing a single instrument by instrument ID.
  • list() - For accessing multiple instruments.

The get() method accepts one single instruments_id as an argument and returns details about that instrument in a InstrumentsResponse object.

get(
instruments_id: int
) -> InstrumentsResponse
argumentdescriptioninput requirements
instruments_idint OpenAQ’s unique ID for each instrumentRequired
from openaq import OpenAQ
# Retrieve information about the instrument with ID=1 on OpenAQ
with OpenAQ(api_key="replace-me-with-a-valid-key") as client:
client.instruments.get(instruments_id=1)

The list() method takes optional arguments and returns instruments on the OpenAQ platform that meet all the conditions specified in a InstrumentsResponse object. If no argument is included, the method returns all instruments using the default arguments.

list(
page: int = 1,
limit: int = 1000,
order_by: str | None = None,
sort_order: SortOrder | None = None
) -> InstrumentsResponse
argumentdescriptioninput requirements
pageint The page number to retrieve, defaults to 1Must be greater than zero
limitint The number of results returned per page, defaults to 1,000Must be between 1 and 1,000
order_bystr | None The instrument field by which to sort results, defaults to id. Currently only id is supported
sort_orderSortOrder | None The sort direction for the order_by field, defaults to descMust be one of: asc, desc, ASC, DESC
from openaq import OpenAQ
# List all instruments on OpenAQ
with OpenAQ(api_key="your-api-key") as client:
client.instruments.list()

The Instrument objects in the results of the InstrumentsResponse contain attributes that have all data about them. The hierarchy below presents the depth of the attributes and their datatypes.

results[]
├── id: int
├── name: str
├── is_monitor: bool
└── manufacturer:
├── id: int
└── name: str