# NOAA Weather Forecast & Alerts (Official API) (`kdhan/noaa-weather-forecast-alerts`) Actor

US weather forecasts and active severe weather alerts from the official National Weather Service API. Daily or hourly forecasts for any US coordinates, and alerts filtered by state, severity, urgency or event type. No API key needed. Public domain U.S. government data.

- **URL**: https://apify.com/kdhan/noaa-weather-forecast-alerts.md
- **Developed by:** [Doohan Kim](https://apify.com/kdhan) (community)
- **Categories:** Developer tools, News
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.20 / 1,000 result items

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

## NOAA Weather Forecast & Alerts (Official API)

US weather forecasts and active severe weather alerts, straight from the **National Weather
Service** API. No scraping, no API key.

### Two modes

**Forecast by coordinates** — give one or more US points and get the official NWS forecast:
daily periods (about 14) or hourly (about 156), with temperature, wind, precipitation
probability and the forecaster's own wording.

**Active alerts** — every alert currently in effect, filtered by state, severity, urgency or
event type: flood warnings, tornado watches, winter storm warnings, heat advisories.

### Why this Actor

- **Official API only.** Calls `api.weather.gov`. No HTML scraping, no third-party weather site.
- **No API key.** NWS publishes this openly.
- **Public domain.** U.S. government works, free to use and redistribute.
- **Flat rows.** Nested values such as precipitation probability are unwrapped into plain columns.
- **Correct by construction.** NWS needs a two-step lookup (coordinates → grid → forecast);
  this Actor does it for you.

### Required: your contact

NWS asks automated clients to identify themselves. Put your name and email in the
**Your contact** input, for example `Jane Doe jane@example.com`. It is sent in the
`User-Agent` header, as NWS requests. The Actor refuses to run without it.

### Output — forecast mode

| Field | Description |
|---|---|
| `latitude`, `longitude`, `city`, `state` | The point, and the place NWS matched it to |
| `gridId`, `timeZone` | NWS forecast office and local time zone |
| `periodNumber`, `periodName` | e.g. 1, "Tonight", "Saturday" |
| `startTime`, `endTime` | ISO timestamps with local offset |
| `isDaytime` | Day or night period |
| `temperature`, `temperatureUnit`, `temperatureTrend` | e.g. 59, "F", "falling" |
| `precipitationProbability` | Percent, unwrapped to a plain number |
| `windSpeed`, `windDirection` | e.g. "13 mph", "NW" |
| `shortForecast`, `detailedForecast` | NWS wording, short and long |

### Output — alerts mode

| Field | Description |
|---|---|
| `alertId`, `event` | Identifier and event name, e.g. "Flood Warning" |
| `severity`, `urgency`, `certainty`, `status` | NWS classification |
| `areaDesc` | Counties or zones covered |
| `headline`, `description`, `instruction` | The alert text and what to do |
| `senderName` | Issuing office |
| `effective`, `onset`, `expires`, `ends` | Timing |

### Examples

Hourly forecast for two cities, 24 periods each:

```json
{
  "mode": "forecast",
  "coordinates": ["38.8894,-77.0352", "47.6062,-122.3321"],
  "hourly": true,
  "periods_per_point": 24
}
```

Severe alerts in Texas:

```json
{
  "mode": "alerts",
  "area": "TX",
  "severity": "Severe"
}
```

### Use cases

- Operations and logistics — reroute around storms, plan crews around forecast windows
- Insurance and claims — capture what was forecast and warned before an event
- Agriculture and energy — temperature and precipitation series for specific sites
- Media and alerting — feed active warnings into your own notification system
- Research — build a forecast history by running on a schedule

### Limits worth knowing

- **US only.** NWS covers the United States and its territories. Coordinates outside that
  range return a clear error rather than empty data.
- Alerts are **currently active** ones. Historical alerts are a different NWS endpoint.
- NWS does not support a server-side row limit on active alerts, so this Actor fetches the
  filtered set and trims it. Narrow with `area` or `severity` to keep runs small.

### Running locally

```bash
pip install -r requirements.txt
NWS_USER_AGENT="Your Name you@example.com" python -m tests.test_noaa
```

### Attribution

Data from the National Weather Service, NOAA, U.S. Department of Commerce. This Actor is not
affiliated with or endorsed by NOAA or the NWS. For life-safety decisions, always consult the
official NWS sources directly.

# Actor input Schema

## `user_agent` (type: `string`):

The National Weather Service asks every automated client to identify itself. Replace this with your own name and email, for example: Jane Doe jane@example.com

## `mode` (type: `string`):

Forecast for specific coordinates, or currently active weather alerts.

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

One or more US points as 'latitude,longitude'. Example: 38.8894,-77.0352

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

Daily forecast gives about 14 periods. Hourly gives about 156.

## `periods_per_point` (type: `integer`):

Cap how many forecast periods to keep for each coordinate. Leave empty for all.

## `area` (type: `string`):

Two-letter state or marine area code, for example TX, CA, FL. Leave empty for the whole country.

## `severity` (type: `string`):

Keep only alerts at this severity.

## `urgency` (type: `string`):

Keep only alerts at this urgency.

## `event` (type: `string`):

Exact event name, for example Flood Warning, Tornado Watch, Winter Storm Warning.

## `max_results` (type: `integer`):

You are charged per returned row.

## Actor input object example

```json
{
  "user_agent": "kdhan Apify Actor kdhan2001@gmail.com",
  "mode": "forecast",
  "coordinates": [
    "38.8894,-77.0352",
    "47.6062,-122.3321"
  ],
  "hourly": false,
  "max_results": 100
}
```

# Actor output Schema

## `weather` (type: `string`):

Forecast periods with temperature, wind, precipitation probability and description, or active alerts with event, severity, area and timing.

# 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 = {
    "user_agent": "kdhan Apify Actor kdhan2001@gmail.com",
    "coordinates": [
        "38.8894,-77.0352",
        "47.6062,-122.3321"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("kdhan/noaa-weather-forecast-alerts").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 = {
    "user_agent": "kdhan Apify Actor kdhan2001@gmail.com",
    "coordinates": [
        "38.8894,-77.0352",
        "47.6062,-122.3321",
    ],
}

# Run the Actor and wait for it to finish
run = client.actor("kdhan/noaa-weather-forecast-alerts").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 '{
  "user_agent": "kdhan Apify Actor kdhan2001@gmail.com",
  "coordinates": [
    "38.8894,-77.0352",
    "47.6062,-122.3321"
  ]
}' |
apify call kdhan/noaa-weather-forecast-alerts --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,kdhan/noaa-weather-forecast-alerts"
        }
    }
}
```

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/HfeSf8aakgzYUZ5tI/builds/O2cTq1n8pB9L7WOHV/openapi.json
