Skip to content
aSecretSign in
Docs

CLI reference

View as Markdown

Look up commands to save or rotate a credential, run a process with named secrets, or check a request.

npm i -g @asecret/cli

It needs Node.js 24 or later, and installs two commands: asecret, and asecret-mcp for MCP.

Secrets

CommandWhat it does
save <name>Save a secret from standard input. secret does the same
list [name]List this agent's secrets by name, never their values; with a name, that secret's kept versions. secrets does the same
get <name>Print a secret's value, with a warning. --version <n> prints an earlier one
delete <name>Delete a secret and its earlier versions
run --secret <name> -- <cmd>Run a command with secrets in its environment. A detail your user shared sets each of its parts too

Your user

CommandWhat it does
linkLink this agent to your user, so they can see it and answer its asks. --name sets how it appears to them
unlinkEnd the link to your user
ask <detail>Ask your user to save a detail they keep, or ask setup to set up several
ask <detail> --useAsk your user to share a detail for a task. --for "why" says why, --as NAME names the secret it's kept as
asksList this agent's asks and where each stands
check <ask>Read one ask, or wait for the decision with --wait
cancel <ask>Cancel an ask that is still waiting
recipientsList the merchants your user's own aSecret server delivers to (--server only)

These work with asecret.sh. Payment methods and deliveries to merchants need your user's own aSecret server: point the commands at it with --server <origin>. Asking your user

Use a detail

asecret ask postal_address --use --for "fill in the checkout at shop.example"
asecret run --secret POSTAL_ADDRESS -- sh checkout.sh

Your user chooses which address to share, in their browser, and it arrives encrypted for this agent alone. It's kept as one of the agent's secrets, POSTAL_ADDRESS unless --as names it, and run sets the whole detail and each part: POSTAL_ADDRESS_STREET, POSTAL_ADDRESS_CITY, POSTAL_ADDRESS_REGION, POSTAL_ADDRESS_POSTAL_CODE and POSTAL_ADDRESS_COUNTRY. The address is in that command's environment alone, so a script like this checkout.sh fills in a form without it entering the chat:

curl https://shop.example/api/checkout \
  --data-urlencode "street=$POSTAL_ADDRESS_STREET" \
  --data-urlencode "city=$POSTAL_ADDRESS_CITY" \
  --data-urlencode "postcode=$POSTAL_ADDRESS_POSTAL_CODE" \
  --data-urlencode "country=$POSTAL_ADDRESS_COUNTRY"

If the agent isn't linked yet, --use links it first: your user approves it, and the ask opens on the same page. Use a detail

This agent

CommandWhat it does
connectConnect this agent to aSecret and create its key. --name sets how it appears to your user
meShow this agent, its secrets and whether a person is linked
keyShow this agent's key fingerprint, or export the key with --export
token --rotateReplace this agent's token, for example if it leaked
eraseDelete this agent at aSecret, with every secret, and forget it here
logoutForget the token and key on this machine
addInstall the aSecret skill in supported runtimes
removeRemove the aSecret skill from installed runtimes
mcpRun aSecret as a local MCP server, or print its settings with --print
instructionsPrint text your user can paste into any chat

Options for every command

OptionWhat it does
--jsonPrint the API's JSON, for scripts and agents
-y, --yesAnswer yes to every prompt
--api <url>Use another aSecret API (https://api.asecret.sh unless you say otherwise)
-h, --helpShow help
-v, --versionShow the version

Environment

VariableWhat it does
ASECRET_TOKENUse an existing token
ASECRET_CONFIG_DIRKeep a separate agent on the same machine
ASECRET_API_URLUse another aSecret API than api.asecret.sh

The token and key live in ~/.config/asecret/credentials.json, readable only by you. asecret logout forgets them on this machine, and doesn't delete anything at aSecret. asecret erase deletes the agent at aSecret too.

If the token leaks, run asecret token --rotate. The new token is saved here and the old one stops working; the key stays the same, so every secret stays readable. Export the key again afterwards, since earlier exports hold the old token.

Exit codes

0 means it worked, 1 means the request failed, and 2 means the command itself was wrong, such as an unknown command or a missing argument. With run, the exit code is the command's own.