One credential serves the REST API, the CLI and the MCP server: an API key. This page is the complete account of how it works. If you only need the short version: create a key under Settings, API keys in your organization, send it as Authorization: Bearer wam_live_..., and keep it out of your repository.
What a key looks like
wam_live_k3Jd9Q2mXz7Rb4tVn8wLp0sYc6Ha1Ef5Gi2Kj
- The prefix
wam_live_marks a key created on the production site. Keys created on a preview deployment start withwam_test_and only work there. The two are never interchangeable. - The key is shown exactly once, when it is created. The server stores a hash, not the key, so nobody can show it to you again. The dashboard and
wam auth statusshow the prefix and the last four characters, which is enough to tell keys apart. - Every key has a name (1 to 64 characters), a kind, a set of scopes, a role ceiling and an expiry.
Two kinds of key
Organization key
Bound to one organization. It is the default in the dashboard, the default of wam auth login, and the right key for CI, servers and shared automation: a secret that many jobs and people can read should reach exactly one organization. A request with an organization key needs no further addressing; the key knows its organization. If the request also names one (the X-Wam-Org header or a pinned MCP URL), it must be the same organization, or the answer is 404 not_found.
Account-wide key
Reaches every organization the person who created it belongs to, today and in the future, and it is the only kind that can list or create organizations. That makes it a bigger secret, so the dashboard and the CLI both ask you to confirm the list of organizations it reaches before creating one. Keep it for a human's own shell.
Because it has no bound organization, every request with an account-wide key must name one:
- REST API: the
X-Wam-Org: acmeheader on every organization-scoped call. Without it, 422validation_failedwith a hint pointing atGET /api/v1/organizations, which lists the slugs the key may name. - CLI:
--org acme,WAM_ORG=acme,wam config set org acme, or awam.jsonin the repository. - MCP: pin the organization in the endpoint URL (
/api/mcp/acme), or sendX-Wam-Orgif the client can.
The safety property
An account-wide key gives you no more permission anywhere, only more places to use it. In every organization it reaches, it acts as whatever you already are there: a viewer where you are a viewer, a member where you are a member. If you are removed from an organization, the key loses it on the next request, with nothing to rotate. At a pinned MCP URL, an account-wide key sees exactly what an organization key for that organization would see.
What a key can and cannot do
A key is always weaker than or equal to the person who created it.
- Scopes restrict. A key carries a subset of ten scopes, and a route or tool that needs a scope the key lacks answers 403
insufficient_scope. A scope never grants anything the person could not do themselves. - The role ceiling caps. You choose
viewer,memberoradminwhen creating a key, neverowner, and never above your own role. On every request the key acts as the lower of your live role in that organization and the ceiling.GET /api/v1/mereports both asactor.roleandactor.effectiveRole. - Membership is live. Each request re-reads your membership from the database. Lose the role, and the key loses it with you.
- Writes need a member. Write scopes are only granted when your live role is
memberor higher, and a write with aviewereffective role is 403insufficient_role. - Some things no key can do. Invite or remove members, change roles, change billing, delete an organization or a workspace, or reach
owner. Those are dashboard actions by a signed-in person. - Session cookies are not accepted on
/api/v1or the MCP endpoint. A browser session is for the dashboard; machines use keys.
Scopes
| Scope | Allows | Needs live role |
|---|---|---|
workspaces:read |
List workspaces and read their settings | viewer |
workspaces:write |
Create workspaces, up to the plan's limit | member |
scans:read |
List scans and read their status | viewer |
scans:write |
Run scans, which spends credits | member |
reports:read |
Read scan reports and the answers behind them | viewer |
prompts:read |
Read the prompt set | viewer |
prompts:write |
Add, edit and delete prompts | member |
competitors:read |
Read the competitor list | viewer |
competitors:write |
Add competitors | member |
orgs:write |
Create organizations (account-wide keys only) | any |
The dashboard preselects the five read scopes. wam auth login requests the same five plus scans:write, so the CLI can run scans; --scopes workspaces:read,scans:read narrows it, --scopes with a write scope widens it, and the approval page can narrow the final set further. orgs:write is only offered on account-wide keys. The endpoint reference names the scope each route needs; the tool reference does the same for each tool.
Creating a key
In the dashboard
Open the organization, then Settings, API keys (/{orgSlug}/settings/api-keys). You need to be a member or above. The form asks for:
- Name, so you can tell keys apart later (
GitHub Actions,Laptop CLI). - Reach: this organization, or account-wide. Account-wide shows every organization the key will reach and asks you to confirm the list.
- Scopes, read-only preselected.
- Role ceiling: viewer, member or admin, never above your own role.
- Expiry: 30, 90 or 365 days, or never.
The key appears once. Copy it into your secret store before leaving the page.
From the CLI
wam auth login creates a key through an approval page in your browser and stores it in your operating system's credential store, so the key never passes through a clipboard or a shell history. Three flows:
- Browser, the default. The CLI starts a listener on
127.0.0.1on a random port, openshttps://whereamimentioned.com/cli/authorizeand waits up to five minutes. You pick the organization, review scopes and expiry, approve, and the browser hands a one-time code back to the listener, which the CLI exchanges for the key (a PKCE exchange, so an intercepted code is useless).--no-browserprints the URL instead of opening it. - Device code,
--device. For SSH sessions, containers, WSL and Codespaces, where the browser cannot reach back. The CLI prints a URL (/cli/device) and a code likeBQDX-7F2M, valid for ten minutes, and polls every five seconds until you approve on any device. - Existing key,
--token. Reads a key you created in the dashboard from stdin or a prompt and stores it. Use this when a key was created for you.
Options on all three: --account-wide (asks first, and spells out what it reaches), --name (default: your hostname followed by CLI), --scopes, and --expires 30|90|365|never (default 90; the approval page can lower it but not raise it).
wam auth logout revokes the key on the server, then clears it locally. --all also revokes every other key you created through the CLI.
Sending a key
REST API
GET /api/v1/workspaces HTTP/1.1
Host: whereamimentioned.com
Authorization: Bearer wam_live_...
X-Wam-Org: acme
X-Wam-Org is required with an account-wide key, optional with an organization key (where it must match), and ignored on the three routes that resolve no organization: listing organizations, creating one, and revoking the calling key.
CLI
In order of precedence: the --token flag, the WAM_TOKEN environment variable, then the credential store or file for the active profile. Prefer WAM_TOKEN over --token: arguments leak into shell history and process listings. CI sets WAM_TOKEN and never runs wam auth login.
MCP
An Authorization: Bearer header on the endpoint URL, or WAM_TOKEN in the environment of the stdio bridge. Without a key the server still works and lists the seven site tools; the account tools appear once a valid key is present. A request with no Authorization header is never counted as a failed sign-in attempt; a request with an invalid key is.
Expiry, rotation and revocation
- Expiry is set at creation. An expired key answers 401
unauthorizedlike a wrong one;wam auth statusshows when a key expires, andGET /api/v1/mereturnskey.expiresAt. - Rotation (dashboard) mints a new key with the same name, kind, scopes and ceiling, and keeps the old one working for 24 hours, so a deployment can switch without a gap. A key cannot be rotated by someone whose role is at or below its ceiling, and a key already being rotated cannot be rotated again: use the new key it produced.
- Revocation is immediate and permanent. From the dashboard, from
wam auth logout, or fromDELETE /api/v1/keys/self, which revokes exactly the key that made the request and is the one route that works on an organization without a paid plan. Revoked keys stay listed in the dashboard for 30 days so they can be matched to audit entries. - Last used is recorded per key, so a key that nothing has used for months is easy to spot and retire.
When authentication fails
Every failure is the standard error envelope with a code, a message, a requestId and, where useful, details. The errors page has the full list; these are the ones that concern keys.
| Status and code | Meaning | What to do |
|---|---|---|
401 unauthorized |
No Authorization header, a malformed key, a revoked or expired key, or a wam_test_ key on production. The response carries a WWW-Authenticate header. |
Check the key is complete and current. Create a new one if it was revoked. |
403 insufficient_scope |
The key lacks the scope this route needs, is the wrong kind (an organization key on an organization-level route), or the request used a session cookie. | Create a key with the scope, or an account-wide key for organization-level routes. |
403 insufficient_role |
The action needs a higher role than the key's effective role. The message names both. | Ask an owner or admin for the role, then re-create the key if its ceiling was the cap. |
403 feature_not_available |
The organization has no active paid plan. details.billingUrl points at billing. |
Subscribe. The key itself is fine. |
404 not_found |
The organization named in X-Wam-Org or the URL is not one this key reaches, or the resource does not exist. The two cases are deliberately indistinguishable. |
Check the slug against GET /api/v1/organizations (account-wide key) or GET /api/v1/me (organization key). |
422 validation_failed |
An account-wide key named no organization. details.hint says how to list them. |
Add X-Wam-Org, --org, or pin the MCP URL. |
429 rate_limited |
Too many failed authentication attempts from your IP address: 30 per minute. | Fix the key before retrying. The Retry-After header says when. |
The CLI maps all of these to exit code 3, except the 422 (exit 2) and the 429 (exit 5), and prints the server's message plus the command that fixes it.
Practices worth following
- One key per purpose. A key for CI, a key for your laptop, a key for the dashboard integration. Revoking one then costs nothing.
- Organization keys for anything shared. Only a person's own shell should hold an account-wide key.
- Read-only unless the job writes. A reporting integration needs
reports:readandscans:read, notscans:write. A key that cannot start a scan cannot spend credits. - Short expiry where you can. 90 days by default; rotate from the dashboard before it lapses.
- Environment variables, never arguments or files in the repository.
WAM_TOKENin CI secrets;wam.jsonhas no field for a token and refuses one. - Watch
last used. Retire keys nothing uses.