# Make an MQTT credential or API key

> The Credentials page of your account: every API key, MQTT credential and Home Assistant connection in one table, the New credential wizard, and how forecast offices reach an MQTT credential.

Accounts · How-to guide · https://wxalerts.org/docs/accounts/credentials/

<!-- The page is lib/dash/views/credentials.ts. MQTT credentials are
     api.wxalerts.org services/mqtt_credentials.py, API keys
     services/api_keys.py, offices services/mqtt_wfos.py. The offices are
     chosen under Places (lib/dash/views/places.ts), not on this page. -->

The [Credentials](/account/#credentials) page of your account lists every API
key, MQTT credential and Home Assistant connection you hold in one table, and
its **New credential** button makes a key or an MQTT credential. Any account
can use it, on any plan.

Each row shows the name, what it can read, its identifier, when it was made,
when it was last used and its status, with the actions for it: **Extend** and
**Revoke** on a key, **New password** and **Revoke** on an MQTT credential,
**Remove** on a Home Assistant connection. Next to the table, **What you hold**
shows how many of each you have against your limit, **API requests** charts the
last 30 days of calls, and **Your MQTT feed** shows the server and your topics.

The shared public MQTT login and the first MQTT feed (V1) are deprecated and
stop on **Friday, January 1, 2027**. An MQTT credential from this tab is the
replacement.

## Which one you need

- **API key**: for your own scripts, dashboards and apps that call the REST
  API on `/v1`. See [Make, send and revoke an API key](/docs/developers/api-keys/)
  for how to use one.
- **MQTT credential**: a live stream of your own alerts and lightning, over MQTT
  on WebSocket, for Node-RED, a script or a device of your own.

Home Assistant is not made here. The WxAlerts integration signs itself in, and
its connections appear in the table so you can see them and remove one. See
[Manage instances and options](/docs/integrations/home-assistant/manage-instances/).

## Make one

1. Sign in and open [Credentials](/account/#credentials).
2. Choose **New credential**, pick **API key** or **MQTT credential**, and
   choose **Next**. This is step 1 of 2.
3. Give it a name you will recognise later, such as the program that uses it.
   For an API key, also pick what it can read and when it expires.
4. Choose **Create key** or **Create credential**. The key or password is shown
   once, with a **Copy** button beside it. Copy it before you choose **Done**:
   it is stored only as a hash and nobody can show it to you again.

You can hold up to ten live API keys and three MQTT credentials.

## What an MQTT credential can read

| | |
| --- | --- |
| Server | `wss://mqtt.wxalerts.org/mqtt` (host `mqtt.wxalerts.org`, port `443`, TLS) |
| Username | shown in the table, `ha-` followed by 12 characters |
| Alert topics | `V2/{user_id}/NWS/#`, your account's alerts |
| Lightning topics | `V2/{user_id}/GLM/#`, your account's lightning |
| Your own topics | `V2/{user_id}/HA/{key}/#`, your places and storm cell alerts near them. `{key}` is the username without `ha-`. The older `wxalerts/u/{username}/#` carries the same messages until Friday, January 1, 2027 |

The alert and lightning topics belong to your account, so every credential you
make reads the same two filters, and they do not change when you add or remove a
place. What is sent on them does: an alert is sent when one of your
[places](/account/#places) is inside it, and lightning when a strike is within
the range you set for a place. A client that is already connected hears the
change within a few minutes.

It cannot publish, and it cannot read any other account's topics. The topics and
payloads are described in the [MQTT alerts feed](/docs/developers/mqtt/alerts/)
and [lightning feed](/docs/developers/mqtt/lightning/) references.

Limits: 2 connect attempts a minute and 1 live connection per account, or 5
connect attempts and 1 live connection for a commercial account. See
[Limits](/docs/developers/mqtt/alerts/#limits).

## Set a lightning range for a place

Lightning is sent for a place only when it has a range. On the
[Places](/account/#places) page, open a place, choose the **More alerts** tab
and enter its **Lightning range, in miles**, from 1 to 200. Leave it empty for
no lightning at that place. Choose **Save**.

## Choose forecast offices

Meteorologist and EOC accounts also hear every alert from forecast offices they
choose, whether or not a place is inside it. The offices are chosen on the
[Places](/account/#places) page, in the **Forecast office** table below your
places, which appears only on those accounts.

- Choose up to four offices with **Add an office**.
- The first can be any office. Each one after it must border an office you have
  already chosen.
- Remove an office with **Remove**. You cannot remove one if the rest would no
  longer be connected through shared borders.

The steps are in
[Monitor a forecast office](/docs/alerts/saved-places/#monitor-a-forecast-office).

Lightning inside those offices' areas plus 50 miles is sent too, as the lightning feed rolls out. A
regular account does not choose offices, and a commercial account hears
everything.

## New password, or revoke

- **New password** makes a new password for a credential and keeps its
  username. The old password is refused the next time the client connects.
- **Revoke** stops a key or credential for good. An MQTT credential is
  disconnected at once and its topics are emptied. An API key stops working
  within a minute.

Make one credential per program, so revoking one stops only that program. Keep to
one live connection: a second client on a regular account is refused.
