Rotating Your Agent’s API Key
When you rotate a provider API key (Anthropic, OpenAI, or Gemini), Mnemom would normally treat the new key as a brand-new, unregistered agent — losing your traces, alignment card, integrity score, and trust edges. Rekeying re-binds your existing agent to the new key in seconds, with no history lost.How it works
Your agent is identified by the first 16 characters of the SHA-256 hash of your provider API key. Mnemom never stores or transmits your raw key — only this short hash. Rekeying atomically swaps the stored hash to match your new key, keeping the agent ID and all associated data intact. The operation is:- Atomic — conflict detection and hash swap happen in a single database transaction
- Privacy-preserving — your raw API key is hashed client-side before any network call
- Non-destructive — agent ID, traces, alignment card, integrity score, and trust edges are unchanged
Prerequisites
- Your agent must be claimed and linked to your Mnemom account
- You must have your new provider API key ready before starting
Option 1: CLI
You will be prompted for your new provider API key. The key is hashed locally using SHA-256 — the raw value never leaves your machine.
export ANTHROPIC_API_KEY=sk-ant-api03-... # your new key
# or OPENAI_API_KEY / GOOGLE_API_KEY for other providers
Option 2: Dashboard
Type your new provider API key into the input and confirm it. The key is hashed in your browser before being sent — it is never transmitted in raw form.
Option 3: API
Compute the SHA-256 hash of your new key client-side, then POST it:x-smoltbot-agent header — the name is included in the hash):
my-coder with the exact name used when the agent was registered. Check your agent details in the dashboard or via GET /v1/agents/{agent_id} to confirm the name.
Success response:
Reading your key prefix
After your first gateway request following this update, your agent displays the first 16 characters of its bound provider key — enough to identify the provider and key type without exposing sensitive material.| Provider | Example prefix |
|---|---|
| Anthropic | sk-ant-api03-xx… |
| OpenAI | sk-proj-xxxxxxx… |
| Gemini | AIzaSyBxxxxxxxx… |
Verifying your key binding
Not sure which key is bound to your agent? Use verify binding to confirm without rekeying.CLI
Dashboard
In the agent Security tab, click Verify my key below the current key prefix display. Enter your key — the result appears inline.API
Multiple named agents from the same key
If you registered multiple named agents from the same provider key, each holds a distinct hash:- Agent A:
SHA256(key|nameA).slice(0, 16) - Agent B:
SHA256(key|nameB).slice(0, 16)
Resolving key conflicts
If you used your new key to make a request before rekeying, the gateway auto-created a shadow agent for it. The rekey endpoint returns409 Conflict with the shadow agent’s ID.
To resolve:
- Note the
conflict_agent_idfrom the error (409response body or CLI output) - In your dashboard, navigate to the shadow agent and Deactivate it (Settings tab → Deactivate)
- Only do this if the shadow agent is unclaimed and has no meaningful history
- Retry the rekey
If the shadow agent has traces you want to keep, contact support@mnemom.ai before deactivating it.
Security notes
- The raw API key is never transmitted to Mnemom. Only the 16-character SHA-256 prefix is sent.
- The rekey operation is rate-limited per account to prevent abuse.
- After rekeying, the old key no longer identifies this agent. Any infrastructure still using the old key will auto-create a new, unclaimed agent — rotate your environment variable promptly.
- The
rekeyed_attimestamp and arekey_countare stored on the agent for audit purposes.