Official Python and R clients hit 1.0.0!
Stable 1.0.0 versions of the official OpenAQ Python and R client libraries are now available! These libraries represent the fastest, most reliable path to getting OpenAQ data into your environment.
Why use libraries versus writing all of your own code?
Working with an API often starts out simple, but hidden complexities quickly surface. What begins as a quick HTTP request soon demands additional code for managing authentication, handling pagination, and validating URLs. Achieving highly reliable code means also adding functionality for error handling and rate-limiting. These new OpenAQ libraries have these best practices built-in from the start, so you can focus on the data.
Python SDK
The OpenAQ Python SDK gives Python developers a fully-featured interface to the OpenAQ API. A single client object organizes every resource: locations, sensors, measurements, parameters, and more, making it straightforward to navigate from retrieving data from a city to a specific monitoring station to a full year of daily averages without piecing together endpoints yourself.
Available on PyPI, install the SDK with pip or uv, authenticate with an OpenAQ API key and start querying.
The OpenAQ Python SDK has the following benefits:
- API Responses come back as deserialized Python objects rather than raw JSON, meaning less parsing code and better editor support for autocomplete and type hinting.
- Validation catches malformed queries before they leave your machine, with clear descriptive error messages.
- For production workflows, automatic rate limit handling and HTTP connection pooling means that scripts that pull large datasets or run on a schedule just work, no custom logic needed.The SDK ships with extensive test coverage, type annotations, and detailed docstrings on every method.
- A full documentation site covers everything from quickstart guides to common workflows.
Python links:
- Documentation: https://python.openaq.org
- GitHub: https://github.com/openaq/openaq-python
- PyPI: https://pypi.org/project/openaq/
R Package
The OpenAQ R package gives R users a native, idiomatic way to work with OpenAQ data. Rather than manually constructing httr requests, writing pagination loops, and parsing nested JSON manually, the package provides functions that map directly to OpenAQ resources and return typed data frames ready for analysis.
Available on CRAN, install the package, set your API key with and start pulling data directly into your R environment.
The OpenAQ R package has the following benefits:
- Filtering locations by pollutant and country, inspecting sensors, fetching measurements, and plotting results all happen through a handful of named function calls.
- Automatic rate limiting and built-in plotting support make the package well suited to both quick exploratory work and reproducible research pipelines.
- Like the Python SDK, the R package is covered by thorough test coverage and comprehensive roxygen2 comment, with a full documentation site including function references, vignettes, and examples to help users get productive quickly.
R links
- Documentation: https://openaq.github.io/openaq-r
- GitHub: https://github.com/openaq/openaq-r
- CRAN: https://cran.r-project.org/web/packages/openaq/
Moving forward with the official libraries
With the release of version 1.0.0, these official libraries are now the recommended standard for accessing OpenAQ data. By automatically managing authentication, rate-limiting, and data parsing, they eliminate the need to write complex, custom API logic. Switching to these official clients guarantees the most stable and reliable workflow for your air quality data analysis.
