Community. Driven. Weather. Data.Always Ad-FreeDeveloper FriendlyChecking statusDiscord
Become a supporter
Sign in

Weather station gateways

Claim a weather station gateway, manage it and its stations, and read the readings the owner's stations send, including the composite that picks one station per kind of measurement.


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

A gateway is a small device that collects readings from one or more weather stations and sends them to WxAlerts. This is the contract for claiming one and for the owner to manage it. The guides for the people doing it are Weather stations and, for commissioning, Commissioning a station. The data the network serves back to everyone is under Observations.

There are two audiences.

Audience Routes Auth
The gateway itself POST /pws/claim/start, POST /pws/claim/poll, GET /pws/device/identity none for the first two, the gateway’s own credential for identity
The owner every other route the app’s Bearer token or the site’s session cookie

Owner routes need the X-Requested-With: wxalerts header on POST, PUT, PATCH and DELETE when the credential is a cookie. A Bearer request does not need it. A gateway that is not the caller’s answers 404, never 403.

Owner errors common to every owner route

Status Body When
401 {"detail": "Not signed in."} or {"detail": "Session expired."} no valid credential
401 {"detail": {"code": "api_key_not_accepted", "message": "..."}} an API key was used. Keys work on /v1 reads only
403 {"detail": "Missing X-Requested-With header."} a cookie write without the header
403 {"detail": {"code": "account_disabled" or "account_deleted", "message": "..."}}
404 {"detail": {"code": "gateway_not_found", "message": "No such gateway."}} not the caller’s gateway. station_not_found and command_not_found work the same way
422 {"detail": [{"type": "...", "loc": [...], "msg": "...", "input": ...}]} the request failed validation. Default format

Owner responses carry Cache-Control: private, no-store where they return state.

Device errors

The three device routes follow the OAuth device flow (RFC 8628) and report errors as top level {"error": "<code>"}, not under detail, with Cache-Control: no-store. A device route answers 503 with {"error": "unavailable"} when the service is not configured.

POST /pws/claim/start

Anonymous, for the gateway. The gateway asks for a code to show its owner. No account is needed. Rate limited to 6 requests a minute per address and 30 an hour per hardware id.

Request body (JSON)

Field Type Required Bounds
hw_id string yes 8 to 128 characters, the hardware identity
fw string or null no max 64, firmware version
model string or null no max 64

Response

200:

Field Type Notes
device_code string secret the gateway keeps and polls with
user_code string what the owner types, such as ABCD-2345. Eight characters from a set that leaves out look alike characters
verification_uri string https://wxalerts.org/pws/claim
verification_uri_complete string the same with ?code= and the code
expires_in integer seconds. The code lives 10 minutes
interval integer the seconds to wait between polls, 5
{"device_code": "dc_example_not_a_real_code", "user_code": "ABCD-2345", "verification_uri": "https://wxalerts.org/pws/claim", "verification_uri_complete": "https://wxalerts.org/pws/claim?code=ABCD2345", "expires_in": 600, "interval": 5}

Errors

Status Body When
409 {"error": "already_claimed"} this hardware is already claimed
429 {"error": "rate_limited"} and Retry-After over the limits above
503 {"error": "unavailable"} not configured
422 default list format hw_id too short or too long

POST /pws/claim/poll

Anonymous, for the gateway. Poll for the credentials once the owner has approved the code. The credentials are returned once and cannot be read back.

Request body (JSON)

Field Type Required Bounds
device_code string yes 16 to 256 characters

Response

200 once approved:

Field Type Notes
device_id string such as d_abcdefghij
user_id integer the owner’s account id
mqtt object the broker settings: url, host, port, transport (wss), path, username, client_id, password. The password is shown only in this response
credential_version integer

Errors

All 400 with a top level error:

error Meaning
authorization_pending the owner has not approved yet. Keep polling at interval
slow_down polling too fast. Includes a new interval in seconds. Add it to the wait
expired_token the code expired. Start again
access_denied the owner denied it

503 with unavailable when not configured. 422 default list format for a device_code outside its length.

GET /pws/device/identity

