Skip to content

Licenses

The Licenses resource provides information about the licenses that govern the use of data in OpenAQ. You can use it to get details about each license’s permissions and restrictions, such as whether attribution is required and whether commercial use, modification, or redistribution is allowed. This resource is most helpful to identify licensing requirements and ensure compliance with OpenAQ’s Terms of Use.

The Licenses resource provides the following methods:

  • get() - For accessing a single license by license ID.
  • list() - For accessing multiple licenses.

The get() method accepts one single licenses_id as an argument and returns details about that license in a LicensesResponse object.

get(
licenses_id: int
) -> LicensesResponse
argumentdescriptioninput requirements
licenses_idint OpenAQ’s unique ID for each licenseRequired
from openaq import OpenAQ
# Retrieve the license with ID 10
with OpenAQ(api_key="replace-me-with-a-valid-key") as client:
client.licenses.get(licenses_id=10)

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

list(
page: int = 1,
limit: int = 1000,
order_by: str | None = None,
sort_order: SortOrder | None = None
) -> LicensesResponse
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 license field by which to sort results, defaults to id. Currently only id is supported
sort_orderstr | 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 licenses on OpenAQ
with OpenAQ(api_key="your-api-key") as client:
client.licenses.list()

The Licenses objects in the results of the LicensesResponse 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
├── commercial_use_allowed: bool
├── attribution_required: bool
├── share_alike_required: bool
├── modification_allowed: bool
├── redistribution_allowed: bool
└── source_url: str