APIs / Search engines / National Weather Service

1 credit per call3 endpoints13 datapoints

National Weather Service API

National Weather Service API for 7-day and hourly forecasts at a U.S. point and active weather alerts by state or point as JSON. 1 credit per call.

National Weather Service
GET/v1/weather-gov/forecast?lat=38.8894&lon=-77.0352
{
  "success": true,
  "data": {
    "location": {
      "latitude": 38.8894,
      "longitude": -77.0352,
      "city": "Washington",
      "state": "DC",
      "time_zone": "America/New_York",
      "grid_id": "LWX",
      "grid_x": 97,
      "grid_y": 71,
      "forecast_zone": "DCZ001",
      "county_zone": "DCC001",
      "radar_station": "KLWX"
    },
    "units": "us",
    "generated_at": "2026-12-06T09:07:04+00:00",
    "updated_at": "2026-12-06T08:52:55+00:00",
    "elevation_m": 6.096,
    "count": 14,
    "periods": [
      {
        "number": 1,
        "name": "Overnight",
        "start_time": "2026-12-06T04:00:00-05:00",
        "end_time": "2026-12-06T06:00:00-05:00",
        "is_daytime": false,
        "temperature": 49,
        "temperature_unit": "F",
        "precipitation_probability": 1,
        "wind_speed": "5 mph",
        "wind_direction": "NE",
        "short_forecast": "Cloudy",
        "detailed_forecast": "Cloudy, with a low around 49. Northeast wind around 5 mph.",
        "icon_url": "https://api.weather.gov/icons/land/night/ovc?size=medium"
      },
      {
        "number": 2,
        "name": "Sunday",
        "start_time": "2026-12-06T06:00:00-05:00",
        "end_time": "2026-12-06T18:00:00-05:00",
        "is_daytime": true,
        "temperature": 59,
        "temperature_unit": "F",
        "precipitation_probability": 16,
        "wind_speed": "5 to 8 mph",
        "wind_direction": "E",
        "short_forecast": "Mostly Cloudy then Patchy Drizzle",
        "detailed_forecast": "Patchy drizzle after 2pm. Mostly cloudy, with a high near 59. East wind 5 to 8 mph. Chance of precipitation is 20%.",
        "icon_url": "https://api.weather.gov/icons/land/day/bkn/rain,20?size=medium"
      },
      {
        "number": 3,
        "name": "Sunday Night",
        "start_time": "2026-12-06T18:00:00-05:00",
        "end_time": "2026-12-07T06:00:00-05:00",
        "is_daytime": false,
        "temperature": 56,
        "temperature_unit": "F",
        "precipitation_probability": 100,
        "wind_speed": "9 to 13 mph",
        "wind_direction": "S",
        "short_forecast": "Rain",
        "detailed_forecast": "Rain before 10pm, then rain and patchy fog between 10pm and 5am. Cloudy. Low around 56, with temperatures rising to around 62 overnight. South wind 9 to 13 mph, with gusts as high as 24 mph. Chance of precipitation is 100%. New rainfall amo…",
        "icon_url": "https://api.weather.gov/icons/land/night/rain,100/rain,90?size=medium"
      }
    ]
  },
  "meta": {
    "request_id": "req_644dd5157dc847918096f61cc16dac8f",
    "credits_charged": 1,
    "credits_remaining": 482
  }
}
200 OKJSONX-Credits-Used: 1
Recorded from our API and shortened.

Sample data

What one call returns

A recorded run of forecast: the fields and shapes you will get, shortened to 3 items.

#numberintegernamestringstart_timestringend_timestringis_daytimebooleantemperatureintegertemperature_unitstringprecipitation_probabilityintegerwind_speedstringwind_directionstringshort_forecaststringdetailed_forecaststringicon_urlurl
11Overnight2026-12-06T04:00:00-05:002026-12-06T06:00:00-05:00false49F15 mphNECloudyCloudy, with a low around 49. Northeast wind around 5 mph.https://api.weather.gov/icons/land/night/ovc?size=medium
22Sunday2026-12-06T06:00:00-05:002026-12-06T18:00:00-05:00true59F165 to 8 mphEMostly Cloudy then Patchy DrizzlePatchy drizzle after 2pm. Mostly cloudy, with a high near 59. East wind 5 to 8 mph. Chance of precipitation is 20%.https://api.weather.gov/icons/land/day/bkn/rain,20?size=medium
33Sunday Night2026-12-06T18:00:00-05:002026-12-07T06:00:00-05:00false56F1009 to 13 mphSRainRain before 10pm, then rain and patchy fog between 10pm and 5am. Cloudy. Low around 56, with temperatures rising to around 62 overnight. South wind 9 to 13 mph, with gusts as high as 24 mph. Chance of precipitation is 100%. New rainfall amo…https://api.weather.gov/icons/land/night/rain,100/rain,90?size=medium

Recorded from our API · 3 items shown · 13 datapoints per itemGET /v1/weather-gov/forecast?lat=38.8894&lon=-77.0352

