Manage your API keys¶
See every key that can act as you, and kill any of them in one click.
Your personal Bearer credentials (hdr_user_*) are managed from the portal's
API keys page — or from the CLI, if you would rather not leave the
terminal. Both operate on the same keys: ones you mint yourself for scripts
and tools, plus tokens issued by MCP clients (Claude Desktop, VS Code) that
walked through Hadron's OAuth flow.
Either way you can:
- Mint a new key for an arbitrary use case (a CLI script, a one-off curl command, a personal automation).
- See your keys, active and revoked, with last-used timestamps and a source badge that tells you which OAuth client issued each token. Revoked keys you no longer want to look at can be hidden from the list.
- Revoke a key the moment you suspect it's leaked or no longer needed — the next request bearing that key gets a 401 immediately.
Minting a key asks for no extra factor. If you sign in to the portal by email link, the sign-in itself ends with a passkey; see Sign in with email and a passkey.
In the portal¶
In the sidebar, open User Account → Account, then the API Keys tab —
or go straight to
/app/account/api-keys.
Mint, review and revoke all happen there. Nothing to install.
From the CLI (no portal)¶
With the hadron CLI installed and signed in
(hadron auth login), manage tokens headless:
hadron auth token create --label ci-deploy # mint; prints the raw key ONCE
hadron auth token ls # list your keys (masked preview)
hadron auth token revoke <id> --yes # revoke one
The raw key is shown only once on create (the server keeps only its hash);
revoke needs --yes when non-interactive. This is the same mint / list /
revoke the portal page offers — hadron auth token create even records the same
issuedVia: portal provenance, because it calls the same server mutation the
portal's Save button does.
When to mint your own key vs. let OAuth do it¶
| Scenario | Recommended path |
|---|---|
| You're connecting Claude Desktop, VS Code, or another MCP client that supports OAuth | Let OAuth do it — see Install in Claude Desktop / Install in VS Code. The token is minted on your behalf at the end of the consent flow. |
You're writing a script, automation, or one-off curl that calls /mcp directly |
Mint one here. |
| You're connecting an MCP host that doesn't support OAuth yet | Mint one here + paste it into the host's bearer-token config field. |
| You're building an App backend that serves multiple users | Use an AppKey instead — see Connecting an MCP host. App keys live on the App's settings page, not here. |
The page shows BOTH portal-minted and OAuth-issued keys; the source badge distinguishes them so you always know which client (or you) is responsible for any given row.
Minting a key¶
- Open the API keys page.
- In the Create a new API key section, optionally fill in a Name — a short label only you see, useful for remembering which device or script the key is for (e.g. "MacBook — local-dev script", "Production deploy job").
- Click Save.
- The page shows a one-shot reveal banner at the top with the
raw key value (
hdr_user_<64 hex chars>).
⚠️ Copy the key NOW. This is the only time you'll see the full value. The Hadron server stores only a SHA-256 hash; if you lose the key, you can't recover it — you have to revoke and mint a new one.
- Click I have copied this key to dismiss the banner.
The key is immediately usable as a Bearer token against /mcp:
Reading the list¶
Each row in the key list shows:
| Column | What it means |
|---|---|
| Name | What you typed when creating the key; or for OAuth-issued tokens, OAuth: <client name> set by the server. |
| Key | The last 4 characters of the raw key, for matching against your password manager. |
| Status | Active (green) or Revoked (gray). A revoked key you hid reads Revoked · Hidden. |
| Source | Portal if you minted it here. OAuth: dcr_<client_id> if an MCP client OAuth flow minted it; the dcr_… suffix identifies which OAuth client. Unknown for any legacy/imported row that lacks a source attribution. |
| Created | When the key was minted. |
| Last used | When /mcp most recently accepted a request bearing this key. Useful for spotting keys you forgot existed — revoke anything you haven't used in a while. |
| Action | Revoke on an active key. Hide or Unhide on a revoked key. |
Revoked rows keep normal contrast, so they stay easy to read. By default the list shows every key you have not hidden. Revoked keys you have not hidden stay in the list as a record of what was previously issued — particularly useful when investigating "who/what was accessing my data last week?"
Hiding a revoked key¶
Once a key is revoked you can tidy it out of the default list. Hiding only changes what you see. It does not delete the key, revoke anything or change how long Hadron keeps the record.
- Find the revoked key's row. Active keys have no Hide: revoke the key first (see below).
- Open the row's Actions menu and choose Hide. The key leaves the default list and the page confirms that it was hidden from the default list.
To see hidden keys again, turn on Show hidden keys above the list. Hidden rows then appear with Revoked · Hidden in the Status column and Unhide in the Actions menu instead of Hide. Choose Unhide to put the key back in the default list.
Show hidden keys is there even when the list looks empty. If you have hidden every key, the page says there are no keys to show and points you to this switch.
Revoking a key¶
- Find the row for the key you want to revoke.
- Click Revoke.
- A confirmation dialog opens — it shows the key's last-4 preview so you can double-check.
- Click Yes, revoke this key.
The row's badge flips to Revoked, the row keeps its normal contrast, and
the next request bearing that key returns 401 Unauthorized from /mcp. The
row now offers Hide if you want it out of the default list (see
Hiding a revoked key).
Revocation is immediate — there's no grace period or propagation
delay; the key stops working between one request and the next.
When to revoke¶
- The key is in a file you accidentally committed to a public repo.
- A laptop with the key on it was lost or stolen.
- You're rotating credentials as a routine hygiene step.
- You no longer need access from a particular device or script.
- (For OAuth-issued tokens) you want to disconnect a specific MCP client.
Cross-user revoke attempts¶
For security, if you ever guess at someone else's key ID and try to revoke it, the API returns "not found" — exactly the same response as revoking a key that doesn't exist. This prevents key-ID enumeration. (The page never exposes anyone else's key IDs to begin with; this is defense-in-depth.)
What you don't have to manage¶
A few things are handled for you and don't need explicit action:
- Hashing. Hadron never stores raw keys; only SHA-256 hashes. If the database leaked tomorrow, an attacker couldn't authenticate with the leaked content.
- Expiry. Keys don't expire by themselves. Revoke explicitly when you no longer need them.
- In-key permissions. Permissions live on the User row, not on the key. Every key issued to your account has the same access; an org-admin promotion takes effect on every existing key immediately.
- Refresh tokens. None are issued. The token is long-lived; you rotate by minting + revoking, not by refreshing.
See also¶
- Install in Claude Desktop — sets up an OAuth-issued token instead of a portal-minted one.
- Install in VS Code — same OAuth path for VS Code.
- Surfaces: MCP, CLI, and the portal — the three ways to reach a Hadron server and how each one authenticates.