Issue and revoke keys
Keys are managed with a command on the server that runs the API. There is no web page or endpoint for it, so only someone with access to the server can issue one.
How you run the command depends on how the API is deployed:
| Deployment | Command |
|---|---|
| Docker | docker compose exec api node dist/cli/keys |
| Built, without Docker | npm run keys:prod -- |
| Local development | npm run keys -- |
The examples below use the Docker form.
Issue a key
Section titled “Issue a key”Name the key for the client or environment it is for. The name is only a label for you.
docker compose exec api node dist/cli/keys create "Acme Re, production"Key for Acme Re, production:
twr_9cP0fK3...
Send it to the client now. It cannot be shown again.Only a SHA-256 fingerprint of the key is stored. Send the key to the client over a channel you trust, and do not keep a copy.
Issue separate keys for a client’s test and production systems, so one can be revoked without touching the other.
See what has been issued
Section titled “See what has been issued”docker compose exec api node dist/cli/keys listtwr_9cP0fK3x active created 2026-11-16 last used 2026-11-17 Acme Re, productiontwr_Lm2vQ8ay revoked created 2026-10-02 last used 2026-10-30 Acme Re, testThe first column is the start of each key, enough to tell them apart. “Last used” shows which keys are in use and which were never taken up.
Revoke a key
Section titled “Revoke a key”Pass the prefix from the list:
docker compose exec api node dist/cli/keys revoke twr_9cP0fK3xThe key stops working on the next request. Revoking cannot be undone; issue a new key if it was a mistake.
Replace a key
Section titled “Replace a key”To rotate a key without an outage:
- Issue a new key for the client.
- Have them deploy it.
- Watch “last used” on the old key stop advancing.
- Revoke the old key.
When a client asks for a key
Section titled “When a client asks for a key”The Get an API key page tells clients to write to [email protected]. Set that address, and the API address quoted across this site, in docs/site.config.mjs or with the TOWERS_KEY_CONTACT and TOWERS_API_URL environment variables when building the site.