Skip to content

Authentication

The REST API uses newsletter API keys. Each key belongs to exactly one newsletter, can be revoked at any time, and is shown only once when it is created.

Draft documentation. The API ships with the beta and details may change before then.

Create a key

Open API keys in the dashboard, choose a name you will recognise later, and copy the key. Keys start with sm_live_. Only a SHA-256 hash is stored, so a lost key cannot be recovered - revoke it and create a new one.

You can also manage keys with the API itself:

curl https://stalkmail.com/api/v1/api-keys \\
  -X POST \\
  -H "Authorization: Bearer $STALKMAIL_API_KEY" \\
  -H "Content-Type: application/json" \\
  -d '{ "name": "CI deploy" }'

The response contains the plaintext key once. Store it in your secret manager. Revoke it with DELETE /api/v1/api-keys/:id.

Send the key

Pass the key as a bearer token in the Authorization header. Never put a key in a query string, a URL, or client-side code.

curl https://stalkmail.com/api/v1/newsletter \\
  -H "Authorization: Bearer $STALKMAIL_API_KEY"

A missing, malformed, revoked or unknown key returns 401 unauthorized. A key for a different newsletter can never read or change this newsletter's data, even if the resource id is known.

What a key can do

Keys are full-access within their newsletter. They can read analytics and logs, manage subscribers, tags, fields and segments, create and send campaigns, upload media, manage authors, domains, sender settings and API keys, and publish website issues. There are no per-resource scopes yet.

Every API write is recorded in the dashboard log with actorType: "api" and the key id, so you can see which key did what.

Every request also re-checks that the newsletter owner account still exists. If the account was deleted or its user record is missing, the API returns 401 unauthorized even when the key was never revoked. This stops an orphaned newsletter from answering requests after account deletion.

MCP clients

Agent actions run through the dedicated /mcp endpoint using the same API key. The owner can disable those actions in Settings → Notifications without revoking the key. While disabled, the MCP endpoint returns 403 forbidden. Normal REST API traffic is unaffected.

Revoking and rotating

Revoke a key from the dashboard or with DELETE /api/v1/api-keys/:id. Revocation is immediate. If a key may have leaked, revoke it first and create a replacement afterwards. Creating or revoking a key also sends the newsletter owner a dashboard notification.

Rate limits

Limits are applied per key and per route, so a large subscriber sync does not consume the campaign-send budget. Common defaults are 120 requests per minute for reads and 30 per minute for writes, with tighter limits on expensive actions such as sending, imports, media uploads and domain changes. The reference lists each route's limit.

Limits are shared across all serverless instances, so the budget cannot be multiplied by opening more connections. Responses include X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset.

When you hit a limit the API returns 429 rate_limited with a Retry-After header. Back off and retry; do not open more keys to work around it.

Using a client library

There is no official SDK yet. Any HTTP client works because the API is plain JSON over HTTPS. Keep the key server-side and forward only the data your users need.