For the gateway. The gateway proves its credential and learns who owns it, so it can move to the right topics after a change of owner. It authenticates with HTTP Basic, Authorization: Basic base64(device_id:password), the same pair it uses for the broker. Rate limited to 30 requests an hour per device and 120 an hour per address.

Response

200:

Field Type Notes
device_id string
user_id integer the current owner
credential_version integer

Errors

Status Body When
401 {"error": "invalid_credential"} every failure looks the same: no header, unknown device, wrong password, not active or no owner
429 {"error": "rate_limited"} and Retry-After
503 {"error": "unavailable"} not configured

POST /pws/claim/approve

Owner. Bind the code shown on a gateway to this account. The number of gateways an account may hold depends on its plan: 1 on the free plan and 3 on Supporter and Business.

Request body (JSON)

Field Type Required Bounds
user_code string yes 4 to 16 characters. Dashes, spaces and case are ignored

Response

200:

{"device": {"device_id": "d_abcdefghij", "name": null, "status": "unclaimed", "fw": "1.4.2"}}

status becomes active when the gateway collects its credentials.

Errors

Status Body When
404 {"detail": {"code": "invalid_code", "message": "That code is not valid or has expired."}}
409 {"detail": {"code": "device_limit", "message": "...", "limit": 1, "used": 1}} every gateway slot on the plan is in use
429 {"detail": {"code": "rate_limited", "message": "Slow down."}} and Retry-After more than 10 attempts a minute
429 {"detail": {"code": "approve_locked", "message": "...", "retry_after": 1800}} and Retry-After locked after 20 wrong codes in an hour

GET /pws/gateways

Owner. The account’s gateways and how many the plan allows. Gateways that were unlinked are not listed.

Response

200:

Field Type Notes
limit integer slots on the plan
used integer gateways that are active or suspended
gateways array gateways, below

A gateway has:

Field Type Notes
device_id string
name string or null
status string unclaimed, active or suspended
presence string online, offline or unknown
last_seen, last_obs_at, claimed_at string or null UTC
fw string or null
update_state string or null
net_link, carrier string or null from the gateway’s telemetry
rssi_dbm integer or null
location object or null lat, lon, fuzzed_radius_km. Only a blurred point. The exact position is never returned
stations integer how many stations hang off the gateway
aprs_station_id string or null the linked CWOP or APRS station, such as cwop:FW8180
{
  "limit": 3,
  "used": 1,
  "gateways": [
    {"device_id": "d_abcdefghij", "name": "Back yard", "status": "active", "presence": "online", "last_seen": "2026-11-23T19:58:00Z", "last_obs_at": "2026-11-23T19:55:00Z", "fw": "1.4.2", "update_state": null, "net_link": "wifi", "carrier": null, "rssi_dbm": -61, "location": {"lat": 41.59, "lon": -93.62, "fuzzed_radius_km": 1.0}, "stations": 1, "claimed_at": "2026-10-01T15:00:00Z", "aprs_station_id": null}
  ]
}

GET /pws/gateways/{device_id}

Owner. One gateway with its stations and telemetry.

Parameters

Name In Type Required Bounds
device_id path string yes 1 to 64 characters, letters, digits, _ and -, starting with a letter or digit

Response

200: every field of a gateway above, plus:

Field Type Notes
tel object the last telemetry the gateway sent, limited to uptime_s, time_synced, time_src, cpu_temp_c, throttled, mem_free_mb, data_used_pct, outbox_depth, outbox_oldest_s, net_link, carrier, modem_rssi_dbm, modem_reg, gps_fix, gps_sats
station_list array the gateway’s stations, as under GET /pws/stations

PATCH /pws/gateways/{device_id}

Owner. Rename a gateway, set where it is, or link it to an APRS or CWOP station. Unknown fields are refused. Returns the gateway, as in the list.

Request body (JSON)

Field Type Bounds
name string or null max 100. Empty or null clears the name
lat, lon number -90 to 90 and -180 to 180. Send both or neither. Setting a location stores the exact point privately and publishes only a blurred one
aprs_station_id string or null max 16. A CWOP id such as FW8180 or an amateur callsign such as W0ANA-15, optionally prefixed CWOP: or APRS:. Null or empty unlinks. The station must be known, have a position, be within 5 km of the gateway, and not be claimed by another gateway

