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

Text message enrollment

Enroll the account holder's own mobile number for text alerts: record consent, send a code, confirm it, or remove the number.


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

Enrolling a phone number is two steps: start (which records consent and texts a six digit code) and verify (which activates the number). Nothing but the code is ever sent to a number that has not been confirmed. Texts for other people are added as contacts instead.

Access for all four routes: session cookie only. A Bearer token gets 401. Writes need the X-Requested-With: wxalerts header. The full number never comes back from any route; only its last four digits do. Responses are Cache-Control: no-store. See the overview for the sign-in errors.

Only US and Canadian numbers are accepted: 10 digits, or 11 starting with 1. Punctuation is stripped. A number is stored as +1 and ten digits.

Enrollment object

Field Type Description
status none, pending or active none no number, pending a code is out, active confirmed
phone_last4 string or null the last four digits. null when status is none
verified_at string or null UTC timestamp of confirmation
pending_expires_at string or null when the pending code expires, 10 minutes after it is sent. Only set while pending
eligible boolean whether the account’s plan includes texts. A confirmed number on a plan without texts is active with eligible false and is sent nothing
required_tier string or null the plan key to offer when texts are not included, such as pro
{
  "status": "active",
  "phone_last4": "0100",
  "verified_at": "2026-11-02T01:12:44.903Z",
  "pending_expires_at": null,
  "eligible": true,
  "required_tier": "pro"
}

GET /notifications/sms

The account’s current enrollment.

Access: session cookie only. No parameters. Response 200: the enrollment object. With no number, {"status": "none", "phone_last4": null, "verified_at": null, "pending_expires_at": null, "eligible": false, "required_tier": "pro"}.

POST /notifications/sms

Record consent and send a verification code.

Access: session cookie only, with the CSRF header.

Body:

Field Type Required Description
phone string, up to 32 characters yes as typed. Punctuation is fine
consent_version string, up to 32 yes the version of the consent wording the person saw. The current one is 2026-08-v1
consent_text string, up to 2000 yes the exact wording shown, stored as the consent record. A client that shows older wording is recorded with what it actually showed, not refused

The wording to show is: “Yes, text me weather alerts for my saved places. I agree to receive automated text messages from WxAlerts about National Weather Service watches, warnings, and advisories, plus account verification messages. Message frequency varies with weather conditions.”

{
  "phone": "(850) 555-0100",
  "consent_version": "2026-08-v1",
  "consent_text": "Yes, text me weather alerts for my saved places. I agree to receive automated text messages from WxAlerts about National Weather Service watches, warnings, and advisories, plus account verification messages. Message frequency varies with weather conditions."
}

Response 200: the enrollment object, with status of pending.

Status Body When
400 {"detail": "That does not look like a 10-digit US or Canadian mobile number."} the number does not normalize
400 {"detail": "That number is already on another WxAlerts account. Reply STOP from the handset to release it, or use a different number."} the number is enrolled elsewhere
400 {"detail": "That number has replied STOP. Text START to the same number to allow messages again, then add it here."} the handset opted out
400 {"detail": "Too many codes sent to that number in the last hour. Try again later."} more than 5 codes to one number in an hour
400 {"detail": "..."} the carrier refused the send, for example a number that cannot receive texts. A message the person can act on is shown; otherwise “We could not send a code just now. Try again in a few minutes.” The number stays pending and the request can be repeated
402 channel upgrade body with error of sms_requires_tier the plan does not include texts. Checked before any code is sent
503 {"detail": "Text messaging is not configured on this deployment."} messaging is switched off

POST /notifications/sms/verify

Confirm the code and activate the number.

Access: session cookie only, with the CSRF header.

Body:

Field Type Required Description
code string, up to 12 characters yes the six digits. Non-digits are ignored

Response 200: the enrollment object, with status of active.

A wrong code counts against the code. Five wrong tries burn it.

Status Body When
400 {"detail": "There is no number waiting to be confirmed. Start again."} nothing pending
400 {"detail": "That code has expired. Ask for a new one."} more than 10 minutes old
400 {"detail": "Too many wrong codes. Ask for a new one."} five wrong tries used
400 {"detail": "That code was not accepted. 3 tries left."} wrong code; the count varies. The last wrong try says “That code was wrong, and that was the last try. Ask for a new one.”

DELETE /notifications/sms

Remove the number.

Access: session cookie only, with the CSRF header. No parameters.

Response 200: the enrollment object, always status of none. Removing when nothing is enrolled is not an error. The consent record is kept.

Rate limits

There is no per-request limit on these routes. The limit that applies is on codes: five per number per hour, counted whether or not the number is the caller’s.

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.