Skip to main content

purple_air_api (PAA)

This is a wrapper for the PurpleAirAPI (PAA) with a C++ backend and SWIG bindings for Python, JavaScript, C#, and Go. Details of the API can be found using this link: https://api.purpleair.com/#api-welcome

To use the PurpleAirAPI (PAA), API keys are required. You can get API keys by sending an email to contact@purpleair.com with a first and last name to assign them to.

New in CalSemVer: The library now uses a high-performance C++ backend with SWIG bindings, providing native performance while maintaining full backward compatibility with existing Python code.

Python Tests JavaScript Tests C# Tests Go Tests Black Sphinx Docs

Codecov SonarCloud Quality Gate SonarCloud Security Rating SonarCloud Maintainability Rating CodeQL

PyPI Version TestPyPI Version PyPI Downloads npm Version npm Downloads PyPI Distributions TestPyPI Distributions

License

How to Support This Project

Buy Me A Coffee

Purpose

This package is designed to be used for making tools around the PurpleAir API.

For example, PAA data loggers - https://github.com/carlkidcrypto/purpleair_data_logger

Requirements

  • Python 3.10 or higher (supports Python 3.10, 3.11, 3.12, 3.13, and 3.14)

  • requests library

Installation

Prerequisites

The C++ backend requires:

  • Linux/Ubuntu: sudo apt-get install build-essential libcurl4-openssl-dev swig meson ninja-build

  • macOS: brew install curl swig meson ninja

  • Windows: Visual Studio C++, SWIG, curl library, Meson, and Ninja

Installation via pip

You can install the PurpleAir API via pip:

python3 -m pip install purpleair_api

Installation from source

You can also install PurpleAir API by cloning down this repo:

git clone https://github.com/carlkidcrypto/purpleair_api.git
cd purpleair_api

Multi-Language Support

The repository is structured to support multiple languages:

PurpleAirAPI Usage Example

First we need to import the PurpleAir API (PAA):

from purpleair_api.PurpleAirAPI import PurpleAirAPI

Next we need to make an instance of PAA:

my_paa = PurpleAirAPI(your_api_read_key, your_api_write_key, [your_ipv4_address])

Now you can use that PAA instance to do things like:

retval = my_paa.request_sensor_data(1234)

PurpleAirReadAPI Usage Example

First we need to import the PurpleAirReadAPI:

from purpleair_api.PurpleAirReadAPI import PurpleAirReadAPI

Now we need to make an instance of it:

my_paa = PurpleAirReadAPI(api_read_key)

Now we can use that instance to do things like:

retval = my_paa.request_multiple_sensors_data("name")

PurpleAirWriteAPI Usage Example

First we need to import the PurpleAirWriteAPI:

from purpleair_api.PurpleAirWriteAPI import PurpleAirWriteAPI

Now we need to make an instance of it:

my_paa = PurpleAirWriteAPI(api_write_key)

Now we can use that instance to do things like:

retval = my_paa.post_create_member(group_id=1234, sensor_index=5678)

PurpleAirLocalAPI Usage Example

First we need to import the PurpleAirLocalAPI:

from purpleair_api.PurpleAirLocalAPI import PurpleAirLocalAPI

Now we need to make an instance of it:

my_paa = PurpleAirLocalAPI(["ipv4_address"])

Now we can use that instance to do things like:

retval = my_paa.request_local_sensor_data()

Tests

Refer to the test README

Documentation

Full API documentation is available at https://carlkidcrypto.github.io/purpleair_api/


This content was generated by AI and reviewed by humans. Mistakes may still occur. PRs for corrections are welcome.

Matter Device Converter (Matter 1.5.1)

Map PurpleAir sensor data to Matter device type structures for use with Matter-compatible ecosystems (Apple Home, Google Home, Alexa, SmartThings, Home Assistant Matter integration).

Supports Matter 1.5.1 Air Quality Sensor (Device Type 0x002D), Temperature Sensor, and Environmental Sensor device types with full EPA AQI calculation.