Errors

Status Body When
422 {"detail": {"code": "lat_lon_together", "message": "Send lat and lon together."}} only one of the pair, or one of them null
422 {"detail": {"code": "bad_aprs_id" or "location_required" or "aprs_station_unknown" or "aprs_station_unplaced" or "aprs_station_far", "message": "..."}} the link failed its checks. location_required means set the gateway location first
409 {"detail": {"code": "aprs_id_in_use", "message": "..."}} another gateway already uses that station
503 {"detail": {"code": "not_configured", "message": "..."}} location or station lookup is not available
422 default list format an unknown field, a bad type or a value over its bound

DELETE /pws/gateways/{device_id}

Owner. Unlink a gateway. Its credential stops working and its connection is dropped. Returns 204 No Content.

POST /pws/gateways/{device_id}/commands

Owner. Queue a command for a gateway to carry out. The service signs it and sends it to the gateway.

Request body (JSON)

Field Type Required Default Bounds and values
type string yes reboot, bundle, update-check, resync, diag or config. capture is accepted by the schema but always refused
body object no {} per type, below. Unknown keys pass
ttl_s integer no 300 10 to 3600, how long the command stays valid

Body rules: diag needs action, one of restart_service, rediscover, connectivity_test or clear_outbox, and restart_service also needs a non empty service. resync needs from, a UTC timestamp ending in Z, and may carry to in the same form. Other types have no required body fields. Unknown fields at the top level are refused.

Limited to 10 commands a minute per gateway.

Response

202 Accepted:

{"command_id": "c_01JD8ZP4XK0QW3N7T5V6B2M9YR", "state": "queued", "exp": "2026-11-23T20:05:00Z"}

Errors

Status Body When
409 {"detail": {"code": "device_not_active", "message": "This gateway is not active."}}
422 {"detail": {"code": "command_not_allowed" or "invalid_body", "message": "..."}} capture, or a body that fails its rule
429 {"detail": {"code": "rate_limited", "message": "Too many commands for this gateway."}} and Retry-After

GET /pws/gateways/{device_id}/commands/{command_id}

Owner. A queued command’s state and the gateway’s acknowledgement.

Parameters

Name In Type Required Bounds
device_id path string yes as above
command_id path string yes 1 to 128 characters, letters, digits, _, . and -, starting with a letter or digit

Response

200: command_id, state, exp, type, published_at (or null), acked_at (or null) and ack (an object, or null).

Errors

404 with gateway_not_found or command_not_found.

GET /pws/stations

Owner. The account’s physical stations across all its gateways.

Response

200 with {"stations": [...]}. Each station:

Field Type Notes
station_id integer
device_id string the gateway
station_key string the station’s key on the gateway
name, model string or null
alt_m number or null metres
wind_height_m number or null metres
selected boolean the station is used
fields array of string the fields the owner enabled
last_fields array of string the fields it last reported
last_obs_at string or null UTC
relay_owner string
rssi_db, snr_db number or null link quality
battery_ok boolean or null

PUT /pws/stations/{station_id}

Owner. Set a station’s name, heights, selection and fields. A field left out is unchanged. Unknown fields are refused. Returns the station.

Parameters

Name In Type Required Bounds
station_id path integer yes 1 or more

Request body (JSON)

Field Type Bounds
name string or null max 100
alt_m number or null -500 to 9000
wind_height_m number or null 0 to 500
selected boolean null is ignored
fields array of string or null at most 32. Each one of temp_c, humidity_pct, pressure_station_hpa, wind_speed_ms, wind_gust_ms, wind_dir_deg, rain_mm, uv_index, light_lux, solar_wm2, lightning_count, lightning_km

Errors

Status Body When
404 station_not_found
422 {"detail": {"code": "unknown_field", "message": "Unknown fields: ..."}} a name in fields is not one of those

GET /pws/stations/{station_id}/current

