---
title: "National Weather Service API: 7-day as JSON | Perceptlayer"
description: "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."
url: https://perceptlayer.com/apis/weather-gov
---

[APIs](https://perceptlayer.com/apis) / [Search engines](https://perceptlayer.com/verticals/search) / National Weather Service

1 credit per call 3 endpoints 13 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.

[Get a free API key](https://perceptlayer.com/signup) Run it below

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 OK JSON X-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.

| # | number integer | name string | start\_time string | end\_time string | is\_daytime boolean | temperature integer | temperature\_unit string | precipitation\_probability integer | wind\_speed string | wind\_direction string | short\_forecast string | detailed\_forecast string | icon\_url url |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| 1 | 1 | Overnight | 2026-12-06T04:00:00-05:00 | 2026-12-06T06:00:00-05:00 | false | 49 | F | 1 | 5 mph | NE | Cloudy | Cloudy, with a low around 49. Northeast wind around 5 mph. | https://api.weather.gov/icons/land/night/ovc?size=medium |
| 2 | 2 | Sunday | 2026-12-06T06:00:00-05:00 | 2026-12-06T18:00:00-05:00 | true | 59 | F | 16 | 5 to 8 mph | E | Mostly Cloudy then Patchy Drizzle | Patchy 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 |
| 3 | 3 | Sunday Night | 2026-12-06T18:00:00-05:00 | 2026-12-07T06:00:00-05:00 | false | 56 | F | 100 | 9 to 13 mph | S | Rain | 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… | https://api.weather.gov/icons/land/night/rain,100/rain,90?size=medium |

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

13 datapoints

### Identity

-   name string

### Contact

-   icon\_url url

### Reputation

-   start\_time string

### Other

-   number integer
-   end\_time string
-   is\_daytime boolean
-   temperature integer
-   temperature\_unit string
-   precipitation\_probability integer
-   wind\_speed string
-   wind\_direction string
-   short\_forecast string
-   detailed\_forecast string

Playground

## Run this API

cURL shell 

```
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.

| Endpoint | Required parameters | Returns | Cost |
| --- | --- | --- | --- |
| [GET `/v1/weather-gov/alerts`](https://perceptlayer.com/apis/weather-gov/alerts) | none +6 optional | `title` `updated_at` `items` | 1 credit |
| [GET `/v1/weather-gov/forecast`](https://perceptlayer.com/apis/weather-gov/forecast) | `lat` `lon` +1 optional | `location` `units` `generated_at` `updated_at` `elevation_m` `periods` | 1 credit |
| [GET `/v1/weather-gov/hourly-forecast`](https://perceptlayer.com/apis/weather-gov/hourly-forecast) | `lat` `lon` +2 optional | `location` `units` `generated_at` `updated_at` `elevation_m` `periods` | 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 engines JSON REST MCP

### More search engines APIs

[Apple Maps](https://perceptlayer.com/apis/apple-maps) [Baidu](https://perceptlayer.com/apis/baidu) [Bing](https://perceptlayer.com/apis/bing) [Brave Search](https://perceptlayer.com/apis/brave) [DuckDuckGo](https://perceptlayer.com/apis/duckduckgo) [Google Events](https://perceptlayer.com/apis/google-events) [Google Finance](https://perceptlayer.com/apis/google-finance) [Google Forums](https://perceptlayer.com/apis/google-forums) [Google Images](https://perceptlayer.com/apis/google-images) [Google Lens](https://perceptlayer.com/apis/google-lens) [Google Local](https://perceptlayer.com/apis/google-local) [Google Local Services](https://perceptlayer.com/apis/google-local-services)

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.

[Get a free API key](https://perceptlayer.com/signup) [Read the docs](https://docs.perceptlayer.com)
