National Weather Service API for developers
On this page
The National Weather Service API is a free, public HTTP API that returns US forecasts, active weather alerts, and station observations from api.weather.gov. It needs no API key, but every request must send a User-Agent header that identifies your app. Responses use JSON in the GeoJSON format, so your code parses them like any other JSON document.
What the National Weather Service API covers
The API exposes the forecast and observation data that the National Weather Service publishes for the United States. Its main resources are points, gridpoints, forecasts, alerts, stations, and observations. The API documentation at https://www.weather.gov/documentation/services-web-api describes each resource and its fields.
Each resource answers a different question. A points lookup maps a latitude and longitude to the forecast office and grid cell that serve that location. A forecast request returns the period-by-period outlook for that grid cell. An alerts request returns warnings and watches that are active now. A stations request lists observation sites, and an observations request returns recent readings from one station.
- Points: maps coordinates to forecast URLs
- Gridpoint forecast: returns the detailed forecast for one grid cell
- Alerts: returns active watches, warnings, and advisories
- Stations and observations: return recent conditions from a station
Make your first request
Send a GET request to the API base URL and include a User-Agent header. The header should name your application and give a way to contact you. Without it, requests can fail or get blocked. Add an Accept header that asks for GeoJSON so the response format matches the documentation.
The following shell command requests the point metadata for one set of coordinates. Replace the User-Agent value with your own app name and contact address.
curl -H 'User-Agent: my-app/1.0 (you@yourdomain.example)' -H 'Accept: application/geo+json' https://api.weather.gov/points/39.7456,-97.0892The response is a GeoJSON feature. Its properties object contains URLs for the forecast, the hourly forecast, the observation stations, and the county or zone that covers the point. Your code reads those URLs instead of building them by hand.
Get a forecast in two steps
Fetch the points endpoint first, then call the forecast URL that the response returns. The forecast URL includes the forecast office and grid coordinates for the location, so you never need to calculate them yourself.
Store the forecast URL for each location you track. Coordinates rarely change, so a stored URL saves a lookup on every refresh. Read the properties.periods array in the forecast response to get each forecast period, with its start time, temperature, wind, and short text summary.
The API returns times in ISO 8601 format with a UTC offset. Parse them with a standard date library and convert to the user's local zone before you display them.
Check active alerts
The alerts endpoint returns warnings, watches, and advisories that apply now. Filter the request by state or by point so you receive only alerts for the area your app serves.
Alert responses carry a severity field, an event name, and an effective and expiration time. Sort on severity in your code. Show the expiration time next to each alert. Poll the alerts endpoint at an interval that matches how fast your users need updates. Avoid polling in a tight loop.
Handle errors, caching, and fair use
The API returns standard HTTP status codes. A 404 usually means the coordinates fall outside the coverage area or the resource does not exist. A 5xx status means the service failed on its side, so retry with a delay and log the failure.
- Cache forecast responses and refresh them on a schedule that suits your product
- Reuse stored forecast URLs instead of calling the points endpoint on every request
- Back off after errors rather than retrying at once
- Keep your User-Agent header current so the operator can reach you
The NWS documentation sets out the expectations for fair use. Read it before you launch a service that sends many requests.
Use the API from an AI agent
An agent calls the API the same way a script does. Give the agent an HTTP tool that sends the User-Agent header, or give it an MCP tool that wraps the endpoints it needs. An MCP tool keeps the schema for each endpoint in one place, so the agent receives typed inputs and predictable JSON outputs.
APIbase.pro offers MCP tools for many public data sources. Search the catalog for a weather tool before you write your own wrapper. If the catalog does not list one, your agent can still call the NWS endpoints through a generic HTTP tool with the header set.
Keep the agent's calls cached. An agent that re-fetches the same forecast in every turn wastes requests and slows its answers.
Limits and caveats
The NWS API covers US locations. Coordinates outside the United States and its territories return no forecast. If your product serves users abroad, pair this API with a second source for those locations.
The API has no published service level for this page to quote. Build your app to tolerate brief outages. Show a clear message when data is missing. Check the documentation for changes to endpoints or fields before each release. The schema can change.
No public licence statement for commercial redistribution appears in this guide. Read the NWS terms in the documentation before you sell a product built on the data.
Live pricing — developer
Data source: live tool catalog snapshot, fetched 2026-11-09.
Chart data as a table
| Tool | Price per call | Cache-hit price |
|---|---|---|
| Usage Time Series | $0.0 | $0.0 |
| Per-Tool Usage Breakdown | $0.0 | $0.0 |
| Usage Summary | $0.0 | $0.0 |
| Discover Tools | $0.0 | $0.0 |
| Batch Tool Calls | $0.0 | $0.0 |
| Tool Quality Metrics | $0.0 | $0.0 |
| Tool Quality Rankings | $0.0 | $0.0 |
| List Programming Languages | $0.001 | $0.0001 |
| Check CVE ID Reservation Status | $0.001 | $0.0001 |
| Security Advisories (deps.dev) | $0.001 | $0.0001 |
| Dependency Tree (deps.dev) | $0.001 | $0.0001 |
| Package Info (deps.dev) | $0.001 | $0.0001 |
| Tool | Provider | Price/call | Cache-hit |
|---|---|---|---|
| Usage Time Series | account | $0 | $0 |
| Per-Tool Usage Breakdown | account | $0 | $0 |
| Usage Summary | account | $0 | $0 |
| Discover Tools | apibase | $0 | $0 |
| Batch Tool Calls | platform | $0 | $0 |
| Tool Quality Metrics | platform | $0 | $0 |
| Tool Quality Rankings | platform | $0 | $0 |
| List Programming Languages | judge0 | $0.001 | $0.0001 |
| Check CVE ID Reservation Status | cve-mitre | $0.001 | $0.0001 |
| Security Advisories (deps.dev) | depsdev | $0.001 | $0.0001 |
| Dependency Tree (deps.dev) | depsdev | $0.001 | $0.0001 |
| Package Info (deps.dev) | depsdev | $0.001 | $0.0001 |
Connect via MCP
Data source: gateway design, no measured values.
$ curl -X POST https://apibase.pro/api/v1/tools/account.timeseries/call \
-H "Content-Type: application/json" -d '{"params": {}}'FAQ
Does the National Weather Service API need an API key?
No. The API is free and needs no key. Each request must send a User-Agent header that names your app and gives a contact. The requirements appear in the documentation at https://www.weather.gov/documentation/services-web-api.
What format does the National Weather Service API return?
It returns JSON in the GeoJSON format. Each response contains feature objects with a properties field that holds the data you need.
Can I get a forecast with only latitude and longitude?
Yes, but you need two calls. The points endpoint maps the coordinates to a forecast URL, and you call that URL to get the forecast periods.
Does the API cover locations outside the United States?
No. The API covers US locations and territories. Requests outside that coverage return an error instead of a forecast.
Can an AI agent call the National Weather Service API?
Yes. An agent can call it through a generic HTTP tool with the User-Agent header set, or through an MCP tool that wraps the endpoints. Search the APIbase.pro catalog for a weather tool first.
Recommended next step
- STEP 1/2 Connect your MCP client
- STEP 2/2 Browse the full catalog
Related guides
Written with AI assistance from APIbase's published documentation and public data; checked automatically against them. Corrections: https://apibase.pro/
Published: 2026-11-09Source: live apibase.pro catalog snapshot