Weather alerts and warnings
Active official weather warnings for a location (United States and territories, Canada, Norway), for a US state or marine area (area), or for all of Norway or Canada (country): event, headline, severity, urgency, certainty, status, message type, areas and zones, sent/effective/onset/expires/ends times, issuer, full description, instructions, response, colour level and link. Filter by severity, urgency and event name. Locations elsewhere answer with covered: false and no alerts. Sources: US National Weather Service, MET Norway, Environment and Climate Change Canada.
Every response includes credits_used: the credits this call cost.
Parameters
| name | type | description |
|---|---|---|
lat | number | Latitude (-90 to 90). Pass with lon; or use q, postal_code or geonameid instead. |
lon | number | Longitude (-180 to 180). |
q | string | Place name in any language, optionally with region and country: Paris, Springfield, IL, US, München. The most populous match wins (towns of 1,000+ people). |
postal_code | string | Postal code, with country (default US): 10001, SW1A 1AA + country=GB. |
country | string | Country for q/postal_code, or alone for a country-wide list: NO or CA. |
geonameid | integer | GeoNames id of a place (from /geo/v1/cities). |
area | string | US state, territory or marine area code for all its active alerts, e.g. TX, CA, PR. Example: TX |
severity | Extreme | Severe | Moderate | Minor | Unknown | Only alerts of this severity. |
urgency | Immediate | Expected | Future | Past | Unknown | Only alerts of this urgency (US). |
event | string | Only alerts whose event name contains this text, e.g. flood, wind. |
lang | string | Alert language where the source offers more than one: en (default), fr (Canada), no (Norway). |
limit | integer | Max alerts (default 100, max 500). |
Every endpoint also takes fresh, raw, fields (see lean responses and caching).
Example
curl "https://api.api.sh/weather/v1/alerts" \
-H "x-api-key: $APISH_KEY" import os, requests
res = requests.get(
"https://api.api.sh/weather/v1/alerts",
params={},
headers={"x-api-key": os.environ["APISH_KEY"]},
timeout=120,
)
res.raise_for_status()
data = res.json() const url = new URL("https://api.api.sh/weather/v1/alerts");
const res = await fetch(url, { headers: { "x-api-key": process.env.APISH_KEY } });
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`);
const data = await res.json(); Response
A JSON object with the fields described above, plus raw (the source's own data), cached, fetched_at and credits_used. Errors return {"success": false, "error": "…"} with the HTTP status (see errors). A lookup that ran but found nothing (404) costs the price above; refused calls and errors on our side are free (what's charged).