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

Sign-in and session

Sign in and out, who am I, entitlements, linked social sign-ins, the Level II token and account deletion, with the session, Bearer and CSRF rules every account route shares.


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

These routes sign a person in, say who they are and what their plan allows, and sign them out. They are for the WxAlerts website and the WxAlerts apps. A script or a server that only reads weather does not need them: it uses an API key on the weather routes.

None of these routes accept an API key. A key sent as a Bearer credential here is refused with 401 api_key_not_accepted.

Sessions, Bearer and CSRF

Every account route on this site (this page and Account, API keys, MQTT credentials, Home Assistant, Billing and the others in the API reference) is called in one of two ways.

Browser session Bearer token
Who wxalerts.org the WxAlerts phone app, and the Home Assistant integration
Credential the __Host-wx_session cookie, set by /auth/callback: HttpOnly, Secure, SameSite=Lax, scoped to the API host Authorization: Bearer <access token> from the WxAlerts sign-in (OAuth 2 with PKCE)
CSRF header required on every request that is not GET, HEAD or OPTIONS: X-Requested-With: wxalerts not required
Lifetime slides, 7 days idle, 30 days absolute the token’s own expiry; refresh it and retry on a 401

A browser cannot call these routes from another website: CORS allows only wxalerts.org and www.wxalerts.org, with credentials. Do not build a web page of your own against them.

Some routes depend on the cookie only. Those are marked “session only” and answer a Bearer token with 401. Where a route says “session or Bearer” both work, and Bearer is tried first: a bad Bearer token is 401 even when a valid cookie is also present.

A Home Assistant token is narrower than the phone’s. It works only on the /integrations/home-assistant/ routes and is refused anywhere else with 403 token_out_of_scope.

Errors every account route can return

Status Body When
401 {"detail": "Not signed in."} no cookie and no Bearer token
401 {"detail": "Session expired."} the cookie is unknown, expired or its account is gone
401 {"detail": "Access token is not valid."} with WWW-Authenticate: Bearer the Bearer token failed verification or has expired
401 {"detail": {"code": "api_key_not_accepted", "message": "..."}} a wx_ API key was sent as a Bearer credential
403 {"detail": "Missing X-Requested-With header."} a cookie request that changes state without the CSRF header
403 {"detail": {"code": "account_disabled", "message": "..."}} the account has been disabled. Email [email protected]
403 {"detail": {"code": "account_deleted", "message": "..."}} a token for an account that was deleted
403 {"detail": {"code": "token_out_of_scope", "message": "..."}} a Home Assistant token used outside its routes
422 {"detail": [{"type": "...", "loc": ["body", "field"], "msg": "...", "input": ...}]} a path, query or body value failed validation. This is the default FastAPI list, and loc names where the value was
429 {"detail": ...} with Retry-After a per-route limit, named on the route
500 {"detail": "Something went wrong on our end. Please try again."} an unexpected failure
503 {"detail": "..."} sign-in or accounts are not configured on this deployment

Two body shapes exist. Older routes answer {"detail": "text"}. Newer routes answer {"detail": {"code": "snake_case", "message": "text"}}, sometimes with extra fields. Branch on code when there is one and on the status otherwise. Each route below says which it uses. See also Errors.

Timestamps in account responses are ISO 8601 in UTC with a Z suffix, such as 2026-11-23T17:04:05Z, unless a route says otherwise. Dates are YYYY-MM-DD. Account responses are not cached: those that carry credentials or plan state send Cache-Control: no-store.

GET /auth/login

Starts sign-in. Anonymous. Responds 303 to the identity provider and sets a short-lived, encrypted login cookie (10 minutes) that remembers the round trip.

Name In Type Required Notes
next query string (URL) no where to land after sign-in. Must be https on wxalerts.org or www.wxalerts.org. Anything else is silently replaced by https://wxalerts.org/account
Status Body When
303 none, Location is the identity provider normal
502 {"detail": "The identity provider is unavailable."} the provider could not be reached
503 {"detail": "Sign-in is not configured on this deployment."} sign-in is not set up

GET /auth/callback

Completes sign-in. This is where the identity provider sends the browser back; you do not call it yourself. Anonymous, but it needs the login cookie from /auth/login.

Name In Type Notes
code query string the authorization code
state query string must match the login cookie
error query string when present, the person declined or the provider failed: 303 to the site’s front page

On success the API creates the session, sets __Host-wx_session, clears the login cookie and answers 303 to the next chosen at /auth/login.