Owner. The latest five minute bucket of one station.

Response

200:

Field Type Notes
station_id integer
observed_at, bucket_start string or null UTC start of the bucket. Null when nothing has arrived
age_s integer or null seconds since the bucket start
stale boolean true when there is no bucket or it is older than 20 minutes
interval_s integer or null
values object field name to number or null, in SI style units: degrees C, percent, hPa, metres per second, millimetres, degrees
aggregates object per field kind (avg, max, vec, sum, last or derived), value, and min and max where the device sends them

With no data the answer is 200 with observed_at null and empty values.

{"station_id": 12, "observed_at": "2026-11-23T19:55:00Z", "bucket_start": "2026-11-23T19:55:00Z", "age_s": 140, "stale": false, "interval_s": 300, "values": {"temp_c": 8.4, "humidity_pct": 61.0}, "aggregates": {"temp_c": {"kind": "avg", "value": 8.4, "min": 8.2, "max": 8.7}}}

GET /pws/stations/{station_id}/history

Owner. Up to 24 hours of five minute buckets for one station. Gaps are absent points, not interpolated.

Parameters

Name In Type Required Default Bounds
station_id path integer yes 1 or more
hours query integer no 24 1 to 24
fields query string no all max 400 characters. Comma separated. The stored fields above plus the derived pressure_slp_hpa and wind_speed_10m_ms

Response

200:

Field Type Notes
hours integer
interval_s integer 300
series object field name to an array of {"ts": "...Z", "v": number or null}, at most 288 points. Fields with no points are omitted
groups object empty on this route

Errors

422 with {"detail": {"code": "unknown_field", ...}} for an unknown name in fields, or the default list format for hours out of range.

GET /pws/composite

Owner. Which of the account’s stations answers for which kind of measurement, with how fresh each is. Where nothing is set, the default is used and composite_id is null.

Response

200:

Field Type Notes
composite_id integer or null
name string defaults to My weather station
location_station_id integer or null the station whose position stands for the composite
groups object keyed by group: temperature, humidity, pressure, wind, rain, solar_uv, lightning. Each has station_id, station_name, last_obs_at, age_s, stale, fields (each field, station_id, station_name, last_obs_at, age_s, stale) and source (owner or default)
stale_groups array of string groups older than 20 minutes

PUT /pws/composite

Owner. Replace the map of group to station. Groups left out are unassigned and read as null. Unknown fields are refused. Returns the composite.

Request body (JSON)

Field Type Bounds
name string or null 1 to 100 characters
fields object keys from the seven groups above, values station ids. Default {}
location_station_id integer or null one of the account’s stations

Every station must be the account’s, selected, and have reported a field of that group in the last 24 hours.

Errors

Status Body When
404 station_not_found a station that is not the account’s
400 {"detail": {"code": "station_not_selected", "group": "wind"}} the station is not selected
400 {"detail": {"code": "station_has_no_field", "group": "wind"}} it has not reported that group in 24 hours
422 default list format an unknown group key

GET /pws/composite/current

Owner. The composed current reading, each group read from its mapped station, with where each value came from.

Response

200:

Field Type Notes
composite_id integer or null
name string
observed_at string or null the newest bucket used
norm_v null reserved
values object field name to value, station_id, station_name, age_s, derived, mixed_sources
groups object group to its source: station_id, station_key, station_name, bucket_start, age_s, stale, source, or null when unmapped
stale_groups array of string

GET /pws/composite/history

Owner. The composed series, each group from its mapped station. Parameters and the series shape are as for GET /pws/stations/{station_id}/history, and groups carries the same provenance as above. Up to 24 hours at 5 minute buckets.

Parameters

Name In Type Required Default Bounds
hours query integer no 24 1 to 24
fields query string no all max 400 characters, comma separated

Errors

422 with unknown_field for an unknown name, or the default list format for hours out of range.

View this page as Markdown

May we use Microsoft Clarity to see how pages are used (clicks, scrolling and replays of a visit, with anything you type hidden), plus a random ID linking that to crash reports? Only to find bugs and confusing screens. Never advertising, never sold.