# Weather API

> Measured conditions from the nearest station plus a seven-day forecast, in one small response built for a screen.

API reference · Reference · https://wxalerts.org/docs/api/weather/

Base URL: `https://api.wxalerts.org`

What is happening at a point now and what is expected, sized for something that
renders it: measured conditions from the nearest station and a forecast from
the National Blend of Models. Why `current` is measured and the rest is
forecast, and why `sky` and `icon` are decided on the server, is in [What is
measured and what is forecast](/docs/developers/concepts/measured-and-forecast/).

No key needed. Browsers block calls from other websites (CORS allows only
wxalerts.org), so call it from a server, script or app. For the unsimplified
observation see [`GET /conditions`](/docs/api/observations/); for every field
the models publish see [`GET /forecast`](/docs/api/forecast/).

## Sky words and icons

Every hour and every day carries `sky`: a single phrase, decided on the server.

| | |
| --- | --- |
| `Clear` · `Mostly sunny` · `Partly cloudy` · `Mostly cloudy` · `Overcast` | from cloud cover (`Clear` below 10%, then from 10%, 30%, 60% and 88%), when little or nothing is expected to fall |
| `Scattered rain` · `Scattered snow` · `Scattered sleet` · `Scattered freezing rain` · `Scattered showers` | chance of precipitation ≥ 25%. `showers` when no type is forecast |
| `Rain likely` · `Snow likely` · `Sleet likely` · `Freezing rain likely` · `Precipitation likely` | ≥ 55% |
| `Storms likely` | ≥ 55%, with a thunder probability ≥ 30% |

`precip_type` is one of `rain`, `snow`, `sleet` or `freezing rain`: the
likeliest kind should anything fall. It is set whenever any type has a chance
above zero, so read it beside `precip_probability` (an hour can say `rain` at a
3% chance). It is `null` when every type is zero.

`icon` is the same decision as `sky`, made as a picture: `clear-day`,
`clear-night`, `partly-cloudy-day`, `partly-cloudy-night`, `cloudy`,
`overcast`, `rain`, `snow`, `sleet`, `freezing-rain` or `thunderstorm`. At a
25% chance of precipitation or more it is the precipitation (`thunderstorm`
with a thunder probability ≥ 30%); below that it is the cloud. Night icons come
from `is_day`. Days carry no `is_day` and their icon is always the daytime one.

## Fields

A `null` almost always means nothing publishes that field at that location, not
that something failed.

### `current`

Measured. Every one of these keys is always present; the value is `null` where
no station nearby reports it.

