Skip to content

Vault & Secret URIs

Recon lets you keep secrets out of plain-text environment files. You can store them in an encrypted vault that you commit to Git, or point to them in your shell, a file, 1Password or the OS keychain. An environment variable holds a reference such as age://STRIPE_KEY. Recon resolves the reference in memory just before a request is built, and the Outbound Secret Firewall checks where the value is going.

Create the vault and your personal key:

Terminal window
recon --format human vault init
OK Initialized Age team vault `.recon.secrets.age` (recipients=1, entries=0)
Local recipient: age14qlr8tyngsdy3zxp4uvcevr0vmxfmpm0jhc5fqxs3ct6x0967eyqedzhc4
Local private key (gitignored): .recon/vault.key

Store a secret and say which host may receive it:

Terminal window
recon --format human vault set LOCAL_TOKEN rk_local_vault_123 --host 127.0.0.1
OK Encrypted `age://LOCAL_TOKEN` [7c47e8e64d43] (hosts=["127.0.0.1"])

Reference it from an environment file such as environments/local.toml:

LOCAL_VAULT = "age://LOCAL_TOKEN"

Use the variable in a request:

### a
# @name use-local-vault
GET http://127.0.0.1:4310/echo
Authorization: Bearer {{LOCAL_VAULT}}
Terminal window
recon --format human send use-local-vault
GET http://127.0.0.1:4310/echo 200 0.8ms 217B -> 217B (HTTP/1.1)
...
"authorization": "Bearer rk_local_vault_123"
...
Path Purpose Commit it?
.recon.secrets.age Encrypted vault, in the workspace root. Yes. It is meant to be shared through Git.
.recon/vault.key Your private age identity. Written with mode 0600 on Unix. No. recon init adds it to .gitignore.

The vault is an ASCII-armored age file:

-----BEGIN AGE ENCRYPTED FILE-----
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSAwOHpxWFJUK3ZZRzk3eklt
dElGZyt0Y1U5STBhRjc5WWYwUnNjdzM0eFNRCnhCRE1DZFloVmtjN2oyQW9JMXhS
...

Inside the encryption is a JSON document with version (1), recipients (the list of age1... public keys) and entries. Each entry, keyed by its name, has value, allowed_hosts, allow_query_param, description and updated_at_utc. Every change decrypts the whole file and encrypts it again for every recipient.

The key file that vault init writes looks like this:

# Created by Recon Age Vault — DO NOT COMMIT THIS FILE
# public key: age14qlr8tyngsdy3zxp4uvcevr0vmxfmpm0jhc5fqxs3ct6x0967eyqedzhc4
AGE-SECRET-KEY-1...

Recon uses the first identity it finds, in this order:

  1. RECON_AGE_KEY: the identity itself, as the value of the environment variable.
  2. RECON_AGE_KEY_FILE: the path to a file that contains the identity.
  3. .recon/vault.key in the workspace.

In each case, blank lines and lines starting with # are skipped, and the first remaining line must be an AGE-SECRET-KEY-1... X25519 identity. Only X25519 identities are supported.

RECON_AGE_KEY is the natural choice for CI: store the secret key in your CI secret store and expose it as that variable.

If no identity is found, vault operations fail with:

error E_CLI_RUNTIME: vault error: vault key not initialized; run `recon vault init` or set `RECON_AGE_KEY`

If your identity is not one of the recipients:

error E_CLI_RUNTIME: vault error: failed decrypting Age vault: No matching keys found

The teammate runs recon vault keygen and sends you the public key. You add it and commit the re-encrypted vault:

Terminal window
recon --format human vault keygen
Public recipient (share with team): age1frvqmvd3udkce204cw05296gaz64p272d3s9tcp65delms6w2e6qf25mfh
Private identity (save in `.recon/vault.key` or `RECON_AGE_KEY`): AGE-SECRET-KEY-1...
Terminal window
recon --format human vault add-recipient age1stt87ccn8xl0l4cyna82cxhdefvctezxfuzm73e736zks47hm5msz0wkq0
OK Authorized `age1stt87ccn8xl0l4cyna82cxhdefvctezxfuzm73e736zks47hm5msz0wkq0` (total recipients=2)

The teammate then sets RECON_AGE_KEY or saves the key in their own .recon/vault.key:

Terminal window
RECON_AGE_KEY=AGE-SECRET-KEY-1... recon --format human vault list
Vault: initialized=true, unlocked=true, recipients=2, entries=2
- age://STRIPE_KEY [0aaffa406f40] hosts=["api.stripe.com", "*.stripe.com"] query_ok=false
- age://LOCAL_TOKEN [7c47e8e64d43] hosts=["127.0.0.1"] query_ok=false

Only someone who can already decrypt the vault can add a recipient. There is no command to remove a recipient.

All vault commands work on the workspace given by --workspace (default: the current directory).

Creates .recon.secrets.age, encrypted to your public key and any --recipient keys.

