A secrets vault for your AI agents
Your vault keeps secrets (API keys, access tokens) for the AI agents you allow, so nobody pastes a secret into a chat. It's yours, the same on every project: Settings → AI permissions → Vault (/ai/vault).
Using it
- The tab opens with Add on top and then one row per secret: its name, its note and the agents allowed to use it, as chips. Tap a row and its details open underneath it, in place — one at a time.
- Add a secret: a name (
github-pat), the value and a note. After you save it, the value is never shown again, to anyone: the row shows only its last four characters. - A value can be several lines, or a small JSON. A service that needs an endpoint, a region, a bucket and a key pair at once is one secret, not five; your agent reads the text back exactly as you pasted it and makes sense of it itself. The last four shown are of the whole text, so that is what you paste again when you allow another token.
- + allow a token: pick one of your AI tokens from the list (grouped by project) and give the value again. d2 checks it's the saved value (by its last four) and seals a copy for that token only. A token that has never been used shows Waiting for this agent to connect once: its lock key is made the first time it's used, so pick it after that.
- Your agent reads it with its own token:
GET /api/v2/vault/<name>(or the MCP toolvault_get). Any other token getsE_SECRET. - ✕ on an allowed chip takes it back at once. Revoking a token takes back all its secrets.
- Replace value: the tokens allowed now get the new value; you don't need to allow them again.
- Last reads lists every read and refusal (90 days); Notify me on each read sends you a notice per read. A refusal always sends one.
- Used by rules in names the projects whose rules may use a secret with
secret("name")(none by default): your published rules there, fired by their events and crons, and your own runs. The value is masked wherever a run shows it, and each use is a read listed here (rules in ). d2 opens only a secret for this, never a key. Only you set it. - Limits: 50 secrets, 8 KB each, 30 reads a minute per token.
How it's kept safe
Nothing d2 stores can open a secret. Each AI token has a key pair whose private half is worked out from the token itself and never stored; d2 keeps only the public half. A secret is stored only as copies sealed to the public keys of the tokens you allowed, so the database, its backups and the server's settings can't open it. When your agent asks with its token, d2 works out that token's private key, opens its copy in memory, answers and forgets it. Secrets never appear in topics, history, drafts, search, exports, archives, logs, flows or your rules.
FAQ
- I lost the value. Can I see it? No: nobody can, that's the point. Replace it with a new one.
- Why give the value again to allow a token? d2 has no copy it could open to seal for the new token.
- Can my project's rules use a secret? No. A rule that can read a secret could send it anywhere.
Who can use a secret
- Each secret's row shows who can use it: the role tokens allowed (orange) and the agents carrying it now (green). An agent started before you allowed the secret shows minted before (amber) and can't read it yet.
- Re-mint gives it the secret: on one agent, on all of a role token's agents (Re-mint agents on AI tokens), or Re-mint all right after you allow. The agent keeps its name and goes on working; its next read works.
When your AI sets up the vault for you
- **Ask it in your chat:** *"make a cdn-key slot and allow it to the coders"*, *"make a role token for ops"*. Your clear words let your agent do exactly that, and nothing more. If it needs something you didn't say, d2 shows its own **Authorize override** box in the chat: **Allow once** lets that one call through, **No** stops it. not from d2
- What it can do this way: make a secret or a key slot, allow or deny it to role tokens, make a role token (its value goes straight into your vault as
d2-<role>, never to the agent) and re-mint agents so they pick up a secret. - Rename and copy: your agent can rename a secret (its allows and uses follow) and copy one to a new name, on your word. d2 makes the copy itself, so the value goes through no one. The copy starts with no agents allowed and Notify me on, and the original's read history shows it.
- Where it's used and who read it: your agent can see these too, on your word: names and times, never a value.
- The demigod (the Architect only): its agent does the list, slots, generated values, letting a role token use a secret, rename, copy, deny, suspend and Re-mint without asking, and tells you of each change. It asks your Allow once only for a Deployment action (a run on a box, a definition line, ➕ Create, + Box, destroy). It never sees a value, never changes what reads a secret or whether you're told, and never deletes one. Every call it makes is on Security → Demigod with the intent you minted it on.
- Values stay yours. No word of yours and no Allow once lets an agent set, read back or reveal a secret's value.
- Random values: for a secret that is just a random key (a signing secret, an internal token), your agent asks d2 to generate it: 32 random bytes, sealed for the tokens allowed, never shown to anyone. Its row says generated; you can replace it any time.
- Values from outside d2 (a GitHub token, a provider's key, an app password) come only from you: the slot waits at the top of your Vault as waiting for your value. Paste it there and you're done.
- Everything it does this way is in the history and the audit like any other call, with the words or the Allow once that let it.