| field | notes |
| --- | --- |
| `temperature`, `dewpoint`, `relative_humidity` | A METAR carries no humidity and a CWOP packet carries no dew point; the missing half of that pair is derived from the other |
| `wind_speed`, `wind_gust`, `wind_direction` | Direction is degrees true, blowing **from**. `wind_direction_cardinal` gives the compass point |
| `pressure` | Stations report up to three pressures; this is one of them, chosen in this order: sea-level, then the altimeter setting, then station pressure |
| `visibility` | |
| `observed_at` | When the named `station` reported |
| `sky`, `icon`, `is_day` | See [Sky words and icons](#sky-words-and-icons). The only keys here not measured |
| `precip_1h`, `precip_24h`, `snow_depth` | |
| `conditions` | The station's own words for what is falling, in METAR code: `"-RA BR"`, `"HZ"`. `null` when the station reports none, which is not the same as fair weather |
| `station` | The instrument the reading is attributed to: the one that supplied most of the fields. Where it has no sensor for a field, the next station nearby fills that field silently. `name` is `null` for stations without one in the roster, usually CWOP |

### `hourly`

From the hour containing `server_time`. `hours=168` returns the whole series,
around a hundred steps.

| field | notes |
| --- | --- |
| `time` | Local to the forecast location, with its offset. There is no separate offset field |
| `sky`, `icon`, `is_day`, `precip_type` | See [Sky words and icons](#sky-words-and-icons) |
| `temperature`, `dewpoint`, `relative_humidity` | |
| `wind_speed`, `wind_gust`, `wind_direction_cardinal` | |
| `cloud_cover` | |
| `precip_probability` | P(> 0.254 mm), the chance of rain |
| `precip_amount` | Liquid-equivalent, over the accumulation window ending at this step, which widens when the steps do |

### `daily`

Local calendar days at the forecast location, not UTC days, from today onward.
A UTC boundary falls in the evening across the Americas, which files an evening
thunderstorm under tomorrow and puts tonight's low on the wrong card.

| field | notes |
| --- | --- |
| `date` | |
| `sky`, `icon`, `precip_type` | From the day's mean cloud cover and its highest chances |
| `high`, `low` | The day's temperature range |
| `dewpoint_high` | |
| `wind_speed`, `wind_gust` | The day's maxima |
| `wind_direction_cardinal` | Prevailing, averaged as a unit vector, because the arithmetic mean of 350° and 10° is 180°, the opposite direction |
| `cloud_cover` | The day's mean |
| `precip_probability` | The day's maximum |
| `precip_amount` | The day's total |
| `hours` | Forecast hours behind this day |

Branch on `hours` before comparing days. The first and last of a series are
usually partial, and NBM goes **3-hourly** after its second day (eight
steps make a full day from then on), so a four-hour day and a
twenty-four-hour day are not the same measurement.

## Units

```
GET /weather?lat=33.2&lon=-97.1&units=us
```

| value | meaning |
| --- | --- |
| `si` | Exactly what the model published: Kelvin, m/s, Pascals, kg/m², meters |
| `metric` | °C, km/h, mm, hPa, km |
| `us` | °F, mph, in, inHg, mi |
| `uk` | °C, mm and hPa, but mph and miles |
| `auto` | Chosen from the caller's country, via Cloudflare. A caller it cannot place gets `us` |

Every response carries a `units` block naming the unit of every field it
returned, so a client never has to infer whether `pressure` came back in hPa or
inHg. A gauge with a mislabeled scale looks entirely correct.

Observed and forecast fields share one vocabulary and one map. A `temperature`
in `current` and a `temperature` in `hourly` are the same kind of number in the
same unit, so both render through the same code, including `high` and `low`,
which are declared as temperatures rather than leaving you to work it out.

A response resolved from your country varies by caller at a URL that says
nothing about the country, so it comes back `Cache-Control: private`. **Pass
`units` explicitly for a CDN-cacheable response.**

## Coverage

The forecast covers the United States and its territories (the Lower 48,
Alaska, Hawaii, Puerto Rico and Guam) and nowhere else. A point outside it
returns `200` with `hourly` and `daily` empty, not `404`. There is no error to
handle; there is simply no model there.

`current` is not bounded that way. CWOP and the airfield network are
worldwide, so a point with no forecast can still have a thermometer next to
it: London gets a `current` and an empty forecast.

## Caching

The response is cached for 60 seconds, which is the station's cadence rather
than the model's: CWOP stations report every five minutes and METARs hourly,
while NBM runs once an hour. See [rate limits](/docs/developers/rate-limits/)
and [Poll the weather API politely](/docs/developers/polling/) for how to ask
for only what you show and how often to ask.

## `GET /weather`

**Current conditions and forecast for a point, ready to display.**

**Access.** Anonymous, or an [API key](/docs/developers/api-keys/) holding `weather:read`. Also served at `/v1/weather`, where a key (or the app or website sign-in) is required. Anonymous requests share the per-address limit, and a request with a key is charged to the key. See [Rate limits](/docs/api/conventions/#rate-limits).

Measured conditions now and the forecast from here, sized for a screen.

Give `lat` and `lon`, or `location_id`, or `q`. `current` is measured by the
nearest surface stations and is null when none within 50 miles has reported
in the last two hours. `hourly` and `daily` are the National Blend of Models,
cut to start now and today. The two are never blended and can disagree: an
observation is a fact about this minute and a forecast is a guess about the
next one. `sky` and `icon` are one decision made on the server so every
client draws the same picture.

The forecast covers the United States and its territories. A point outside
it returns 200 with `hourly` and `daily` empty, not a 404, and `current` can
still be filled because stations are worldwide. For every field credited to
its own instrument use `/conditions`; for every field the models publish use
`/forecast`. Responses are cached for 60 seconds.

### Parameters

| Name | In | Type | Required | Default | Bounds | Description |
| --- | --- | --- | --- | --- | --- | --- |
| `lat` | query | number or null | no | none | -90 to 90 | Latitude of the point, in degrees north |
| `lon` | query | number or null | no | none | -180 to 180 | Longitude of the point, in degrees east |
| `q` | query | string or null | no | none | at least 1 character, at most 120 characters | Place name, ZIP or state, used instead of `lat` and `lon` and resolved through `/locations/search`. The best match is used. No match is a 404 |
| `location_id` | query | integer or null | no | none | none | Place id from a `/locations/search` result, used instead of `lat` and `lon`. An unknown id is a 404 |
| `units` | query | "si" \| "metric" \| "us" \| "uk" \| "auto" | no | `"auto"` | none | Unit system for every measurement in the response. `si` is exactly what the model published (K, m/s, Pa, kg/m2, m). `metric` is degrees C, km/h, hPa, mm, km. `us` is degrees F, mph, inHg, in, mi. `uk` is degrees C, mm and hPa, but mph and miles. `auto` (the default) picks one from the caller's country, and a caller who cannot be placed gets `us`. The response's `units` block names the unit of every field. An `auto` response varies by caller and is sent `Cache-Control: private`; pass a system explicitly for a response a shared cache can hold |
| `hours` | query | integer | no | `24` | 1 to 168 | Steps of `hourly` to return, from 1 to 168. A step is one forecast step, not one clock hour: the series is hourly for about two days and coarser after that. A panel showing the next twelve should ask for twelve rather than paying for the whole series |
| `days` | query | integer | no | `7` | 1 to 8 | Daily buckets to return, from 1 to 8, starting today |

### Response

Returns object.

| Field | Type | Description |
| --- | --- | --- |
| `server_time` | string (date-time) | When the response was built, in UTC. |
| `location` | object | The point the response is for. |
| `location.name` | string or null | Place name. Null when the point was given as coordinates. |
| `location.display_name` | string or null | Place name with its state, e.g. 'Denton, TX'. Same rule as `name`. |
| `location.state` | string or null | State or region of the named place. |
| `location.lat` | number | Latitude the forecast is for, degrees north. |
| `location.lon` | number | Longitude the forecast is for, degrees east. |
| `location.timezone` | string | IANA zone the local times are in |
| `units` | object | The unit of every measurement in the response. |
| `units.system` | string | si \| metric \| us \| uk |
| `units.fields` | object | Every measurement name that can appear in this response, in one map. Observed and forecast fields share a vocabulary: a `temperature` in `current` and a `temperature` in `hourly` are the same kind of number in the same unit. |
| `current` | object or null | Null when no station within 50 miles has reported recently, a different answer from every field coming back empty. |
| `current.observed_at` | string (date-time) or null | When the named station reported |
| `current.wind_direction_cardinal` | string or null | Compass point the wind blows from, e.g. 'SSW' (16 point). |
| `current.sky` | string or null | One phrase for right now. Unlike the numbers beside it this is not measured: no station reports total cloud cover, so the cloud comes from the forecast hour nearest now. |
| `current.icon` | string or null | Which picture to draw. The cloud behind it is the model's; whether the sun is up is read off the actual instant and point. |
| `current.is_day` | boolean or null | Whether the sun is above the horizon at this instant and point. Computed from solar position, not borrowed from the forecast. |
| `current.conditions` | string or null | The station's own words for what is falling: 'light rain', 'haze'. Null when it reports none, which is not the same as fair weather. For a word covering the sky as well, read `hourly[0].sky`. |
| `current.station` | object | The station the reading is attributed to: the one that supplied most fields. |
| `current.station.station_id` | string | Station id with its network in front, e.g. 'aprs:KC5CAM-13'. |
| `current.station.name` | string or null | From the station roster. Airfield observations are named; a CWOP station usually is not, and this is null there. |
| `current.station.source` | string | The feed the station reports through: metar \| aprs \| ndbc \| pws |
| `current.station.distance_m` | integer | From the requested point to the station |
| `current.station.age_seconds` | integer | How old the reading was when served |
| `hourly` | array of object | From the hour containing `server_time`, so `[0]` is now. Hourly to forecast hour 47, then 3-hourly, then 6-hourly past about day 8. The hours a cycle has already covered stay on /forecast. |
| `hourly[].time` | string (date-time) | Local to the forecast location, offset included |
| `hourly[].sky` | string or null | One phrase, e.g. 'Mostly cloudy', 'Rain likely' |
| `hourly[].icon` | string or null | Which picture to draw: clear-day \| clear-night \| partly-cloudy-day \| partly-cloudy-night \| cloudy \| overcast \| rain \| snow \| sleet \| freezing-rain \| thunderstorm |
| `hourly[].is_day` | boolean or null | Whether the sun is above the horizon at this hour and place. Computed from solar position, not from the clock, because 'day is 6 to 18' is wrong for months at a time in Alaska. |
| `hourly[].precip_type` | string or null | rain \| snow \| sleet \| freezing rain. The likeliest of four probabilities that do not sum to 100. Null when none is forecast. |
| `hourly[].wind_direction_cardinal` | string or null | Compass point the wind blows from, e.g. 'SSW' (16 point). |
| `daily` | array of object | Rolled into local calendar days, from today at the forecast location, so `[0]` is today. |
| `daily[].date` | string (date) | The local calendar day at the forecast location. |
| `daily[].sky` | string or null | One phrase for the day, from its mean cloud cover and its highest chances of precipitation, e.g. 'Partly cloudy', 'Rain likely'. |
| `daily[].icon` | string or null | Always a daytime icon. A day is not a moment and has no sun angle; a card for Thursday showing a moon would be reporting that Thursday is night. |
| `daily[].precip_type` | string or null | rain \| snow \| sleet \| freezing rain. The likeliest kind should anything fall. Null when every type is zero. |
| `daily[].wind_direction_cardinal` | string or null | Prevailing compass point the wind blows from, e.g. 'SSW'. |
| `daily[].hours` | integer | Forecast hours behind this day. The first and last of a series are usually partial, and a 4-hour day is not comparable to a 24-hour one. |

```json
{
  "current": {
    "dewpoint": 57.9,
    "icon": "cloudy",
    "is_day": true,
    "observed_at": "2026-11-09T19:11:00Z",
    "precip_1h": 0,
    "precip_24h": 0,
    "pressure": 30.21,
    "relative_humidity": 70,
    "sky": "Mostly cloudy",
    "station": {
      "age_seconds": 121,
      "distance_m": 2094,
      "source": "aprs",
      "station_id": "aprs:KC5CAM-13"
    },
    "temperature": 68,
    "visibility": 10,
    "wind_direction": 179,
    "wind_direction_cardinal": "S",
    "wind_gust": 1,
    "wind_speed": 1
  },
  "daily": [
    {
      "cloud_cover": 73.7,
      "date": "2026-11-09",
      "dewpoint_high": 61.6,
      "high": 71.3,
      "hours": 11,
      "icon": "cloudy",
      "low": 61.1,
      "precip_amount": 0.005,
      "precip_probability": 12,
      "precip_type": "rain",
      "sky": "Mostly cloudy",
      "wind_direction_cardinal": "SSW",
      "wind_gust": 10.1,
      "wind_speed": 5.4
    }
  ],
  "hourly": [
    {
      "cloud_cover": 83.1,
      "dewpoint": 59.8,
      "icon": "cloudy",
      "is_day": true,
      "precip_amount": 0,
      "precip_probability": 3,
      "precip_type": "rain",
      "relative_humidity": 68.9,
      "sky": "Mostly cloudy",
      "temperature": 70.6,
      "time": "2026-11-09T13:00:00-06:00",
      "wind_direction_cardinal": "SSW",
      "wind_gust": 8.7,
      "wind_speed": 4.3
    }
  ],
  "location": {
    "display_name": "Denton, TX",
    "lat": 33.2174,
    "lon": -97.1413,
    "name": "Denton",
    "state": "TX",
    "timezone": "America/Chicago"
  },
  "server_time": "2026-11-09T19:13:00Z",
  "units": {
    "fields": {
      "temperature": {
        "label": "°F",
        "unit": "F"
      }
    },
    "system": "us"
  }
}
```

### Errors

| Status | Meaning |
| --- | --- |
| 404 | `{"detail": "No place matched 'xyz'"}` for a `q` with no match, or `{"detail": "Unknown location id"}` for a `location_id` that matches nothing. |
| 422 | `{"detail": "Give lat and lon, or location_id, or q."}` when none of the three ways to name the point is given. A bad value in any parameter returns the [list form](/docs/api/conventions/#the-422-format). |

Plus the [common errors](/docs/api/conventions/#errors) every route can return (`400 key_in_query`, `401`, `403`, `429`, `500`).

### Caching and limits

`Cache-Control: public, max-age=60`. When `units` is `auto` and your country is known from the request, the answer depends on the caller, so it is sent `private, max-age=60` with `Vary: CF-IPCountry`; pass `units` explicitly for a response a shared cache can hold. Under `/v1` the header is always `private`. There is no `ETag`, so no `304`; cache for the `max-age` and ask again after it.
