National Weather Service

Weather API · United States · NWS forecasts and alerts

TL;DR

The National Weather Service API provides official US government weather data — point forecasts, zone forecasts, active alerts (watches/warnings/advisories), current observations, and marine forecasts. Query by latitude/longitude, grid points, or zone identifiers. Get detailed forecast data including temperature, precipitation probability, wind speed, humidity, and weather conditions for 7+ days. Alerts cover tornadoes, hurricanes, floods, winter storms, heat advisories, and more. The authoritative source for American weather data, completely free.

Quick start: https://api.weather.gov/points/39.7456,-97.0892

No API key needed — just make a request!

Forecast for central Kansas: https://api.weather.gov/points/39.7456,-97.0892

How to Use This API

1. Get Forecast Grid Endpoint

https://api.weather.gov/points/38.9072,-77.0369

Returns gridId, gridX, gridY for detailed queries.

2. Detailed 7-Day Forecast

https://api.weather.gov/gridpoints/LWX/97,71/forecast

3. Active Alerts by Zone

https://api.weather.gov/alerts/active/zone/DCZ001

4. Current Observations at a Station

https://api.weather.gov/stations/KBUF/observations/latest

5. JavaScript — 7-Day Forecast

async function getNWSForecast(lat, lon) {
  // Step 1: Get grid endpoint
  const points = await fetch(
    `https://api.weather.gov/points/${lat},${lon}`
  );
  const gridData = await points.json();
  const forecastUrl = gridData.properties.forecast;
  
  // Step 2: Get actual forecast
  const forecast = await fetch(forecastUrl);
  const data = await forecast.json();
  
  console.log('7-Day Forecast:');
  data.properties.periods.forEach(p => {
    console.log(`${p.name}: ${p.temperature}°F ${p.shortForecast}`);
  });
}

getNWSForecast(38.9072, -77.0369); // Washington DC

6. Python — Weather Alert Checker

import requests

def active_alerts(state_code):
    resp = requests.get(
        'https://api.weather.gov/alerts/active',
        params={'area': state_code}
    )
    data = resp.json()
    
    alerts = data.get('features', [])
    if not alerts:
        print(f'No active alerts for {state_code}')
        return
    
    print(f'Active alerts in {state_code}:')
    for alert in alerts:
        props = alert['properties']
        print(f'  • {props["event"]}')
        print(f'    Severity: {props["severity"]}')
        print(f'    Area: {", ".join(props["areaDesc"])}')
        print()

active_alerts('FL')  # Florida alerts

Frequently Asked Questions

Do I need an API key?
No. The NWS API is a public government service. A User-Agent header identifying your app is recommended but not strictly required.
How do I find the grid coordinates for a location?
Use the /points/{lat},{lon} endpoint. It returns the gridId, gridX, and gridY needed for forecast and observation queries.
What forecast data is available?
7-day detailed forecast with daytime/nighttime periods including temperature, wind speed/direction, humidity, precipitation probability, dewpoint, and detailed text description.
What types of alerts are available?
All NWS alerts: tornado warnings, severe thunderstorms, flood watches/warnings, winter storms, hurricanes, heat advisories, wind chill, air quality, coastal flooding, and more.
How can I get radar data?
The NWS API doesn't directly serve radar images, but it provides station metadata and observation links. Radar imagery is available via the Ridge server.
Are there rate limits?
Yes — NWS requests rate limiting to ensure fair use. If you exceed limits, you'll get a 429 response. Cache responses and avoid polling more than once per minute.

API Details

API URL
https://api.weather.gov/
Documentation
weather.gov/documentation
Category
Weather
Authentication
Not Required
Geographic Coverage
United States and territories

What You Can Build