from purpleair_api.PurpleAirReadAPI import PurpleAirReadAPI
from purpleair_api.PurpleAirMatterConverter import PurpleAirMatterConverter

pa = PurpleAirReadAPI("YOUR_READ_API_KEY")
raw = pa.request_sensor_data(282168)

matter_device = PurpleAirMatterConverter.to_air_quality_sensor(raw)
print(matter_device["air_quality_summary"])
# {'epa_aqi': 68, 'epa_category': 'Moderate',
#  'matter_air_quality_rating': 'GOOD', ...}

See the Matter implementation guide at sphinx_docs_build/source/matter_implementation.rst or docs/html/matter_implementation.html after building, or read the rendered guide online at https://carlkidcrypto.github.io/purpleair_api/matter_implementation.html. The API reference remains available at sphinx_docs_build/source/PurpleAirMatterConverter.rst.

References:

Metadata

Release files for purpleair-api 2026.11.26

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for purpleair-api 2026.11.26
File Size Uploaded Provenance Actions
purpleair_api-2026.11.26.tar.gz 70.3 kB With provenance Details for purpleair_api-2026.11.26.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for purpleair-api 2026.11.26
File Actions
purpleair_api-2026.11.26-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details for purpleair_api-2026.11.26-cp313-cp313-win_amd64.whl
purpleair_api-2026.11.26-cp313-cp313-manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.28+ x86-64 Details for purpleair_api-2026.11.26-cp313-cp313-manylinux_2_28_x86_64.whl
purpleair_api-2026.11.26-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details for purpleair_api-2026.11.26-cp313-cp313-macosx_11_0_arm64.whl
purpleair_api-2026.11.26-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details for purpleair_api-2026.11.26-cp312-cp312-win_amd64.whl
purpleair_api-2026.11.26-cp312-cp312-manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ x86-64 Details for purpleair_api-2026.11.26-cp312-cp312-manylinux_2_28_x86_64.whl
purpleair_api-2026.11.26-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details for purpleair_api-2026.11.26-cp312-cp312-macosx_11_0_arm64.whl
purpleair_api-2026.11.26-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details for purpleair_api-2026.11.26-cp311-cp311-win_amd64.whl
purpleair_api-2026.11.26-cp311-cp311-manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.28+ x86-64 Details for purpleair_api-2026.11.26-cp311-cp311-manylinux_2_28_x86_64.whl
purpleair_api-2026.11.26-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details for purpleair_api-2026.11.26-cp311-cp311-macosx_11_0_arm64.whl

Total release size: 16.1 MB

Release files / purpleair_api-2026.11.26.tar.gz

Download URL purpleair_api-2026.11.26.tar.gz
Size 70.3 kB
Tags Source
SHA-256 checksum
How to use checksums
c00302098c0d4c6694d3b51db87918973af18266d792626c60e12a54dffb6846
BLAKE2b-256 checksum
How to use checksums
e9c3b90caeefd31dd2a6bd3d717eb14b9189022281cffef84d33909c2f410c0a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

Release files / purpleair_api-2026.11.26-cp313-cp313-win_amd64.whl

Download URL purpleair_api-2026.11.26-cp313-cp313-win_amd64.whl
Size 807.0 kB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
01b21ecc71b76dbf345677e3294c53d2f6a62813785f28840853c27341e66066
BLAKE2b-256 checksum
How to use checksums
5b33b6f88654d58388ca6395e4702bd0b3ad377630c72138f1888b7b2418edc1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

Release files / purpleair_api-2026.11.26-cp313-cp313-manylinux_2_28_x86_64.whl

Download URL purpleair_api-2026.11.26-cp313-cp313-manylinux_2_28_x86_64.whl
Size 4.4 MB
Tags CPython 3.13 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
82969213f7c65c866dde90b574864d16c14632aa81a51fc745875c604caac53e
BLAKE2b-256 checksum
How to use checksums
dec902a20817973328a3a8cbbe6960fc4cf6b7a3a96bd273e461d70f2693f3b2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

