# NWS Weather Alerts API - Active by County or ZIP Code (`infocomp/nws-active-alerts-by-county-zip`) Actor

Official National Weather Service active alerts (warnings, watches, advisories) for U.S. counties, ZIP codes or states, with severity, urgency, certainty, onset/ends/expires, instruction and link. One row per alert. $2.00 per 1,000 alerts. Not endorsed by NOAA or the National Weather Service.

- **URL**: https://apify.com/infocomp/nws-active-alerts-by-county-zip.md
- **Developed by:** [InfoComp Data](https://apify.com/infocomp) (community)
- **Categories:** News, Developer tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$2.00 / 1,000 alerts

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

## NWS Weather Alerts API: Active by County or ZIP Code

Get **currently active official National Weather Service alerts** (warnings, watches, advisories, statements) for **U.S. counties, ZIP codes or whole states**. One row per alert with event, severity, urgency, certainty, headline, affected area, onset / ends / expires, issuing NWS office, recommended action (instruction) and a link to the official alert.

Data comes from the keyless **official National Weather Service API** ([api.weather.gov/alerts/active](https://api.weather.gov/alerts/active)). ZIP codes are resolved with the **U.S. Census Bureau** ZIP Code Tabulation Area center point (TIGERweb), then NWS alerts for that point are returned. No scraping, no API key.

**Not endorsed by NOAA or the National Weather Service.** NWS alert data is a U.S. government work in the public domain. ZIP lookups use Census Bureau data but are not endorsed or certified by the Census Bureau.

### Who is it for?

- Insurance, property, restoration and field-service teams that need to know what is active for a list of counties or ZIPs.
- Developers who want a clean one-row-per-alert feed filtered by severity or event instead of parsing CAP/GeoJSON.
- Newsletters, dashboards and notification tools that poll weather hazards by location.

### Pricing

**$2.00 per 1,000 alerts.** One `Alert` event ($0.002) per saved row. No start fee, no run fee. **Failed lookups, unknown locations, locations with no matching alerts, and duplicate alerts are free.** If you set a maximum cost per run, the Actor stops cleanly once it is reached (it checks before fetching each location and before saving rows).

| Alerts | Price |
|---|---|
| 25 (default prefilled run) | $0.05 |
| 1,000 | $2.00 |
| 10,000 | $20.00 |

An empty result (nothing active right now) is normal and costs nothing.

### Input

| Field | What it does |
|---|---|
| `counties` | NWS county code (`TXC453`), 5-digit FIPS (`48453`), state + county name (`TX, Travis` or `Travis County, TX`), or an NWS forecast-zone code (`TXZ192`). Counties are matched on the alert's UGC and SAME (FIPS) codes. |
| `zipCodes` | 5-digit ZIPs (ZIP+4 accepted, the +4 is ignored). Resolved to the ZIP Code Tabulation Area center point; alerts covering that point are returned. |
| `states` | Two-letter state / territory codes or full names: every active alert in the state. Prefilled `CA, FL, AK`. If you give no counties, ZIPs or states (e.g. `{}`), `CA, FL, AK` are used. |
| `severity` | Optional filter: Extreme, Severe, Moderate, Minor, Unknown. |
| `events` | Optional filter by event name, case-insensitive partial match (e.g. `Tornado Warning`, `Flood`). |
| `maxResults` | Default 25, max 500. Each alert is saved and charged once even if it matches several locations. |

Up to 25 locations (counties + ZIPs + states) per run.

Example: `{"counties": ["CA, San Diego", "06017", "TXC453"], "zipCodes": ["99501"], "severity": ["Severe", "Extreme"]}`

### Output sample (real alert, fetched 2026-11-14 with the default input)

```json
{
  "alertId": "urn:oid:2.49.0.1.840.0.884f0a1a387ff0cfd27b1b0f712f3cb6c99ed622.002.1",
  "event": "High Surf Warning",
  "severity": "Moderate",
  "urgency": "Expected",
  "certainty": "Likely",
  "headline": "High Surf Warning issued November 14 at 9:40AM PST until November 15 at 4:00AM PST by NWS Eureka CA",
  "area": "Southwestern Humboldt; Coastal Mendocino",
  "onset": "2026-11-14T09:40:00-08:00",
  "ends": "2026-11-15T04:00:00-08:00",
  "expires": "2026-11-15T04:00:00-08:00",
  "effective": "2026-11-14T09:40:00-08:00",
  "sent": "2026-11-14T09:40:00-08:00",
  "sender": "NWS Eureka CA",
  "instruction": "Large breaking waves along the coast will lead to increased wave\nrun-up on beaches with waves topping and washing over large rocks\nand jetties. These large waves can be erratic and unpredictable.\nUse extra caution near the surf zone as these large waves will be\ncapable of sweeping people into the frigid and turbulent ocean\nwater. Mariners traversing the bar are urged to exercise extreme\ncaution or stay in port until the threat subsides. Please contact\nthe U.S. Coast Guard for information regarding harbor and bar\nclosures.",
  "description": "* WHAT...Dangerously large breaking waves 22 to 30 feet.  * WHERE...Southwestern Humboldt and Coastal Mendocino Counties.  * WHEN...Until 4 AM PST Sunday.  * IMPACTS...Breaking waves can sweep people ...",
  "messageType": "Update",
  "category": "Met",
  "response": "Avoid",
  "ugcCodes": [
    "CAZ104",
    "CAZ109"
  ],
  "sameCodes": [
    "006023",
    "006045"
  ],
  "matchedLocation": "CA",
  "link": "https://api.weather.gov/alerts/urn:oid:2.49.0.1.840.0.884f0a1a387ff0cfd27b1b0f712f3cb6c99ed622.002.1",
  "dataCredit": "Official National Weather Service alerts (api.weather.gov/alerts/active)",
  "disclaimer": "Not endorsed by NOAA or the National Weather Service. Data is a U.S. government work in the public domain. ZIP lookups use Census Bureau data but are not endorsed or certified by the Census Bureau.",
  "scrapedAt": "2026-11-14T19:21:21Z"
}
```

Fields: `alertId, event, severity, urgency, certainty, headline, area, onset, ends, expires, effective, sent, sender, instruction, description, messageType, category, response, ugcCodes, sameCodes, matchedLocation, link, dataCredit, disclaimer, scrapedAt`. Run summary (locations, unknown locations, timing) is in the key-value store as `OUTPUT`.

### Limits and caveats

- **Active alerts only**: this is a live snapshot, not history. The result changes minute to minute and can be empty.
- A county matches when the alert's UGC list contains the county code or its SAME list contains the county FIPS. Alerts for a zone that covers only part of a county are included.
- A ZIP is matched by its Census ZCTA center point, which can differ from the postal ZIP boundary. Alerts that only cover another part of the ZIP area are not returned.
- Marine and offshore zones are returned only through state / point matches that the NWS API reports.
- Reasonable use: the Actor sends a User-Agent with a website only, limited concurrency, and a 240-second fetch budget; failed requests are retried at most 3 times.
- The NWS may require an API key in the future; the Actor would then need an update.

# Actor input Schema

## `counties` (type: `array`):

Optional. Counties as NWS county code (TXC453), 5-digit FIPS (48453) or state + county name ("TX, Travis" or "Travis County, TX"). NWS forecast-zone codes such as TXZ192 also work. Unknown counties are skipped and not charged.

## `zipCodes` (type: `array`):

Optional. 5-digit ZIP codes. Each ZIP is resolved to its U.S. Census ZIP Code Tabulation Area center point, then alerts for that point are returned. Unknown ZIPs are skipped and not charged.

## `states` (type: `array`):

Optional. Two-letter state/territory codes (or full names) to return every active alert in the state. Prefilled with CA, FL, AK for a quick demo. If you give no counties, ZIPs or states at all (for example an empty {} input), CA, FL and AK are used. Clear this list when you only want counties or ZIPs.

## `severity` (type: `array`):

Optional. Only return alerts with these severities. Empty = all.

## `events` (type: `array`):

Optional. Only return alerts whose event name matches, e.g. Tornado Warning, Flood, Winter Storm. Matching is case-insensitive and partial. Empty = all events.

## `maxResults` (type: `integer`):

Stop after this many alert rows (each alert is saved and charged once, even when it matches several locations).

## Actor input object example

```json
{
  "states": [
    "CA",
    "FL",
    "AK"
  ],
  "maxResults": 25
}
```

# Actor output Schema

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

No description

## `summary` (type: `string`):

No description

# 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 = {
    "states": [
        "CA",
        "FL",
        "AK"
    ],
    "maxResults": 25
};

// Run the Actor and wait for it to finish
const run = await client.actor("infocomp/nws-active-alerts-by-county-zip").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 = {
    "states": [
        "CA",
        "FL",
        "AK",
    ],
    "maxResults": 25,
}

# Run the Actor and wait for it to finish
run = client.actor("infocomp/nws-active-alerts-by-county-zip").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 '{
  "states": [
    "CA",
    "FL",
    "AK"
  ],
  "maxResults": 25
}' |
apify call infocomp/nws-active-alerts-by-county-zip --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,infocomp/nws-active-alerts-by-county-zip"
        }
    }
}
```

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/pNjZrLdkOTfpXmNHr/builds/sdqamLbgdX7dwq76j/openapi.json