Flag Meaning
--recipient <age1...> Extra public key. Repeatable.
  • If no identity is found, init generates one and writes .recon/vault.key. This happens even when the vault already exists. If RECON_AGE_KEY or RECON_AGE_KEY_FILE is set, no key file is written.
  • If the vault already exists, init does not change it and prints the current status. --recipient values are ignored in that case; use add-recipient.

Prints a new X25519 key pair. It writes no files. With --format json the output has public_key and secret_key.

recon vault set <KEY> <VALUE> [--host <HOST>]... [--allow-query-param] [--description <TEXT>]
Argument or flag Meaning
KEY Entry name, used as age://KEY. Leading and trailing spaces are trimmed; an empty name is rejected.
VALUE The secret value.
--host <HOST> Host that may receive this secret. Repeatable.
--allow-query-param Allow the secret in a URL query string.
--description <TEXT> Free-text note.

set replaces an existing entry of the same name. If there is no vault yet, set runs init first.

Prints vault status and entry metadata. Values are never shown.

Terminal window
recon --format json vault list
{
"entries": [
{
"allow_query_param": false,
"allowed_hosts": [
"api.stripe.com",
"*.stripe.com"
],
"description": "Stripe test key",
"key": "STRIPE_KEY",
"updated_at_utc": "2026-11-30T15:50:50.971511167+00:00",
"value_fingerprint": "0aaffa406f40"
},
{
"allow_query_param": false,
"allowed_hosts": [
"127.0.0.1"
],
"description": null,
"key": "LOCAL_TOKEN",
"updated_at_utc": "2026-11-30T15:53:34.022789181+00:00",
"value_fingerprint": "7c47e8e64d43"
}
],
"status": {
"entry_count": 2,
"initialized": true,
"local_recipient": "age14qlr8tyngsdy3zxp4uvcevr0vmxfmpm0jhc5fqxs3ct6x0967eyqedzhc4",
"providers": {
"age_unlocked": true,
"dotenv_present": true,
"keychain_tool_available": false,
"op_cli_available": false
},
"recipients": [
"age14qlr8tyngsdy3zxp4uvcevr0vmxfmpm0jhc5fqxs3ct6x0967eyqedzhc4",
"age1stt87ccn8xl0l4cyna82cxhdefvctezxfuzm73e736zks47hm5msz0wkq0"
],
"unlocked": true
}
}

value_fingerprint is the first 12 hex characters of the SHA-256 of the plain-text value. It lets you see that two entries hold the same value, or that a value changed, without showing it.

status field Meaning
initialized .recon.secrets.age exists.
unlocked Your identity decrypts it.
local_recipient Public key of your identity, or null.
recipients Public keys the vault is encrypted to. Empty when locked.
entry_count Number of entries. 0 when locked.
providers See Provider availability.

Before init, list prints Vault: initialized=false, unlocked=false, recipients=0, entries=0. When the vault exists but your identity cannot decrypt it, list fails with the decrypt error.

Terminal window
recon --format human vault delete LOCAL_TOKEN
Deleted `LOCAL_TOKEN`: true

Deleting a name that does not exist prints false and still exits 0.

recon vault add-recipient <age1...>

The key is checked before anything changes:

error E_CLI_RUNTIME: vault error: invalid Age recipient `age1notakey`: invalid Bech32 encoding

Adding a key that is already present does nothing.

A secret reference is an environment variable value that starts with one of these prefixes. Recon replaces it with the secret before the request is built.

Prefix Example Resolved from
age:// age://STRIPE_KEY Entry STRIPE_KEY in .recon.secrets.age.
env:// env://API_TOKEN Process environment, then .env / .env.local.
file:// file://secrets/token.txt File contents.
op:// op://Engineering/API/credential 1Password CLI.
keychain:// keychain://recon-docs/ci OS keychain, as service/account.

Any other value is used as written.

LOCAL_VAULT = "age://LOCAL_TOKEN"
STRIPE_VAULT = "age://STRIPE_KEY"
SHELL_TOKEN = "env://DOCS_DEMO_TOKEN"
FILE_TOKEN = "file://secrets/token.txt"

Looks up the entry in the vault. The vault is decrypted once per request, and only when at least one age:// reference is present. A missing entry fails the request:

error E_CLI_RUNTIME: secret provider `age` failed: vault entry `LOCAL_TOKEN` referenced by `LOCAL_VAULT` not found

Reads the named variable from the process environment. If it is not set there, Recon reads .env and then .env.local in the workspace root; a key in .env.local overrides the same key in .env. In those files, blank lines and # lines are skipped, an export prefix is removed, and one pair of matching single or double quotes around the value is removed. There is no variable expansion.

"x-shell": "from-dotenv",

With DOCS_DEMO_TOKEN=from-process set in the shell, the process value wins:

"x-shell": "from-process",

If neither source has the variable:

error E_CLI_RUNTIME: secret provider `env` failed: environment variable `DOCS_DEMO_TOKEN` is not set in process or .env

