# Weather, Air Quality & Earthquake Risk API by Location (`centorprat/weather-air-quality-earthquake-api`) Actor

Weather, air quality (AQI, PM2.5) and nearby earthquakes for any place on Earth in one call, plus a clear/caution/hazard verdict with reasons. Use it to check conditions or hazards at a location; many locations per run. Keyless (Open-Meteo + USGS); webhook alerts.

- **URL**: https://apify.com/centorprat/weather-air-quality-earthquake-api.md
- **Developed by:** [Centor Prat](https://apify.com/centorprat) (community)
- **Categories:** Developer tools, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $4.25 / 1,000 location assesseds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

## 🌍 Weather, Air Quality & Earthquake Risk API by Location

**One call, three live sources, one answer.** For any point (or many), this **fuses current
weather + air quality + recent earthquakes** into a single **computed verdict** —
`clear` / `caution` / `hazard` — with the exact hazard **flags** and **reasons**, instead of
making your agent hit three APIs and stitch the result.

Headless · **keyless** (no API keys to manage) · structured JSON out · built for AI agents.

### ⚡ Why it's different

Other actors give you *raw* weather, *raw* air quality, or *raw* quakes. This one **composes and
judges** them: strong gusts ☁️ + unhealthy air 😷 + a nearby M5 quake 🌋 → one `hazard` verdict
with the reasons spelled out. Ask once, decide immediately.

### 📋 What it does & what you get

| Field | Meaning |
|---|---|
| `status` | Computed verdict: `clear` · `caution` · `hazard` |
| `flags` | e.g. `high_wind`, `heavy_precip`, `low_visibility`, `poor_air`, `strong_quake`, `dark` |
| `reasons` | Human-readable why (e.g. "notable earthquake nearby (M4.9)") |
| `weather` | temp °C, wind & gusts km/h, precip mm, visibility m, is-day, sunrise/sunset, condition |
| `airQuality` | PM2.5, PM10, US AQI + band, EU AQI, ozone, NO₂ |
| `seismic` | count, max magnitude, and the recent events (place, time, depth) |
| `sources` | the three upstream sources (attribution) |

### 📥 Input

| Field | Type | Meaning |
|---|---|---|
| `latitude`, `longitude` | number | A single point (decimal degrees) |
| `label` | string | Optional name for that point |
| `locations` | array | Many points: `[{"latitude":35.68,"longitude":139.69,"label":"Tokyo"}]` |
| `radiusKm` | integer | Earthquake search radius (default 300) |
| `quakeLookbackDays` | integer | Days back to search quakes (default 7) |
| `minMagnitude` | number | Ignore quakes below this (default 2.5) |
| `onlyAlerts` | boolean | Drop `clear` points (great with a schedule) |
| `webhookUrl` | string | POST results here if any (Zapier/Make/n8n/custom) |

**Example input**

```json
{
  "locations": [
    { "latitude": 35.68, "longitude": 139.69, "label": "Tokyo" },
    { "latitude": 40.4168, "longitude": -3.7038, "label": "Madrid" }
  ],
  "radiusKm": 300,
  "quakeLookbackDays": 7,
  "minMagnitude": 2.5
}
```

### 📤 Output (one row per point)

```json
{
  "label": "Tokyo", "latitude": 35.68, "longitude": 139.69,
  "status": "caution", "flags": ["quake"], "reasons": ["notable earthquake nearby (M4.9)"],
  "weather": { "weather": "mainly clear", "temperatureC": 16, "windGustKmh": 22,
               "visibilityM": 32740, "isDay": true, "sunrise": "2026-...T05:48", "sunset": "2026-...T17:11" },
  "airQuality": { "usAqi": 63, "aqiBand": "moderate", "pm2_5": 17.3, "pm10": 24.1 },
  "seismic": { "count": 5, "maxMag": 4.9, "events": [ { "mag": 4.9, "place": "...", "timeUtc": "2026-..." } ] },
  "sources": ["open-meteo.com", "air-quality-api.open-meteo.com", "earthquake.usgs.gov (USGS)"],
  "capturedAt": "2026-..."
}
```

### 💡 Use cases

- **Field / drone / outdoor ops:** is this site safe to operate right now, and why?
- **Logistics & delivery:** flag routes/depots hitting severe wind, low visibility or heavy rain.
- **Travel & events:** a one-shot "is it clear at this destination" check across many points.
- **Agent tools:** give a location assistant one call instead of three APIs + glue code.
- **Scheduled monitoring:** watch a set of sites and get pinged only on caution/hazard.

### 🤖 For AI agents (MCP)

Keyless, one call → a fused, judged answer with the raw sub-data attached for grounding. Every
input is described in the schema for programmatic/MCP use. Example MCP server config:

```json
{
  "mcpServers": {
    "location-conditions": {
      "url": "https://mcp.apify.com/?tools=actors,docs,centorprat/weather-air-quality-earthquake-api"
    }
  }
}
```

**Claude Code:** `claude mcp add --transport http apify "https://mcp.apify.com/?tools=actors,docs,centorprat/weather-air-quality-earthquake-api" --header "Authorization: Bearer <YOUR_APIFY_TOKEN>"`

No extra setup: this Actor is callable from Claude, Cursor, ChatGPT or any MCP client through the Apify MCP server, and agents can find it on their own with the server's `search-actors` tool.

### 🔔 Alerts (scheduled)

Set `onlyAlerts: true` + `webhookUrl`, add an Apify **Schedule** (e.g. every 30 min), and get
pinged only when a watched location turns `caution`/`hazard`.

### 🚀 Ready-made tasks (one click)

Pre-configured runs for the most common jobs. Open one, change the input, run:

- [Air Quality & Weather Now for Any City](https://apify.com/centorprat/weather-air-quality-earthquake-api/examples/air-quality-weather-any-city): Current AQI, PM2.5, PM10 and weather for many cities in one call, with a hazard verdict per city. Keyless air quality API.
- [Recent Earthquakes Near a Location (USGS)](https://apify.com/centorprat/weather-air-quality-earthquake-api/examples/earthquakes-near-location): Recent USGS earthquakes near any lat/lon with magnitude, distance and time, plus weather, air quality and a hazard verdict.
- [Travel Destination Weather & Hazard Check](https://apify.com/centorprat/weather-air-quality-earthquake-api/examples/travel-destination-weather-hazard-check): Weather, air quality and earthquake check for travel destinations, with a clear/caution/hazard verdict per place. One call, many places.

### ❓ FAQ

- **Do I need an API key?** No — all three sources are keyless and free; you only pay the Actor's per-result fee.
- **How fresh is it?** Weather & air quality are current; earthquakes cover your chosen lookback window (default 7 days).
- **How many locations per run?** As many as you pass in `locations`; you're billed per location assessed.
- **What makes a `hazard` vs `caution`?** Severe thresholds (e.g. gusts ≥60 km/h, US AQI ≥151, precip ≥7 mm, M≥5.5) → `hazard`; moderate thresholds → `caution`; otherwise `clear`.
- **Why both US and EU AQI?** Different regions read air quality on different scales; you get both plus a plain-language band.
- **Can I only get alerts?** Yes — `onlyAlerts: true` drops `clear` points; add `webhookUrl` to push them out.
- **What units?** Temperature °C, wind km/h, precipitation mm, visibility m, magnitudes on the USGS scale.
- **Is the data stored?** No — it's fetched, composed, returned. Nothing is retained.
- **Is this legal to use commercially?** Yes — Open-Meteo is free for commercial use with attribution; USGS data is U.S. public domain.
- **What if a source is down?** The row still returns with whatever composed successfully; the failed sub-object carries an error flag.

### 📜 Data & attribution

Weather & air quality from **Open-Meteo** (open data, free for commercial use with attribution);
earthquakes from the **USGS** earthquake feed (U.S. public domain). This actor retrieves and
composes public data; it stores none of it.

### 🔗 Related actors

Part of one suite of keyless, agent-ready composers by the same developer:

- [Shopify Store Leads + App Audit (Reviews, Email, Pixels)](https://apify.com/centorprat/shopify-store-leads-app-audit): Shopify stores by niche, verified and audited for missing apps (reviews, email/SMS, upsell, loyalty, chat, subscriptions), pixels and theme: scored leads with emails.
- [Google Maps Leads + Website Audit for Agencies](https://apify.com/centorprat/google-maps-leads-website-audit): local businesses from Google Maps audited for website, Google profile, reviews, booking and tracking gaps: scored, explained leads with phone and emails.
- [FEMA Flood Zone & Property Risk API - Zillow/Redfin Enricher](https://apify.com/centorprat/fema-flood-zone-property-risk): FEMA flood zone + 18-hazard FEMA risk index + neighborhood demographics per US address, or for a whole Zillow/Redfin dataset.
- [Domain Lookup API - DNS, MX, SPF, Tech & Contact Emails](https://apify.com/centorprat/domain-lookup-dns-mx-email): DNS + live homepage → IPs, MX/SPF, tech, socials and public contacts per domain.
- [Wikipedia & Wikidata API - Entity Facts, Summary & Pageviews](https://apify.com/centorprat/wikipedia-wikidata-api): Wikipedia + Wikidata + pageviews → one structured brief per company, person or place.
- [Country Economic Data API - World Bank GDP, FX & Holidays](https://apify.com/centorprat/world-bank-country-economic-data): World Bank + FX + public holidays → one market brief per country.
- [Aircraft Tracker API (ADS-B) - Approach & Military Alerts](https://apify.com/centorprat/aircraft-tracker-adsb): aircraft approaching a point with CPA/ETA + military/unidentified flags and alerts.
- [NARA Catalog Extractor](https://apify.com/centorprat/nara-catalog-extractor): US National Archives catalog search → digital-object download URLs + metadata.

# Actor input Schema

## `latitude` (type: `number`):

Latitude in decimal degrees for a single point. Example: 40.4168

## `longitude` (type: `number`):

Longitude in decimal degrees for a single point. Example: -3.7038

## `label` (type: `string`):

Optional name for the single point (e.g. a site or city).

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

Instead of (or in addition to) a single point, pass an array of objects: \[{"latitude":35.68,"longitude":139.69,"label":"Tokyo"}]

## `radiusKm` (type: `integer`):

Look for recent earthquakes within this radius of each point.

## `quakeLookbackDays` (type: `integer`):

How many days back to search for earthquakes.

## `minMagnitude` (type: `number`):

Ignore earthquakes below this magnitude. Example: 2.5

## `onlyAlerts` (type: `boolean`):

If true, points whose computed status is 'clear' are dropped (useful with a schedule + webhook).

## `webhookUrl` (type: `string`):

If set and there are results, they are POSTed here as JSON. Pair with a schedule + onlyAlerts for proximity alerting.

## Actor input object example

```json
{
  "latitude": 40.4168,
  "longitude": -3.7038,
  "radiusKm": 300,
  "quakeLookbackDays": 7,
  "minMagnitude": 2.5,
  "onlyAlerts": false
}
```

# Actor output Schema

## `assessments` (type: `string`):

One fused assessment per point: computed status (clear/caution/hazard) + hazard flags + reasons, plus the raw weather, air-quality and seismic sub-objects and source attributions.

# 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 = {
    "latitude": 40.4168,
    "longitude": -3.7038,
    "minMagnitude": 2.5
};

// Run the Actor and wait for it to finish
const run = await client.actor("centorprat/weather-air-quality-earthquake-api").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 = {
    "latitude": 40.4168,
    "longitude": -3.7038,
    "minMagnitude": 2.5,
}

# Run the Actor and wait for it to finish
run = client.actor("centorprat/weather-air-quality-earthquake-api").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 '{
  "latitude": 40.4168,
  "longitude": -3.7038,
  "minMagnitude": 2.5
}' |
apify call centorprat/weather-air-quality-earthquake-api --silent --output-dataset

```

## MCP server setup

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

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/iZGwK3yzu14wtyx3L/builds/WzFbgOQ55iAv8VbzQ/openapi.json