Release files / purpleair_api-2026.11.26-cp313-cp313-macosx_11_0_arm64.whl

Download URL purpleair_api-2026.11.26-cp313-cp313-macosx_11_0_arm64.whl
Size 119.4 kB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
52cbca6b0ab377078c4da2af6f2dde1b6ee1e56f37f814ed5206ec5a3f06900e
BLAKE2b-256 checksum
How to use checksums
d7b322a86070172638b9f841d4277726aa0f76618272471bbe4465f33da97d75
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

Release files / purpleair_api-2026.11.26-cp312-cp312-win_amd64.whl

Download URL purpleair_api-2026.11.26-cp312-cp312-win_amd64.whl
Size 807.1 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
b021efbf7db0dc36265836cedcc0112e1fea7ccdafea671b7f91e06f4e3eab38
BLAKE2b-256 checksum
How to use checksums
7f8457d848424a787613255b4ad086908f88e0748e6500f51c175fe84cbad453
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

Release files / purpleair_api-2026.11.26-cp312-cp312-manylinux_2_28_x86_64.whl

Download URL purpleair_api-2026.11.26-cp312-cp312-manylinux_2_28_x86_64.whl
Size 4.4 MB
Tags CPython 3.12 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
57e6a4682c0e33bd6483747a2a6437a5062e69662562f37b5b39e2d70f1eb660
BLAKE2b-256 checksum
How to use checksums
8417993a4c48e8feb1f7343a30b5ae1290f1522ca9490592b5686848c15a1260
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

Release files / purpleair_api-2026.11.26-cp312-cp312-macosx_11_0_arm64.whl

Download URL purpleair_api-2026.11.26-cp312-cp312-macosx_11_0_arm64.whl
Size 119.7 kB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
aea6a2bedc5bf7d24df96cd56b64c0073dc61f031aee49ddc09a9fd82fc1b0fd
BLAKE2b-256 checksum
How to use checksums
35c0e070b614a61b78b14df0e66351d0d56775393bc21ff37b625a83197eb9f1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

Release files / purpleair_api-2026.11.26-cp311-cp311-win_amd64.whl

Download URL purpleair_api-2026.11.26-cp311-cp311-win_amd64.whl
Size 807.4 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
aaa032dd0a1aae29cdcd535e46e4b2cd72148e48e9ab749c3c889645048bf4c8
BLAKE2b-256 checksum
How to use checksums
3328e4ec11fcf85443372afe6fde3d9f84972314f0bacf5d50be094e0a3b4ea0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

Release files / purpleair_api-2026.11.26-cp311-cp311-manylinux_2_28_x86_64.whl

Download URL purpleair_api-2026.11.26-cp311-cp311-manylinux_2_28_x86_64.whl
Size 4.4 MB
Tags CPython 3.11 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
5cc660aeae1bb05d3337bcf77542b8c7406799590a2bcade197540aef86ef130
BLAKE2b-256 checksum
How to use checksums
0e40c1c85919d5b160d93f3b3cb124b333df43436dbaf2d4223814c91b427fdd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

Release files / purpleair_api-2026.11.26-cp311-cp311-macosx_11_0_arm64.whl

Download URL purpleair_api-2026.11.26-cp311-cp311-macosx_11_0_arm64.whl
Size 119.3 kB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
8e16641d8b795160a1f0e039fb571055a4b3469c11c2519b9504459df05b4fa5
BLAKE2b-256 checksum
How to use checksums
73823f8e046608940e5cf3377162eb3f5c48e9cdef3eee5ffb73f43dd9da80e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

Security for purpleair-api 2026.11.26

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 10 files in this release have been uploaded with provenance metadata.

Select from 10 files

Attestation for purpleair_api-2026.11.26.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page