Shell completion scripts for the Postman CLI (postman) on zsh, bash, and fish.
Completes:
- All top-level commands (
login,collection,spec,monitor,workspace,flows, etc.) and their subcommands. - Flags for each (sub)command.
- Local file arguments such as
*.json(collections, manifests) and*.yaml/*.yml(specs, simulate scenarios).
Dynamic completion of remote IDs (collection / workspace / monitor IDs) is not supported — paste those yourself.
npm install -g postman-cli-completionThis installs a postman-completion helper command — it does not shadow the real
postman CLI (install that separately via npm i -g postman-cli). The helper prints the
completion script for your shell to stdout; wire it in as follows.
zsh — quick test in the current shell (requires compinit already initialised, see
the note below):
source <(postman-completion zsh)zsh — persistent. Add the packaged completions dir to fpath in ~/.zshrc:
fpath=("$(postman-completion path zsh --dir)" $fpath)
autoload -Uz compinit && compinitbash — add to ~/.bashrc (requires bash 4+; see the bash note below):
source <(postman-completion bash)fish — source it in the current session, or install it persistently:
postman-completion fish | source
# persistent:
ln -sf "$(postman-completion path fish)" ~/.config/fish/completions/postman.fishClone this repo somewhere, e.g. ~/.postman-cli-completion:
git clone https://github.com/yokawasa/postman-cli-completion.git ~/.postman-cli-completionAdd the completions directory to fpath and rerun compinit. Put this in ~/.zshrc:
fpath=(~/.postman-cli-completion/completions/zsh $fpath)
autoload -Uz compinit && compinitOr, for a quick test in the current shell:
source ~/.postman-cli-completion/completions/zsh/_postmanNote:
compinitmust already be initialised in your shell forsourceto register the completion. Most zsh setups (oh-my-zsh, prezto, or a plain.zshrcthat runsautoload -Uz compinit && compinit) do this automatically. Ifpostman <TAB>still does nothing after sourcing, runautoload -Uz compinit && compinitfirst and try again.
Add to ~/.bashrc (or ~/.bash_profile on macOS):
source ~/.postman-cli-completion/completions/bash/postman.bashRequires bash 4+ (shopt -s extglob). On macOS the system bash is 3.2 — install a newer bash via Homebrew (brew install bash) if needed.
Copy or symlink into fish's completion directory:
ln -s ~/.postman-cli-completion/completions/fish/postman.fish \
~/.config/fish/completions/postman.fishOr source it in the current session:
source ~/.postman-cli-completion/completions/fish/postman.fishAfter installing for your shell, open a fresh terminal and check each:
| Input | Expected |
|---|---|
postman <TAB> |
All top-level commands appear |
postman col<TAB> |
Completes to collection |
postman collection <TAB> |
migrate, lint, run |
postman collection run <TAB> |
*.json files in the current directory |
postman collection run --<TAB> |
Flag list (--environment, --iteration-data, --reporters, …) |
postman collection run -r <TAB> |
cli, json, junit, html |
postman request <TAB> |
GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS |
postman spec lint <TAB> |
*.yaml / *.yml / *.json files |
postman flows <TAB> |
list, trigger, deploy, run, update, list-runs, get-run |
postman --<TAB> |
--silent, --color, --version, --help |
The completions are generated for a specific Postman CLI version, so a CLI that has
drifted from that version may complete commands it does not have (or miss ones it does).
doctor reports both kinds of drift:
postman-completion doctorIt performs two independent checks:
- Installed CLI vs. the latest published
postman-cli— if yours is older, it warns and tells you how to upgrade. - Installed CLI vs. the version these completions were generated for — if they differ, it warns and tells you how to update the completions.
$ postman-completion doctor
Your Postman CLI is outdated: installed 1.60.0, latest 1.73.0.
Upgrade with: npm install -g postman-cli@latest
These completions were generated for Postman CLI 1.73.0, but 1.60.0 is installed.
Completions may offer commands your CLI does not have.
Update them with: npm install -g postman-cli-completion@latestCheck 1 queries the npm registry. To skip it — offline, or in a hook where you do not want
a network call — use --offline, which still runs check 2:
postman-completion doctor --offlinedoctor exits 1 when you should act (outdated CLI, or completions that no longer match
it) and 0 when everything is current, so it works as a shell-startup or CI check. A
missing Postman CLI is reported as a notice and exits 0. A failed registry lookup never
fails the command — it degrades to the offline check and explains itself on stderr.
You do not have to remember to run doctor. Installing or updating this package prints a
notice if your Postman CLI does not match the version the completions were built for:
$ npm install -g postman-cli-completion
postman-cli-completion:
These completions were generated for Postman CLI 1.73.0, but 1.60.0 is installed.
Completions may offer commands your CLI does not have.
Update them with: npm install -g postman-cli-completion@latest
Silence this check with POSTMAN_COMPLETION_NO_VERSION_CHECK=1This check is deliberately conservative:
- Never fails the install — it exits 0 on every path, including unexpected errors.
- Never touches the network — the comparison is local, so installs stay fast and
offline-safe. The "is my CLI older than the latest release?" question needs the
registry, so it belongs to
doctor. - Silent unless it matters — nothing is printed when the versions match, when the
Postman CLI is not installed, in CI, for non-global installs, or when stderr is not a
terminal. Set
POSTMAN_COMPLETION_NO_VERSION_CHECK=1to disable it entirely.
Because it runs at install time, it catches drift when you install or update this package.
If you upgrade the Postman CLI itself some time later, run postman-completion doctor to
check on demand.
The completion scripts are auto-generated from a single source of truth (spec/commands.json) and tracked against the upstream Postman CLI by two GitHub Actions workflows:
catchup.ymlruns daily, queries npm for the latestpostman-cliversion, introspects its--helpsurface, regenerates the spec and the three completion scripts, and opens an auto-merging PR whenever something changed.release.ymlfires whenspec/commands.jsonlands onmainand publishes a matching GitHub Release (e.g. tagv1.39.0mirrors Postman CLI 1.39.0).
So this repo follows the latest published Postman CLI version automatically — pull the latest main (or grab the matching tag) and the completions will match whatever Postman CLI version you have installed.
Suspicious catchup diffs (≥30 % flag drop, a known fixed command missing, semver regression) are blocked by scripts/validate-diff.mjs and stay open for human review instead of auto-merging.
To compare the version the completions were built for against your installed CLI, use
postman-completion doctor. The underlying values are:
node -p "require('./spec/commands.json').postmanCliVersion" # what the completions target
postman --version # what you have installedMIT — see the LICENSE file.
