# Air Quality API — AQI, PM2.5, PM10, Ozone by City (`ponderable_hydrometer/air-quality`) Actor

Air quality API: European and US AQI, PM2.5, PM10, ozone, NO2, SO2, CO, dust and UV index for any city or coordinates. Current values, hourly history up to 92 days and a forecast of about 5 days. Air pollution model data from Copernicus CAMS via Open-Meteo. No key.

- **URL**: https://apify.com/ponderable_hydrometer/air-quality.md
- **Developed by:** [Ponderable Hydrometer](https://apify.com/ponderable_hydrometer) (community)
- **Categories:** Travel, Developer tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.50 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Air Quality API — AQI, PM2.5, PM10, Ozone by City

**Air quality for any place on Earth, now, recently and for the next days.** European and US AQI plus the pollutants behind them (PM2.5, PM10, ozone, NO2, SO2, CO, dust) and the UV index, hour by hour. Use it for air pollution dashboards, health and travel apps, or to join pollution with your own data. Source: Copernicus CAMS model data through the Open-Meteo API, with no key.

### What you can do with it

- **Show current AQI** for a list of cities or coordinates.
- **Pull hourly history** (up to 92 days back) to study pollution episodes.
- **Get a forecast** of about 5 days for planning outdoor activity or deliveries.
- **Join pollution with your own data** by place and hour.

### Input

| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `locations` | array | — | City names (e.g. `Bucharest`) or `lat,lon`. |
| `pastDays` | integer | `0` | Days of history before today (0-92). |
| `forecastDays` | integer | `1` | Days ahead, including today (1-7). |
| `hourly` | boolean | `true` | One row per hour; off gives one row per location with the current values. |

Example: `{"locations": ["Bucharest", "Delhi", "44.43,26.10"], "pastDays": 1, "forecastDays": 3}`

### What you get

One row per location and hour (or one current row): `query`, `place`, `country`, `latitude`, `longitude`, `timezone`, `time`, `european_aqi`, `us_aqi`, `pm2_5`, `pm10`, `ozone`, `nitrogen_dioxide`, `sulphur_dioxide`, `carbon_monoxide`, `dust`, `uv_index`. Concentrations are µg/m³; `time` is local time at the place.

### Output sample

```json
{
  "query": "Bucharest",
  "place": "Bucharest",
  "country": "Romania",
  "latitude": 44.43225,
  "longitude": 26.10626,
  "timezone": "Europe/Bucharest",
  "time": "2026-11-15T22:00",
  "european_aqi": 48,
  "us_aqi": 71,
  "pm2_5": 21.4,
  "pm10": 29.8,
  "ozone": 32,
  "nitrogen_dioxide": 27.1,
  "sulphur_dioxide": 4.2,
  "carbon_monoxide": 312,
  "dust": 0,
  "uv_index": 0
}
```

### Use it from the API or an AI agent

```bash
curl -X POST "https://api.apify.com/v2/acts/ponderable_hydrometer~air-quality/run-sync-get-dataset-items?token=<YOUR_API_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{"locations": ["Bucharest", "Delhi"], "hourly": false}'
```

Through the Apify MCP server, an AI agent can call it as a tool: `https://mcp.apify.com?tools=ponderable_hydrometer/air-quality`.

### Limits and good to know

- **Values are model estimates** (CAMS, roughly 11 km grid in Europe and 40 km globally), not readings from a single street-level station. They can differ from a local sensor.
- **The forecast reaches about 5 days.** Later hours come back empty from the source; the Actor drops hours with no value at all, so they are never charged.
- A city name uses the first match from the Open-Meteo geocoder; pass `lat,lon` to be exact. `country` is empty for coordinate input.
- Hourly mode returns 24 rows per day per location, so a long history for many places adds up; use `hourly: false` for a snapshot.
- Open-Meteo data is CC BY 4.0; attribute Open-Meteo and CAMS if you publish it.
- A place that cannot be found is skipped with a warning; if nothing is returned the run ends as FAILED.

### FAQ

**Which AQI scales are included?** Both the European and the US AQI.

**Does it cover my country?** Coverage is global, with finer resolution over Europe.

**Is it real-time station data?** No, it is modelled data; see the limits above.

### Pricing

Pay per result — **$0.50 per 1,000 results** (one row = one result), plus Apify's standard per-run start event ($0.00005 per GB of memory, so a fraction of a cent per run). No subscription.

# Actor input Schema

## `locations` (type: `array`):

City names (e.g. "Bucharest") or "lat,lon".

## `pastDays` (type: `integer`):

Hours of history before today.

## `forecastDays` (type: `integer`):

Days ahead, including today.

## `hourly` (type: `boolean`):

On: one row per hour. Off: one row per location with the current values.

## Actor input object example

```json
{
  "locations": [
    "Bucharest",
    "Delhi",
    "Berlin"
  ],
  "pastDays": 0,
  "forecastDays": 1,
  "hourly": false
}
```

# Actor output Schema

## `results` (type: `string`):

All rows produced by this run, as JSON.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "locations": [
        "Bucharest",
        "Delhi",
        "Berlin"
    ],
    "hourly": false
};

// Run the Actor and wait for it to finish
const run = await client.actor("ponderable_hydrometer/air-quality").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "locations": [
        "Bucharest",
        "Delhi",
        "Berlin",
    ],
    "hourly": False,
}

# Run the Actor and wait for it to finish
run = client.actor("ponderable_hydrometer/air-quality").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "locations": [
    "Bucharest",
    "Delhi",
    "Berlin"
  ],
  "hourly": false
}' |
apify call ponderable_hydrometer/air-quality --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,ponderable_hydrometer/air-quality"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/iGd8ySdCb2awIXlQf/builds/qK3xix1HAOAD7m2Te/openapi.json