Status Body When
303 none success, a provider error, or a callback that arrived without its login cookie. In that last case the browser is sent once back through /auth/login, which is how a sign-up finished in a different browser still ends signed in
400 {"detail": "Invalid callback."} code or state missing, or state does not match
400 {"detail": "Sign-in could not be completed."} the code could not be exchanged or the ID token was not valid
400 {"detail": "Sign-in could not be completed. Your account is ready - please sign in from wxalerts.org."} the one-time restart already ran and the browser still has no login cookie
403 {"detail": "This account has been deleted."} the account was deleted
503 {"detail": "Sign-in is not configured on this deployment."} sign-in is not set up

POST /auth/logout

Ends the session. Session only. Needs the CSRF header. Deletes the session on the server, clears the cookie, and returns the identity provider’s end-session URL, which the browser should navigate to so the single sign-on session ends too. It never fails for lack of a session: signed out already still answers 200.

Response 200:

Field Type Description
ok boolean always true
end_session_url string or null navigate here to finish signing out; null when the provider could not be asked
{ "ok": true, "end_session_url": "https://auth.wxalerts.org/application/o/wxalerts-web/end-session/?id_token_hint=...&post_logout_redirect_uri=https%3A%2F%2Fwxalerts.org%2Fsigned-out%2F" }
Status When
403 {"detail": "Missing X-Requested-With header."} without the CSRF header

GET /auth/me

Who is signed in. Session only. Identity and nothing else.

Field Type Description
id integer the account’s numeric id. It is the <user id> in your MQTT topics
sub string the stable identity provider subject
email string or null the account’s email
email_verified boolean whether that email is verified
name string or null display name
{ "id": 12345, "sub": "5f1c0d...", "email": "[email protected]", "email_verified": true, "name": "Pat Example" }

Errors: the common account errors. A Bearer client reads the same id from GET /account/type.

GET /auth/entitlements

The account’s plan and its ceilings. Session or Bearer. Cache-Control: no-store, because a plan changes the moment a card is charged or declined.

Field Type Description
tier string free, pro, business, business_50 or legacy_supporter. pro is the Supporter plan; legacy_supporter is the grandfathered donor tier
tier_label string the name to show: for example Free, Supporter or Donor; a retired plan keeps its old label
max_places integer saved places allowed
contacts_per_place integer channels or contacts allowed on one place
channels array of string the channels the account can actually be reached on today, sorted
sms_per_month integer text messages a month
voice_calls_per_month integer calls a month
upgrade_tier string or null the next plan up, or null at the top
upgrade_tier_label string or null its display name
addons.voice object active, sellable (always false: voice is part of the plan), price_cents, label, interval (year). Kept for older clients
addons.capacity_pack object count held, sellable (true), requires_plan (true), places_each (5), sms_each (50), calls_each (5), max_quantity (100) and held_product_ids, the store pack products held now
plan_source string or null where the plan comes from, for example stripe, app_store, play_store or comp (a complimentary grant). null without a plan
level2 boolean NEXRAD Level II live radar. True for every signed in account
home_assistant object available (the plan includes it), limit (instances allowed), used (instances active), has_login (used above 0)
life_safety object the alert set that is locked on everywhere: phenomena, significance, emergencies, events, reason
life_safety_events array of string the same set as NWS event names
{
  "tier": "pro", "tier_label": "Supporter", "max_places": 5, "contacts_per_place": 5,
  "channels": ["email", "push", "sms", "voice", "webhook"],
  "sms_per_month": 100, "voice_calls_per_month": 20,
  "upgrade_tier": null, "upgrade_tier_label": null,
  "addons": {
    "voice": { "active": true, "sellable": false, "price_cents": 1499, "label": "Voice calls", "interval": "year" },
    "capacity_pack": { "count": 0, "sellable": true, "requires_plan": true, "places_each": 5, "sms_each": 50, "calls_each": 5, "max_quantity": 100, "held_product_ids": [] }
  },
  "plan_source": "stripe", "level2": true,
  "home_assistant": { "available": true, "limit": 1, "used": 0, "has_login": false },
  "life_safety": { "phenomena": ["TO", "SV", "FF", "EW", "HU", "SS", "TS", "SQ"], "significance": "W", "emergencies": true, "events": ["Tornado Warning", "Severe Thunderstorm Warning", "Flash Flood Warning"], "reason": "Life-safety warnings are always on" },
  "life_safety_events": ["Tornado Warning", "Severe Thunderstorm Warning", "Flash Flood Warning"]
}

The figures in the example are illustrative and the events list is shortened: read the live values rather than copying them. Errors: the common account errors.

GET /auth/reauth

Asks the person for their password again, then returns to the site. The site uses it before account deletion. Browser navigation, anonymous or signed in. With a live session it re-proves that session’s own account; without one it is an ordinary sign-in with the same forced prompt.

Name In Type Required Notes
next query string (URL) no same allow-list as /auth/login

Answers 303 to the identity provider, 502 or 503 as for /auth/login. It finishes at /auth/callback, then lands on next. A re-authentication that asked for a different account than the one signed in is refused with 400 {"detail": "Step-up must be completed with the account that is signed in."}.

