NOAA National Weather Service API
weather.gov · Government
Official US government weather forecast and observation data. Free, no API key required. Provides hourly and 7-day forecasts, current conditions, alerts, radar data, and historical observations for any US location.
Authentication
Sample Requests
Returns grid office and forecast URLs for a lat/lon. Use the returned forecastUrl to get the actual forecast. Step 1 of 2.
Hover any highlighted part to learn what it does
| User-Agent | MyApp [email protected] |
curl -X GET "https://api.weather.gov/points/39.7456,-97.0892" \ -H "User-Agent: MyApp [email protected]"
import requests
headers = {
"User-Agent": "MyApp [email protected]"
}
response = requests.get(
"https://api.weather.gov/points/39.7456,-97.0892",
headers=headers,
)
print(response.json())const url = 'https://api.weather.gov/points/39.7456,-97.0892';
const response = await fetch(url, {
headers: {
'User-Agent': 'MyApp [email protected]'
},
});
const data = await response.json();
console.log(data);package main
import (
"fmt"
"io"
"net/http"
)
func main() {
targetURL := "https://api.weather.gov/points/39.7456,-97.0892"
req, _ := http.NewRequest("GET", targetURL, nil)
req.Header.Set("User-Agent", "MyApp [email protected]")
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}require "net/http"
require "json"
uri = URI("https://api.weather.gov/points/39.7456,-97.0892")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"
req = Net::HTTP::Get.new(uri)
req["User-Agent"] = "MyApp [email protected]"
res = http.request(req)
puts JSON.parse(res.body)<?php
$url = "https://api.weather.gov/points/39.7456,-97.0892";
$opts = ["http" => [
"method" => "GET",
"header" => implode("\r\n", [
"User-Agent: MyApp [email protected]"
]),
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));Returns all active NWS alerts (watches, warnings, advisories) for a US state.
Hover any highlighted part to learn what it does
| User-Agent | MyApp [email protected] |
curl -X GET "https://api.weather.gov/alerts/active?area=TX" \ -H "User-Agent: MyApp [email protected]"
import requests
params = {
"area": "TX"
}
headers = {
"User-Agent": "MyApp [email protected]"
}
response = requests.get(
"https://api.weather.gov/alerts/active",
params=params,
headers=headers,
)
print(response.json())const url = new URL('https://api.weather.gov/alerts/active');
url.searchParams.set('area', 'TX');
const response = await fetch(url, {
headers: {
'User-Agent': 'MyApp [email protected]'
},
});
const data = await response.json();
console.log(data);package main
import (
"fmt"
"io"
"net/http"
"net/url"
)
func main() {
baseURL, _ := url.Parse("https://api.weather.gov/alerts/active")
q := baseURL.Query()
q.Set("area", "TX")
baseURL.RawQuery = q.Encode()
targetURL := baseURL.String()
req, _ := http.NewRequest("GET", targetURL, nil)
req.Header.Set("User-Agent", "MyApp [email protected]")
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}require "net/http"
require "json"
uri = URI("https://api.weather.gov/alerts/active")
uri.query = URI.encode_www_form({
"area" => "TX"
})
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"
req = Net::HTTP::Get.new(uri)
req["User-Agent"] = "MyApp [email protected]"
res = http.request(req)
puts JSON.parse(res.body)<?php
$url = "https://api.weather.gov/alerts/active?" . http_build_query([
"area" => "TX"
]);
$opts = ["http" => [
"method" => "GET",
"header" => implode("\r\n", [
"User-Agent: MyApp [email protected]"
]),
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));Postman Setup Guide
- No API key — add User-Agent header with your app name and email
- Step 1: GET https://api.weather.gov/points/{lat},{lon} to get grid info
- Step 2: Use the forecast URL from the response to get the actual forecast
- For alerts: GET https://api.weather.gov/alerts/active?area={STATE_CODE}
- For observation stations: GET https://api.weather.gov/points/{lat},{lon}/stations
- All responses are GeoJSON — parse the properties object for weather data
What can you build with NOAA National Weather Service API?
NOAA National Weather Service API is a Government API. Developers commonly use government APIs for:
- surfacing public datasets in citizen-facing apps
- building transparency and civic engagement tools
- accessing legislation, court records, and official data
- powering research and journalism tools
- creating compliance and regulatory monitoring dashboards
No authentication required. This API is open — no signup or key needed. Ideal for quick prototypes and public-facing features. NOAA National Weather Service API is free to use, making it a low-risk choice to experiment with.
New to APIs? Read our beginner's guide · Learn about API keys · What is REST?