13 datapoints

Identity

  • namestring

Contact

  • icon_urlurl

Reputation

  • start_timestring

Other

  • numberinteger
  • end_timestring
  • is_daytimeboolean
  • temperatureinteger
  • temperature_unitstring
  • precipitation_probabilityinteger
  • wind_speedstring
  • wind_directionstring
  • short_forecaststring
  • detailed_forecaststring

Playground

Run this API

cURLshell
curl "https://api.perceptlayer.com/v1/weather-gov/forecast?lat=38.8894&lon=-77.0352" \
  -H "X-API-Key: $API_KEY"

National Weather Service · 3 endpoints

Endpoints

Every endpoint takes the same key. Open one for its parameters, the fields it returns and an example request.

EndpointRequired parametersReturnsCost
GET/v1/weather-gov/alerts
none+6 optional
titleupdated_atitems
1 credit
GET/v1/weather-gov/forecast
latlon+1 optional
locationunitsgenerated_atupdated_atelevation_mperiods
1 credit
GET/v1/weather-gov/hourly-forecast
latlon+2 optional
locationunitsgenerated_atupdated_atelevation_mperiods
1 credit

Overview

About the National Weather Service API

What you can get

The National Weather Service (NWS) API returns NWS forecasts and alerts for the United States and its territories as JSON through 3 endpoints.

  • Forecast: forecast takes a lat and lon, with units (us for Fahrenheit and mph, or si for Celsius and km/h; default us). It returns the 7-day forecast in day and night periods.
  • Hourly forecast: hourly-forecast takes a lat and lon, with hours (1 to 156, default 48) and units.
  • Alerts: alerts takes a two-letter state (or marine area) code, or a lat and lon, with severity (a comma-separated list of Extreme, Severe, Moderate, Minor and Unknown), limit (1 to 200, default 50) and page.

Coordinates are rounded to the 4 decimals NWS accepts. The recorded forecast call for 38.8894, -77.0352 returns a location (Washington, DC, time zone America/New_York, grid LWX 97,71, with its forecast_zone, county_zone and radar_station), units, generated_at, updated_at, elevation_m and periods, each with number, name, start_time, end_time, is_daytime, temperature, temperature_unit, precipitation_probability, wind_speed, wind_direction, short_forecast, detailed_forecast and icon_url. hourly-forecast periods add dewpoint_c and relative_humidity. The recorded alerts call for Alaska returns a title, updated_at, total (4 in that recording) and alerts with event (such as Winter Weather Advisory), headline, severity, certainty, urgency, message_type, area, affected_zones, sent, onset, expires, sender_name, description and instruction.

How a call works

Ask for a point: GET /v1/weather-gov/forecast?lat=38.8894&lon=-77.0352 with your key in the X-API-Key header returns its 7-day forecast. NWS needs two steps for this, mapping the point to a forecast grid and then reading the grid's forecast; this API does both in one call. A point outside the U.S. and its territories answers 404, and a failed call costs nothing. Answers come from a cache for up to 15 minutes. Every successful call costs 1 credit.

Search enginesJSONRESTMCP

More search engines APIs

Use cases

Let an assistant answer "will it rain in Seattle this afternoon" with the hourly forecast

Use the National Weather Service API to let an assistant answer "will it rain in Seattle this afternoon" with the hourly forecast

Show a 7-day forecast for a store, site or event address in a U.S. app

Use the National Weather Service API to show a 7-day forecast for a store, site or event address in a U.S. app

Alert field teams to Severe and Extreme warnings in their state

Use the National Weather Service API to alert field teams to Severe and Extreme warnings in their state

Check active alerts at a delivery or job-site point before dispatch

Use the National Weather Service API to check active alerts at a delivery or job-site point before dispatch

FAQ

Questions

Is this the official National Weather Service API?

No. Perceptlayer is an independent service and is not affiliated with or endorsed by the National Weather Service. The NWS API is free to call directly, with no key; NWS asks each caller to identify itself in a User-Agent. This API calls it on your behalf and adds one key for every source on Perceptlayer, the point-to-grid lookup and forecast in a single call, short field names in one response shape, a cache of up to 15 minutes, and no charge for failed calls.

Does it cover places outside the U.S.?

No. NWS covers the United States and its territories only. Elsewhere the call answers 404 and costs nothing.

Can I reuse the forecasts?

Yes. NWS data is open and free to use for any purpose, and no attribution is required.

How far ahead does the hourly forecast go?

Up to 156 hours. Set `hours` from 1 to 156; the default is 48.

Should I build a National Weather Service scraper instead?

You can, but a National Weather Service scraper is code you maintain: page changes break it, requests get blocked, and National Weather Service's terms govern how you collect data. The National Weather Service API gives you 3 endpoints of named JSON fields for 1 credit per successful call, and failed calls cost nothing. A scraper makes sense only for data these endpoints don't return, so check the response in the playground on this page first.

Try the National Weather Service API with 100 free credits

No credit card. Failed calls are never billed.