# Air Quality & Historical Weather Scraper (`get_anything/air-quality-scraper`) Actor

Air quality (PM2.5, PM10, US & European AQI, ozone, NO2, SO2, CO, dust) and historical daily weather (temperature, precipitation, wind) for any location by city name or coordinates. Built on Open-Meteo, no API key. Export JSON, CSV or Excel.

- **URL**: https://apify.com/get\_anything/air-quality-scraper.md
- **Developed by:** [Get Anything](https://apify.com/get_anything) (community)
- **Categories:** Other
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

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

## 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 & Historical Weather Scraper

Two things a forecast doesn't give you: **air quality** and **weather history** — for any location by **city name** (auto-geocoded) or **coordinates**. Built on **Open-Meteo's free API**. **No API key.**

### What it does

- **Air quality** — **PM2.5, PM10, US AQI & European AQI** (with a plain-English category), **ozone, NO2, SO2, CO, dust, UV**. Current, plus optional hourly.
- **Historical weather** — daily **max/min/mean temperature, precipitation, rain, snowfall, max wind & gusts** for any date range (Open-Meteo archive).
- **Multiple locations** in one run.
- Export to **JSON, CSV, or Excel**, or pull via the Apify API.

### Input

| Field | Description |
|-------|-------------|
| `locations` | City names, auto-geocoded. |
| `coordinates` | `lat,lon` pairs. |
| `getAirQuality` | Current air quality. |
| `airQualityHourly` | Also hourly air quality. |
| `getHistorical` | Historical daily weather. |
| `startDate` / `endDate` | `YYYY-MM-DD` (required for history). |
| `timezone` | IANA tz or `auto`. |

#### Example

```json
{ "locations": ["Delhi", "Los Angeles"], "getAirQuality": true,
  "getHistorical": true, "startDate": "2026-08-01", "endDate": "2026-08-31" }
```

### Output

```json
{ "resultType": "airQuality", "location": "Delhi", "usAqi": 168,
  "usAqiCategory": "Unhealthy", "pm2_5": 44.8, "pm10": 142, "ozone": 73 }
```

```json
{ "resultType": "historical", "location": "Delhi", "date": "2026-08-01",
  "tempMax": 43.1, "tempMin": 29.6, "precipitationSum": 0 }
```

### Use cases

- **Health & environment apps** — live AQI and pollutant levels by city.
- **Research & climate** — historical weather for any place and period.
- **Insurance / agriculture / energy** — long-run temperature & precipitation.
- **AI/RAG** — feed air-quality and climate data to an assistant.

### FAQ

**Do I need an API key?** No — it uses Open-Meteo's free API.

**How far back does history go?** Open-Meteo's archive covers many decades; set any `startDate`/`endDate`.

*Powered by Open-Meteo (CC-BY). Data is for information only.*

### 🤖 Use with Claude or ChatGPT (MCP)

Run this actor from Claude, ChatGPT, Cursor or any MCP client via the [Apify MCP server](https://mcp.apify.com). In **Claude Desktop**: Settings → Connectors → Add custom connector → `https://mcp.apify.com`. Or expose just this tool:

```json
{ "mcpServers": { "apify": { "url": "https://mcp.apify.com?tools=get_anything/air-quality-scraper" } } }
```

Full guide: [Connect Apify actors to Claude & ChatGPT](https://dev.to/get_anything/connect-any-apify-scraper-to-claude-or-chatgpt-in-2-minutes-mcp-37he).

### ⭐ Found this useful?

If this Actor saved you time, please leave a rating on its [Apify page](https://apify.com/get_anything/air-quality-scraper) — reviews genuinely help others discover it and help me keep improving it.

# Actor input Schema

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

City / place names, auto-geocoded, e.g. 'Delhi', 'Beijing', 'Los Angeles'.

## `coordinates` (type: `array`):

Exact coordinates as 'lat,lon'.

## `getAirQuality` (type: `boolean`):

Current air quality: PM2.5, PM10, US/European AQI, ozone, NO2, SO2, CO, dust, UV.

## `airQualityHourly` (type: `boolean`):

Also return hourly air-quality readings (more rows).

## `getHistorical` (type: `boolean`):

Historical daily weather for the date range below.

## `startDate` (type: `string`):

YYYY-MM-DD (required when historical weather is on).

## `endDate` (type: `string`):

YYYY-MM-DD (required when historical weather is on).

## `timezone` (type: `string`):

IANA timezone or 'auto'.

## Actor input object example

```json
{
  "locations": [
    "Delhi",
    "Los Angeles"
  ],
  "coordinates": [],
  "getAirQuality": true,
  "airQualityHourly": false,
  "getHistorical": false,
  "timezone": "auto"
}
```

# Actor output Schema

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

Structured results in the default dataset - one item per air-quality reading or historical day.

# 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": [
        "Delhi",
        "Los Angeles"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("get_anything/air-quality-scraper").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": [
        "Delhi",
        "Los Angeles",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("get_anything/air-quality-scraper").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": [
    "Delhi",
    "Los Angeles"
  ]
}' |
apify call get_anything/air-quality-scraper --silent --output-dataset

```

## MCP server setup

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

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/CeQMlMWacskrZPqEW/builds/8i29NRqr6S1HoYf5q/openapi.json
