API Directory › 🌦 Weather › US National Weather Service
No authHTTPSCORS

US National Weather Service API

Official US government weather API — forecasts and alerts, completely free and key-free.

Category
Auth
No auth needed
HTTPS
Yes
CORS
Yes
Open US National Weather Service docs ↗

What it does

The US National Weather Service API (api.weather.gov) is the authoritative free source for US forecasts, active alerts and warnings, current observations, and gridded forecast data. Responses are GeoJSON. It covers the United States and territories only.

Base URL

https://api.weather.gov

Authentication

None, but you must send a User-Agent header identifying your application with a contact (email or URL). Getting a forecast is a two-step lookup: /points/{lat},{lon} returns the URLs for that location’s forecast and hourly forecast.

Code examples

curl
# Step 1: resolve the point
curl -s "https://api.weather.gov/points/38.8894,-77.0352" \
  -H "User-Agent: larzos-app (contact@example.com)"
# Step 2: follow properties.forecast from that response
curl -s "https://api.weather.gov/gridpoints/LWX/96,70/forecast" \
  -H "User-Agent: larzos-app (contact@example.com)"
Python
import requests

H = {"User-Agent": "larzos-app (contact@example.com)"}
pt = requests.get("https://api.weather.gov/points/40.71,-74.01", headers=H, timeout=10).json()
fc = requests.get(pt["properties"]["forecast"], headers=H, timeout=10).json()
for p in fc["properties"]["periods"][:4]:
    print(p["name"], p["temperature"], p["shortForecast"])

Rate limits & quotas

No published rate limit, but it is a government service — cache aggressively (forecasts update roughly hourly, the point lookup almost never changes) and keep request rates modest or you may be throttled. Responses include Cache-Control and Expires.

Key response fields

properties.forecast / forecastHourlyURLs to follow from a /points response
properties.periods[].name / temperature / shortForecastHuman-readable forecast periods
properties.periods[].probabilityOfPrecipitation.valuePercent chance of precip
(alerts) features[].properties.event / severity / headlineActive watches and warnings
properties.gridId / gridX / gridYThe forecast grid cell for the point

Common errors

403Missing or empty User-Agent.
404Coordinates outside NWS coverage (non-US), or a stale grid URL.
500 (intermittent)Backend hiccup — retry after a short delay.
(coordinate precision)Round lat/lon to ~4 decimals; the point endpoint 301-redirects otherwise.

When to use it (and alternatives)

The right choice for US weather — free, official, with the best alert data anywhere. Outside the US use MET Norway or Open-Meteo. Cache the /points result per location permanently.

FAQ

Why two requests just to get a forecast?

The /points endpoint maps your coordinates to an NWS forecast office and grid cell and hands you the exact forecast URLs. Cache that mapping — it is effectively static for a given location.

Does it work outside the United States?

No. Coordinates outside NWS coverage return 404. It is US, Puerto Rico, Guam and similar territories only.

How do I get severe-weather alerts?

/alerts/active?point=lat,lon or ?area=ST (state code) returns active warnings, watches and advisories as GeoJSON features.

New to APIs?

Short guides for working with this API — and any other.

🛠️ Handy LarzOS tools

Free tools to help you work with this API.

Weather Checker

Related Weather APIs

← Back

More Weather APIs · All 196 APIs