GET /auth/step-up

Used only by the WxAlerts staff admin panel to re-confirm a staff member’s identity before a sensitive action. It is not part of what an app or script builds on and is listed here so every route is accounted for. Session only; it answers 303 to the identity provider and returns to the admin panel.

GET /auth/me/delete

Whether the signed-in account can be deleted right now. Session or Bearer.

Field Type Description
fresh boolean the last real sign-in was recent enough to delete on
reauth_url string or null for a browser that is not fresh: send the person here (add ?next=) first. null when fresh, and null for Bearer clients, which sign in again themselves with prompt=login
fresh_minutes integer how recent counts as fresh. 10
{ "fresh": false, "reauth_url": "https://api.wxalerts.org/auth/reauth", "fresh_minutes": 10 }

POST /auth/me/delete

Deletes the signed-in account. Session or Bearer; the CSRF header is required for the cookie. Deletion signs the account out everywhere and stops its alerts first, then removes its data. The account page on the website is the person’s way to do it.

Request body (JSON):

Field Type Required Default Notes
confirm string yes in effect "" at most 320 characters. Must be DELETE or the account’s own email, ignoring case and surrounding space
Status Body When
200 {"status": "deleted"} every step finished. The session cookie is cleared
202 {"status": "pending"} the account is gone from the person’s side and a final step (the identity provider, billing, photo storage or the goodbye email) is retried in the background
400 {"detail": {"code": "confirmation_required", "message": "Type DELETE to confirm."}} confirm did not match
403 {"detail": {"code": "reauth_required", "message": "...", "reauth_url": "..."}} the last sign-in is older than 10 minutes. reauth_url is null for Bearer
409 {"detail": {"code": "admin_account", "message": "..."}} the account holds staff access, which has to be removed first
409 {"detail": {"code": "contact_support", "message": "This account cannot be deleted online. Email [email protected]."}} any other reason the account cannot be deleted online
429 {"detail": {"code": "rate_limited", "message": "..."}} with Retry-After more than 1 attempt a minute (burst 5) per account

Order of checks: rate limit, freshness, confirmation, then eligibility.

GET /auth/connections

The social sign-ins (the OAuth providers the identity service offers) and whether each is linked to this account. Session only.

Response 200: {"providers": [ ... ]}, one row per enabled provider.

Field Type Description
slug string the provider id, such as google. Matches ^[a-z0-9][a-z0-9_-]{0,63}$
name string display name
connected boolean linked to this account
can_disconnect boolean false when unlinking would leave no way to sign in
{ "providers": [ { "slug": "google", "name": "Google", "connected": true, "can_disconnect": false } ] }
Status When
404 {"detail": {"code": "unknown_source" or "not_connected" or "refused", "message": "..."}} the provider problem
502 {"detail": "The identity provider did not complete the request."}

GET /auth/connections/{slug}/connect

Links a social sign-in to the signed-in account. A browser navigation from the account page, not an XHR. Session only in practice: signed out, it behaves as an ordinary sign-in that returns to the account page.

Name In Type Notes
slug path string an enabled provider’s slug. A malformed slug is 404 unknown_source

It runs the OIDC round trip, checks that the identity provider answered for the account that is signed in, then redirects (303) to the provider’s own sign-in to finish the link. If the check fails nothing is linked and the browser returns to the account page with ?connect-failed=1. Errors: 404 unknown_source for a slug that is not an enabled provider, 502 and 503 as for /auth/login.

DELETE /auth/connections/{slug}

Unlinks a social sign-in. Session only. Needs the CSRF header.

Name In Type Notes
slug path string the provider’s slug

Response 200 is the updated {"providers": [...]} as for GET /auth/connections.

Status Body When
404 {"detail": {"code": "unknown_source" or "not_connected", "message": "..."}} unknown provider, or not linked
409 {"detail": {"code": "last_sign_in_method", "message": "..."}} it is the account’s only way to sign in
502 {"detail": "The identity provider did not complete the request."} the identity provider failed

GET /auth/l2-token

A short-lived access token the website hands to the Level II radar service so the browser can fetch live radar chunks. Session only. It is for wxalerts.org’s own pages: the token is accepted by the radar service and by nothing else, and this API refuses it as a credential.

The CSRF header is required even though this is a GET, because the body is a credential. Cache-Control: no-store.

Field Type Description
access_token string the token
expires_at string or null ISO 8601 with a +00:00 offset, not Z
expires_in integer or null whole seconds left, never negative
role string the access role name the radar service checks
holds_role boolean always true here
level2 boolean always true here
Status Body When
401 {"detail": "Please sign in again."} the stored token cannot be read or refreshed
403 {"detail": "Missing X-Requested-With header."} no CSRF header

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.