Reads the whole file as UTF-8 and removes trailing \r and \n characters. A relative path is relative to the workspace root; an absolute path is used as is.

"x-file": "file_secret_value"

Runs op read <the full op:// reference> and uses its standard output, with trailing newlines removed. The 1Password CLI op must be on PATH and signed in. Errors:

error E_CLI_RUNTIME: secret provider `op` failed: failed executing `op`: No such file or directory (os error 2)

A non-zero exit from op fails with secret provider `op` failed: `op` exited with <status>: <stderr>.

The part after keychain:// must be <service>/<account>.

Platform Command run
macOS security find-generic-password -s <service> -a <account> -w
Linux secret-tool lookup service <service> account <account>
Other Not supported. The request fails with a message suggesting age:// or env://.
error E_CLI_RUNTIME: secret provider `keychain` failed: expected `keychain://<service>/<account>` format
error E_CLI_RUNTIME: secret provider `keychain` failed: failed executing `secret-tool`: No such file or directory (os error 2)

Two older forms also read secrets. They are part of the template and environment syntax covered in Configuration and .http Request Files:

  • A table-form secret whose value starts with $ENV: reads that process environment variable (not .env).
  • The template {{$env.NAME}} reads a process environment variable directly. The value is tracked as a secret, scoped to the request’s # @taint-scope hosts.
Place Resolved?
Environment variable values used by send, twin, test, watch, graphql, sse, ws, grpc, the HTTP API send/twin routes and the MCP send/twin tools Yes
recon auth sign-preview --secret, --access-key-id, --session-token Yes
Text written directly in a .http file No; sent as written
recon auth oauth2-token --client-secret No; sent as written
Requests run by recon flow, recon load and recon paginate No

A resolved reference becomes a secret that the Outbound Secret Firewall tracks. The firewall decides from the secret’s allowed hosts where it may be sent.

How the variable is written Allowed hosts
NAME = "age://KEY" The vault entry’s allowed_hosts. allow_query_param comes from the entry.
NAME = "env://...", file://, op://, keychain:// None are attached. See the firewall page for how such secrets are treated.
Table form with value = "age://KEY" and a non-empty allowed_hosts The table’s allowed_hosts replace the vault entry’s. allow_query_param is on if either side allows it.
Table form with an empty allowed_hosts The vault entry’s hosts, for age://; none for other prefixes.

For the plain NAME = "..." form, the secret is labelled with the variable name in firewall messages. Sending the Stripe key from the example vault to a local server is blocked before any network call:

error E_FIREWALL_BLOCKED: Blocked secret `STRIPE_VAULT` bound for `api.stripe.com, *.stripe.com` from being sent to unauthorized host `127.0.0.1`.
hint: Switch environment or update secret allowed_hosts.

recon send exits with code 1 in that case.

A table-form secret can widen or narrow the vault’s host list for one environment:

[STRIPE_LOCAL_OVERRIDE]
value = "age://STRIPE_KEY"
secret = true
allowed_hosts = ["127.0.0.1"]
"x-key": "sk_test_51Hdemo"

recon auth status, recon vault list --format json and the vault status API report which providers look usable.

Field true when
age_unlocked An identity was found and parsed. It does not check that the identity can decrypt the vault; see unlocked.
dotenv_present .env or .env.local exists in the workspace root.
op_cli_available An op executable is on PATH.
keychain_tool_available security on PATH (macOS), secret-tool on PATH (Linux). Always true on Windows, although keychain:// lookups are not supported there.

No CLI command, HTTP route or MCP tool returns a value stored in the vault.

  • GET /api/v1/vault/status returns status and, when unlocked, the entries metadata shown above.
  • POST /api/v1/vault/init (body: extra_recipients), POST /api/v1/vault/set (body: key, value, allowed_hosts, allow_query_param, description), DELETE /api/v1/vault/{key} and POST /api/v1/vault/recipients (body: recipient) change the vault. They need the X-Recon-Token header. The set route accepts a plain-text value but returns only metadata.
  • The MCP tool recon_vault_list returns the same status and metadata as the status route. There is no MCP tool that writes to the vault. recon_auth_status returns provider availability.
  • In the Web Studio, the Vault button in the top bar opens the Age Vault tab. The command palette entry is Open Age Encrypted Secrets Vault.

See HTTP API and MCP Tools, Resources & Prompts.

All of these exit with code 2 in the CLI and print E_CLI_RUNTIME.

Message Cause
vault error: vault `.recon.secrets.age` not initialized; run `recon vault init` An age:// reference, delete or add-recipient without a vault.
vault error: vault key not initialized; run `recon vault init` or set `RECON_AGE_KEY` No identity found.
vault error: invalid Age identity key: ... The identity line is not a valid X25519 key.
vault error: failed decrypting Age vault: No matching keys found Your identity is not a recipient.
vault error: secret key cannot be empty vault set with an empty name.
vault error: invalid Age recipient `<key>`: ... Bad public key.
secret provider `<scheme>` failed: ... An age, env, file, op or keychain lookup failed.