Agent-readable docs index: /llms.txt. Full docs in one file: /llms-full.txt. Download /docs.zip to grep all markdown files locally.

Get your Mesub API key

Every call your server makes to Mesub carries the project's API key. A project has one key at a time, and the key is the project: no call names a project id.

Create it

  1. Open the dashboard and pick the project in the top bar.
  2. Open Developers. Under API key, press Create the key.
  3. Copy the key. It starts with SUB_.
The key is shown once. Mesub stores a hash of it, so nobody can read it again afterwards, you included. Once the window is closed, the dashboard only says that the project has a key and when it was last used. If you lose it, rotate it.

Put it on your server

MESUB_API_KEY=SUB_...
@mesub/node reads that variable by itself:
import { Mesub } from '@mesub/node'; const mesub = new Mesub(); // reads MESUB_API_KEY
Keep the key on your server. It creates subscriptions and reads your subscribers, so it never goes in a browser, a mobile app or a repository. The React widget does not need it: it talks to the routes @mesub/node mounts on your server.

Check that it works

curl "https://api.mesub.io/v1/project" \ -H "Authorization: Bearer $MESUB_API_KEY"
A 200 with the project's id means the key is good:
{ "id": "cmufsl77w001ag2s6pp1ngf9p" }
In Developers, the line under the key then says it was last used just now.
StatusCodeMeaning
401missing_api_keyNo Authorization: Bearer header was sent
401invalid_api_keyNot a key Mesub issued, or one rotated since

Rotate it

In Developers, Rotate draws a new key and shows it once, like the first.
The old key stops working at that moment. There is no period where both are accepted, so rotate when you are ready to deploy the new one: between the rotation and your deploy, your server's calls answer 401.
Rotate when a key may have leaked, when someone who knew it leaves, or when it is lost.