Skip to content

Command Reference

Complete reference for the vault command-line tool. All commands accept the global options.

These commands are available in every Vault.

CommandDescription
vault loginLog in to a Vault and make it the active Vault
vault logoutLog out a stored user and end their Vault session
vault listList the Vaults reachable by the current user
vault switchSwitch which Vault the current session is targeting
vault statusPrint the current user and Vault connection status
vault userList and switch stored user identities
vault configPull, push, and package Vault configuration
vault mdlExecute an MDL statement
vault queryExecute a VQL query
vault apiCall any Vault API endpoint and print the response
vault versionPrint the installed CLI version and platform
vault upgradeUpgrade the CLI to the latest version
vault uninstallRemove the CLI and its local files and settings

The CLI uses specific exit codes so scripts and CI pipelines can branch on failure type.

CodeMeaning
0Success
1General or unhandled error. vault status and vault switch exit 1 when no user is current
2Invalid usage: bad arguments or options
3Auth failure: session expired or invalid credentials
4No Vault configured or Vault unreachable. vault api, vault query, vault mdl, and vault config commands exit 4 when not logged in
5API or validation error returned by Vault, for example invalid MDL or a VQL syntax error
6Job failure: vault config package deploy job failed or timed out

vault config commands exit with code 1 when any individual asset fails to pull, push, or deploy. A vault config pull --dry-run that reports errored assets also exits with code 1, even though no changes are applied. A clean pull dry run exits 0. A vault config push --dry-run always exits 0. Push failures surface only when a real push is run.