postman-cli 1.83.0 → 1.85.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +154 -47
- package/man/postman.1 +189 -23
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -4,9 +4,11 @@
|
|
|
4
4
|
|
|
5
5
|
# Postman CLI
|
|
6
6
|
|
|
7
|
-
**API engineering for your agents.** Go faster from development to production.
|
|
7
|
+
**API engineering for your agents.** Go faster from development to production with higher accuracy and fewer tokens.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Requests, collections, specs, functional and performance tests, mocks, simulations and monitors for coding agents, terminals and CI pipelines.
|
|
10
|
+
|
|
11
|
+
[Docs](https://learning.postman.com/docs/postman-cli/postman-cli-overview/) · [Coding agent plugins](https://learning.postman.com/docs/reference/developer-resources/postman-plugin) · [Command reference](https://learning.postman.com/docs/postman-cli/postman-cli-options/) · [Release notes](https://www.postman.com/release-notes/postman-cli/)
|
|
10
12
|
|
|
11
13
|
## Install
|
|
12
14
|
|
|
@@ -21,7 +23,8 @@ Without Node.js:
|
|
|
21
23
|
curl -o- "https://dl-cli.pstmn.io/install/unix.sh" | sh
|
|
22
24
|
|
|
23
25
|
# Windows (PowerShell)
|
|
24
|
-
powershell -NoP -NonI -c
|
|
26
|
+
powershell -NoP -NonI -c `
|
|
27
|
+
"irm https://dl-cli.pstmn.io/install/win64.ps1 | iex"
|
|
25
28
|
```
|
|
26
29
|
|
|
27
30
|
The Postman desktop app includes the CLI. Update with `postman update`. See the [installation guide](https://learning.postman.com/docs/postman-cli/postman-cli-installation/) for other options.
|
|
@@ -29,25 +32,43 @@ The Postman desktop app includes the CLI. Update with `postman update`. See the
|
|
|
29
32
|
## Quick start
|
|
30
33
|
|
|
31
34
|
```bash
|
|
32
|
-
|
|
33
|
-
postman
|
|
34
|
-
|
|
35
|
+
# Set up the repo, install agent skills, link a workspace
|
|
36
|
+
postman init
|
|
37
|
+
|
|
38
|
+
# Send a request
|
|
39
|
+
postman request GET https://api.example.com/health
|
|
40
|
+
|
|
41
|
+
# Run a collection and its tests
|
|
42
|
+
postman collection run postman/collections/orders
|
|
35
43
|
```
|
|
36
44
|
|
|
45
|
+
## What `postman init` sets up
|
|
46
|
+
|
|
47
|
+
`postman init` turns a repo into a Postman project that agents and teammates can build on.
|
|
48
|
+
|
|
49
|
+
- **API work as files in git.** Collections, specs, environments, mocks and simulations live under `postman/`, next to your code ([Native Git](https://learning.postman.com/docs/use/native-git/overview/)). An existing OpenAPI or AsyncAPI spec is adopted as it is.
|
|
50
|
+
- **Agent skills in the repo.** Skills under `postman/skills/` and a pointer in `AGENTS.md` show coding agents how to build and test the API with the CLI.
|
|
51
|
+
- **A linked Postman workspace.** `.postman/resources.yaml` connects the repo to a workspace, so collections, monitors and mocks have a shared home from the first command.
|
|
52
|
+
- **Context that carries over.** Run results, pushes with their messages, and who or which agent did what are saved to the workspace. The next session, agent or teammate picks up from there with `postman workspace context`, and the same context keeps your API Catalog and Context Graph current.
|
|
53
|
+
- **The same setup in CI.** Builds reuse the workspace recorded in `.postman/resources.yaml`.
|
|
54
|
+
|
|
55
|
+
Run `postman init --dry-run` to see what it will do first. See [`postman init`](https://learning.postman.com/docs/postman-cli/postman-cli-init/).
|
|
56
|
+
|
|
37
57
|
## Agent skills
|
|
38
58
|
|
|
39
|
-
`postman init` installs Postman's agent skills in `postman/skills/` and adds a pointer to them in `AGENTS.md`.
|
|
59
|
+
`postman init` installs Postman's agent skills in `postman/skills/` and adds a pointer to them in `AGENTS.md`. `postman update` updates the CLI and the repo's skills. `postman status` shows the CLI version, skills, account and plugin state.
|
|
40
60
|
|
|
41
61
|
| Skill | What you get |
|
|
42
62
|
|---|---|
|
|
43
63
|
| `api-discovery` | Reuse the APIs your organization already has, and see what depends on one before you change it |
|
|
44
64
|
| `api-testing` | A repeatable test for every change, so regressions surface in review |
|
|
45
65
|
| `api-mocking` | Build against agreed behaviour before the real API or its dependencies exist |
|
|
66
|
+
| `api-simulation` | Test against a realistic environment, including the failures real services won't produce on demand |
|
|
46
67
|
| `api-monitoring` | The same tests that passed in development, running against production |
|
|
47
68
|
| `ci-integration` | Merges that fail on a broken test, contract or governance rule |
|
|
48
69
|
| `performance-testing` | Releases gated on latency and error-rate thresholds |
|
|
49
70
|
|
|
50
|
-
[See all skills](https://
|
|
71
|
+
[See all skills](https://learning.postman.com/docs/postman-plugin/skills/).
|
|
51
72
|
|
|
52
73
|
## Usage
|
|
53
74
|
|
|
@@ -55,33 +76,48 @@ The examples below cover common tasks. For the full reference, run `man postman`
|
|
|
55
76
|
|
|
56
77
|
### Requests
|
|
57
78
|
|
|
79
|
+
Send requests while you develop, with assertions on each response, secret variables kept out of the command line, and the request's context retained for later testing and verification.
|
|
80
|
+
|
|
58
81
|
```bash
|
|
59
|
-
postman request POST http://localhost:3000/auth/token
|
|
60
|
-
|
|
82
|
+
postman request POST http://localhost:3000/auth/token \
|
|
83
|
+
--body @creds.json --response-only
|
|
84
|
+
|
|
85
|
+
postman request PATCH http://localhost:3000/orders/42 \
|
|
86
|
+
--auth-bearer-token "$TOKEN" \
|
|
61
87
|
--body '{"status":"shipped"}' \
|
|
62
|
-
--script-post-request "pm.test('
|
|
88
|
+
--script-post-request "pm.test('ok', () => pm.response.to.be.ok)"
|
|
63
89
|
```
|
|
64
90
|
|
|
65
|
-
Exits `0` on a 2xx or 3xx response with all tests passing. Otherwise exits with the number of failed tests.
|
|
91
|
+
Exits `0` on a 2xx or 3xx response with all tests passing. Otherwise exits with the number of failed tests. See [`postman request`](https://learning.postman.com/docs/postman-cli/postman-cli-requests/).
|
|
66
92
|
|
|
67
93
|
### Collections and specs
|
|
68
94
|
|
|
95
|
+
Turn specs and ad hoc requests into collections, lint specs against your governance rules, and run collections as repeatable test suites locally or in CI with the [Collection Runner](https://www.postman.com/product/collection-runner/) and [Spec Hub](https://www.postman.com/product/spec-hub/).
|
|
96
|
+
|
|
69
97
|
```bash
|
|
70
98
|
postman spec lint ./openapi.yaml
|
|
71
|
-
postman spec generate collection ./openapi.yaml
|
|
99
|
+
postman spec generate collection ./openapi.yaml \
|
|
100
|
+
--name "Orders API"
|
|
72
101
|
postman collection import ./login.curl
|
|
73
|
-
postman collection run
|
|
102
|
+
postman collection run postman/collections/orders \
|
|
103
|
+
-e postman/environments/dev.environment.yaml
|
|
74
104
|
```
|
|
75
105
|
|
|
76
106
|
### Mocks
|
|
77
107
|
|
|
108
|
+
Reproduce how an API behaves, not just what it returns. A Code Mock keeps state across requests, validates incoming calls and runs named scenarios, so it becomes a dependency you control without running another service.
|
|
109
|
+
|
|
78
110
|
```bash
|
|
79
|
-
|
|
80
|
-
postman mock
|
|
81
|
-
|
|
111
|
+
# From an OpenAPI spec or collection; --mode ai adds realistic data
|
|
112
|
+
postman mock generate specs/payments.yaml --stateful
|
|
113
|
+
|
|
114
|
+
postman mock run postman/mocks/payments --port 4010
|
|
115
|
+
|
|
116
|
+
postman collection run postman/collections/checkout \
|
|
117
|
+
--use-mock "{{paymentsUrl}} mock:postman/mocks/payments"
|
|
82
118
|
```
|
|
83
119
|
|
|
84
|
-
A mock is a Node.js request handler in `postman/mocks/<name
|
|
120
|
+
A mock is a Node.js request handler in `postman/mocks/<name>/`, versioned and reviewed with your code. Use `pm.state` to keep state between requests:
|
|
85
121
|
|
|
86
122
|
```js
|
|
87
123
|
const http = require("http");
|
|
@@ -89,34 +125,91 @@ http.createServer(async (req, res) => {
|
|
|
89
125
|
const key = req.headers["idempotency-key"];
|
|
90
126
|
const seen = await pm.state.get(key);
|
|
91
127
|
if (seen) return res.end(JSON.stringify(seen));
|
|
92
|
-
if (req.headers["x-test"] === "429") {
|
|
128
|
+
if (req.headers["x-test"] === "429") {
|
|
129
|
+
res.writeHead(429); return res.end();
|
|
130
|
+
}
|
|
93
131
|
const charge = { id: "ch_" + Date.now(), status: "succeeded" };
|
|
94
132
|
await pm.state.set(key, charge);
|
|
95
133
|
res.writeHead(201); res.end(JSON.stringify(charge));
|
|
96
134
|
});
|
|
97
135
|
```
|
|
98
136
|
|
|
99
|
-
`--use-mock`
|
|
137
|
+
`--use-mock` points every request to `{{paymentsUrl}}` at the local mock for the length of the run. `pm.state` persists across requests and runs until `pm.state.clear()`. `postman mock run --output ndjson` streams one JSON event per request for CI.
|
|
138
|
+
|
|
139
|
+
Named scenarios in `config.yaml` add delays, failures, alternate responses and rate limits. Select one per request with the `x-mock-scenario` header. Add `pm.test` inside a mock to check that callers stay within the contract. Deploy a mock with `postman mock deploy` to share it as a mock server with a durable URL, isolated sessions and request logs (`postman mock log`). See [mocks](https://learning.postman.com/docs/design-apis/mock-apis/local-mock-servers/).
|
|
140
|
+
|
|
141
|
+
### Simulations
|
|
142
|
+
|
|
143
|
+
Bring up the whole dependency chain your service calls in seconds, from files in your repo. Mix simulated and real services, switch scenarios as you change code, and let agents develop against it faster than real time.
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
postman simulation create -n "Checkout" \
|
|
147
|
+
--mock postman/mocks/payments \
|
|
148
|
+
--mock postman/mocks/orders \
|
|
149
|
+
-o checkout.sim.yaml
|
|
150
|
+
|
|
151
|
+
# Every mock behind one local port
|
|
152
|
+
postman simulation run checkout.sim.yaml
|
|
153
|
+
|
|
154
|
+
# Reach mocks by hostname, with no code changes
|
|
155
|
+
postman simulation run checkout.sim.yaml --proxy \
|
|
156
|
+
--scenario timeout --lift "npm test"
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
A simulation is a `.sim.yaml` file that combines mocks and their routing. With `--proxy`, requests to each mock's `origin` hostname, such as `api.stripe.com`, reach the mock, and all other traffic goes to its real destination, so you only simulate what you choose. `--lift` starts your command with the proxy already configured. Multiple agents can run their own simulations at the same time without interfering with each other.
|
|
100
160
|
|
|
101
|
-
|
|
161
|
+
A context file beside each simulation records the assumptions your code relies on, what was observed and where it came from, including what has and hasn't been verified. The next run, agent or teammate starts from what is already established instead of rediscovering it. Simulations catch problems earlier; they don't replace a final check against the real services.
|
|
162
|
+
|
|
163
|
+
Add `--deploy` to `postman simulation create` to share the whole environment as one mock server with the same routing. See [Postman Simulator](https://learning.postman.com/docs/design-apis/simulate-conditions/overview/).
|
|
102
164
|
|
|
103
165
|
### Performance tests
|
|
104
166
|
|
|
167
|
+
Find out how the API and its business logic hold up under load before you ship, and fail the release when they don't meet your thresholds.
|
|
168
|
+
|
|
105
169
|
```bash
|
|
106
|
-
postman performance run
|
|
170
|
+
postman performance run postman/collections/checkout \
|
|
107
171
|
--peak-vu 200 --duration 5 --load-profile fixed \
|
|
108
|
-
--pass-if "less_than(p95, 300)"
|
|
172
|
+
--pass-if "less_than(p95, 300)" \
|
|
173
|
+
--pass-if "less_than(error_rate, 1)" \
|
|
174
|
+
--pass-if "less_than(failure_rate, 1)" \
|
|
109
175
|
--output ndjson
|
|
110
176
|
```
|
|
111
177
|
|
|
112
|
-
`--duration` is in minutes
|
|
178
|
+
`--duration` is in minutes, and `--load-profile` takes `fixed`, `ramp-up`, `spike` or `peak`. A failed `--pass-if` exits `1`, which fails the CI job. Thresholds can use `avg`, `p90`, `p95`, `p99`, `error_rate`, `failure_rate` and `rps`. Load runs from the local machine by default. Use `--runner postman-cloud` to generate load from Postman's cloud runners.
|
|
179
|
+
|
|
180
|
+
The `pm.test()` assertions in your collection run on every iteration under load. `failure_rate` is the percentage of request executions with a failing test, so an agent can tell whether the logic still holds at 200 users without working through traces and metrics. In Postman, the run's [Tests tab](https://learning.postman.com/docs/tests-and-scripts/performance-testing/test-assertions/overview/) shows each assertion against the number of virtual users, so you can see where it starts to fail. See [Performance Testing](https://www.postman.com/product/performance-testing/).
|
|
181
|
+
|
|
182
|
+
### Datasets
|
|
183
|
+
|
|
184
|
+
Bring test data from the files and databases you already use, query it with SQL, and reuse it on every run. Agents get the same data for repeated testing, and can add synthetic data as CSV or JSON sources when real data isn't available.
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
postman dataset create users.dataset.yaml --name "Users"
|
|
188
|
+
|
|
189
|
+
postman dataset source add -d users.dataset.yaml \
|
|
190
|
+
-n users --file users.csv
|
|
191
|
+
|
|
192
|
+
postman dataset query users.dataset.yaml \
|
|
193
|
+
-q "SELECT * FROM users LIMIT 5"
|
|
194
|
+
|
|
195
|
+
postman dataset view create -d users.dataset.yaml -n active \
|
|
196
|
+
-q "SELECT * FROM users WHERE active = 1"
|
|
197
|
+
|
|
198
|
+
postman collection run postman/collections/orders \
|
|
199
|
+
--iteration-data-dataset users.dataset.yaml \
|
|
200
|
+
--iteration-data-view active
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
Sources can be CSV, JSON and spreadsheet files, or MySQL, PostgreSQL, SQL Server and other JDBC databases, with credentials taken from Shared Vault. The same dataset feeds collection runs, performance tests, monitors and mocks. See [Datasets](https://learning.postman.com/docs/tests-and-scripts/datasets/overview/).
|
|
113
204
|
|
|
114
205
|
### Monitors
|
|
115
206
|
|
|
116
|
-
|
|
207
|
+
Keep running the tests that passed in development against production, on a schedule, and hear about failures first with [Monitors](https://www.postman.com/product/monitors/).
|
|
117
208
|
|
|
118
209
|
```bash
|
|
119
|
-
postman monitor create --collection <collection-id>
|
|
210
|
+
postman monitor create --collection <collection-id> \
|
|
211
|
+
--schedule "*/5 * * * *" \
|
|
212
|
+
--notify-email oncall@example.com
|
|
120
213
|
postman monitor run <monitor-id>
|
|
121
214
|
postman monitor jobs list <monitor-id> --result failure
|
|
122
215
|
```
|
|
@@ -125,48 +218,59 @@ Send alerts to email or any of Postman's [monitor integrations](https://www.post
|
|
|
125
218
|
|
|
126
219
|
### Secrets
|
|
127
220
|
|
|
221
|
+
Use API keys and tokens in requests and runs without putting them in your code, your shell history or your agent's context.
|
|
222
|
+
|
|
128
223
|
```bash
|
|
129
224
|
postman secret create PAYMENTS_API_KEY
|
|
130
|
-
postman environment var set api_key --secret-id <id>
|
|
225
|
+
postman environment var set api_key --secret-id <id> \
|
|
226
|
+
-e postman/environments/staging.environment.yaml
|
|
131
227
|
```
|
|
132
228
|
|
|
133
|
-
Secret values are entered in a one-time browser form and stored in your team's Shared Vault. The CLI never prints them, and coding agents never see them.
|
|
229
|
+
Secret values are entered in a one-time browser form and stored in your team's [Shared Vault](https://learning.postman.com/docs/use/postman-vault/postman-vault-key/#postman-shared-vault). The CLI never prints them, and coding agents never see them.
|
|
134
230
|
|
|
135
231
|
### Workspace context
|
|
136
232
|
|
|
233
|
+
Share what was built and tested with the next person or agent in a [Postman workspace](https://www.postman.com/product/workspaces/), so they start from the work already done.
|
|
234
|
+
|
|
137
235
|
```bash
|
|
138
|
-
postman workspace push --yes -m "Add refunds endpoint
|
|
139
|
-
|
|
140
|
-
|
|
236
|
+
postman workspace push --yes -m "Add refunds endpoint and tests"
|
|
237
|
+
|
|
238
|
+
# What the workspace holds and how it relates
|
|
239
|
+
postman workspace context
|
|
240
|
+
|
|
241
|
+
# Recent push messages, one line each
|
|
242
|
+
postman workspace activity --type workspacePush --limit 5 --brief
|
|
243
|
+
|
|
141
244
|
postman workspace pull
|
|
142
245
|
```
|
|
143
246
|
|
|
144
|
-
Use `-m` to record what changed. `workspace context` shows each
|
|
247
|
+
Use `-m` to record what changed. `workspace context` lists the workspace's collections, environments, monitors, mocks, specs and flows, and which monitors run which collections. `workspace activity` shows each change with its author, and changes made by agents appear as `Name (Agent)`, for example `Ada Lovelace (Claude Code)`. Monitor runs and runs of linked collections are recorded in the workspace. Collection runs from CI include the commit and pipeline.
|
|
145
248
|
|
|
146
249
|
### Context Graph
|
|
147
250
|
|
|
251
|
+
Find out what depends on an API, and what a change will break, before you make it.
|
|
252
|
+
|
|
148
253
|
```bash
|
|
149
|
-
postman context-graph ask
|
|
254
|
+
postman context-graph ask \
|
|
255
|
+
"What depends on the billing service's invoice response?" \
|
|
256
|
+
--wait --json
|
|
150
257
|
```
|
|
151
258
|
|
|
152
259
|
Context Graph maps your organization's APIs, deployments, database schemas, external services and teams into a single dependency graph, built from Git-connected Postman workspaces plus the sources you connect, such as GitHub repositories and New Relic. It answers how your services relate to each other and gives agents grounded, queryable context about your architecture.
|
|
153
260
|
|
|
154
261
|
Answers draw on the sources your team connects in Postman under **Home > Agent Context**. Use code search for anything outside them. `postman dependency add` pulls in collections and specs published by other teams. `postman describe` returns the details an agent needs to write code against an API. [Learn more](https://www.postman.com/context-graph/)
|
|
155
262
|
|
|
156
|
-
### Public APIs
|
|
263
|
+
### Public APIs using Orbit
|
|
264
|
+
|
|
265
|
+
Integrate third-party APIs with instructions drawn from their live schemas, from auth to known gotchas.
|
|
157
266
|
|
|
158
267
|
[Orbit](https://www.buildwithorbit.ai/) finds public API endpoints for a task and returns instructions to call them. The `api-discovery` skill uses it automatically.
|
|
159
268
|
|
|
160
269
|
```bash
|
|
161
|
-
claude mcp add --transport http orbit
|
|
270
|
+
claude mcp add --transport http orbit \
|
|
271
|
+
https://mcp.buildwithorbit.ai/mcp
|
|
162
272
|
```
|
|
163
273
|
|
|
164
|
-
## What install and `init` change on your machine
|
|
165
|
-
|
|
166
|
-
- **`npm install`:** if Claude Code's or Codex's configuration folder already exists, the install adds one line to its global instructions (`CLAUDE.md`, or Codex's `AGENTS.override.md` or `AGENTS.md`) between `<!-- postman-cli:installation:start -->` and `<!-- postman-cli:installation:end -->` markers: "Postman CLI is installed on this device, and can be used for API Engineering work." Delete those lines to remove it.
|
|
167
|
-
- **`postman init`:** writes local files (`postman/`, `AGENTS.md`, skills under `postman/skills/`). It fetches the latest skills over HTTPS and falls back to the copies bundled with the CLI; `--no-fetch` skips the attempt. It creates a cloud workspace only when you pass `--visibility`, or `--yes` (a session when you aren't signed in), and never in CI. `--dry-run` shows what it would do first.
|
|
168
|
-
- **Context that carries over:** in a repo linked to a Postman workspace, using the CLI saves context to that cloud workspace automatically: run results, pushes with their messages, and who or which agent did what. The next session, agent or teammate reads it back with `postman workspace context`, so work isn't re-derived each time. It also keeps your team's API Catalog and Application Inventory current, and feeds Context Graph. Commands such as `collection run`, `request` and `spec lint` do this by default.
|
|
169
|
-
|
|
170
274
|
## Accounts
|
|
171
275
|
|
|
172
276
|
All capabilities are available without signing in. Signing in associates your work with a Postman account from then on: `postman signup` creates a new account, and `postman login` connects an existing one.
|
|
@@ -175,7 +279,7 @@ All capabilities are available without signing in. Signing in associates your wo
|
|
|
175
279
|
postman whoami
|
|
176
280
|
postman signup
|
|
177
281
|
postman login
|
|
178
|
-
postman login --with-api-key <api-key>
|
|
282
|
+
postman login --with-api-key <api-key> # or set POSTMAN_API_KEY
|
|
179
283
|
```
|
|
180
284
|
|
|
181
285
|
The CLI supports Postman's EU region for teams whose data is hosted in the EU. Sign in with `postman login --region eu` (or `postman login --with-api-key <api-key> --region eu`), and the CLI works against the EU region from then on. Private runners take the same `--region eu` option. See [EU data residency](https://learning.postman.com/docs/administration/enterprise/about-eu-data-residency/).
|
|
@@ -185,15 +289,19 @@ The CLI supports Postman's EU region for teams whose data is hosted in the EU. S
|
|
|
185
289
|
Install the Postman plugin to make the skills available in every repo you open in your coding agent. The plugin runs its commands through this CLI. `postman init` adds the skills to one repo, so everyone who clones it gets them.
|
|
186
290
|
|
|
187
291
|
```bash
|
|
188
|
-
|
|
292
|
+
# Every agent on this machine
|
|
293
|
+
npx @postman/postman-plugin
|
|
189
294
|
|
|
190
|
-
|
|
295
|
+
# Claude Code
|
|
296
|
+
claude plugin marketplace add anthropics/claude-plugins-official
|
|
191
297
|
claude plugin install postman@claude-plugins-official
|
|
192
298
|
|
|
193
|
-
|
|
299
|
+
# Codex
|
|
300
|
+
codex plugin marketplace add postmanlabs/postman-plugin
|
|
194
301
|
codex plugin add postman@postman
|
|
195
302
|
|
|
196
|
-
|
|
303
|
+
# Cursor
|
|
304
|
+
/add-plugin postman
|
|
197
305
|
```
|
|
198
306
|
|
|
199
307
|
Also available for OpenCode, GitHub Copilot CLI, Antigravity, Factory, Kimi Code and Pi. See [Install the Postman plugin](https://learning.postman.com/docs/postman-plugin/install/overview/).
|
|
@@ -203,7 +311,6 @@ Also available for OpenCode, GitHub Copilot CLI, Antigravity, Factory, Kimi Code
|
|
|
203
311
|
- Authenticate with `POSTMAN_API_KEY` or `postman login --with-api-key`.
|
|
204
312
|
- Commands exit non-zero on failure.
|
|
205
313
|
- `--json` for machine-readable output, `--output ndjson` for streaming, `--yes` to skip prompts.
|
|
206
|
-
- Collection run reporters: `cli`, `json`, `junit`, `html`.
|
|
207
314
|
- `postman workspace diff --exit-code` fails when local files and the cloud workspace differ.
|
|
208
315
|
- In CI, `postman init` uses the workspace recorded in `.postman/resources.yaml`.
|
|
209
316
|
- GitHub Actions: [Postman CLI GitHub Action](https://learning.postman.com/docs/postman-cli/postman-cli-github-actions).
|
package/man/postman.1
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
.TH POSTMAN 1 "2026-
|
|
1
|
+
.TH POSTMAN 1 "2026-11-03" "v1.85.0" "Postman CLI Manual"
|
|
2
2
|
.SH NAME
|
|
3
3
|
postman \- Command\-line companion utility for Postman
|
|
4
4
|
.SH SYNOPSIS
|
|
@@ -3902,7 +3902,7 @@ Workspace that owns the shared vault for the collection's v12 secret variables.
|
|
|
3902
3902
|
|
|
3903
3903
|
Examples:
|
|
3904
3904
|
postman performance run 123456\-45159473\-1e45\-1f34\-5678\-1234567890ab # defaults: 20 VUs, ramp\-up, 1 minute
|
|
3905
|
-
postman performance run "postman/collections/My Collection" \-\-peak\-vu 10 \-\-duration 2 #
|
|
3905
|
+
postman performance run "postman/collections/My Collection" \-\-peak\-vu 10 \-\-duration 2 # local files, unrecorded even when git\-linked
|
|
3906
3906
|
postman performance run <collectionId> \-\-load\-profile fixed \-\-peak\-vu 50 \-\-duration 15 # 50 VUs, flat
|
|
3907
3907
|
postman performance run <collectionId> \-\-load\-profile spike \-\-peak\-vu 100 \-\-base\-vu 2 \-\-duration 5 \-\-load\-segments 1m30s,20s,40s
|
|
3908
3908
|
postman performance run <collectionId> \-\-pass\-if "less_than(p95, 500)" \-\-pass\-if "less_than(error_rate, 5)" # fail if p95 is over 500ms or error rate is over 5%
|
|
@@ -3928,9 +3928,9 @@ Load segments:
|
|
|
3928
3928
|
ramp\-up — 2 segments
|
|
3929
3929
|
|
|
3930
3930
|
peak ┤ _________ at peak __________
|
|
3931
|
-
│ ramp\-up _____
|
|
3932
|
-
│ ______
|
|
3933
|
-
base ┤__ warm\-up ___
|
|
3931
|
+
│ ramp\-up _____╱
|
|
3932
|
+
│ ______╱
|
|
3933
|
+
base ┤__ warm\-up ___╱
|
|
3934
3934
|
└┬─────────────┬─────────────┬───────────────────────────┤ \-\-duration
|
|
3935
3935
|
1 2 (3)
|
|
3936
3936
|
|
|
@@ -3942,10 +3942,10 @@ Load segments:
|
|
|
3942
3942
|
|
|
3943
3943
|
spike — 3 segments · no time at the peak; use \-\-load\-profile peak to hold
|
|
3944
3944
|
|
|
3945
|
-
peak ┤
|
|
3946
|
-
│ ramp\-up _
|
|
3947
|
-
│ _
|
|
3948
|
-
base ┤______ warm\-up _______
|
|
3945
|
+
peak ┤ ╱╲
|
|
3946
|
+
│ ramp\-up _╱ ╲_ ramp\-down
|
|
3947
|
+
│ _╱ ╲_
|
|
3948
|
+
base ┤______ warm\-up _______╱ ╲______ at base _______
|
|
3949
3949
|
└┬─────────────────────┬─────┬─────┬─────────────────────┤ \-\-duration
|
|
3950
3950
|
1 2 3 (4)
|
|
3951
3951
|
|
|
@@ -3958,9 +3958,9 @@ Load segments:
|
|
|
3958
3958
|
peak — 4 segments
|
|
3959
3959
|
|
|
3960
3960
|
peak ┤ __ hold ___
|
|
3961
|
-
│ ramp\-up ____
|
|
3962
|
-
│ ____
|
|
3963
|
-
base ┤_ warm\-up _
|
|
3961
|
+
│ ramp\-up ____╱ ╲____ ramp\-down
|
|
3962
|
+
│ ____╱ ╲____
|
|
3963
|
+
base ┤_ warm\-up _╱ ╲_ at base __
|
|
3964
3964
|
└┬──────────┬──────────┬──────────┬──────────┬───────────┤ \-\-duration
|
|
3965
3965
|
1 2 3 4 (5)
|
|
3966
3966
|
|
|
@@ -5185,7 +5185,7 @@ Create, run, and manage Postman mocks — in your repository or in Postman cloud
|
|
|
5185
5185
|
.B Subcommands:
|
|
5186
5186
|
.TP
|
|
5187
5187
|
.B mock generate
|
|
5188
|
-
Generate a mock from a Postman collection, an OpenAPI file or a dataset, or from a built\-in sample shopping
|
|
5188
|
+
Generate a mock from a Postman collection, an OpenAPI file or a dataset, or a static mock from a built\-in sample shopping cart (POST /cart/items, GET /cart, POST /checkout). Writes a local mock by default, or a cloud mock with \-\-workspace. Add \-\-deploy to also make it a live mock server.
|
|
5189
5189
|
.TP
|
|
5190
5190
|
.B mock run
|
|
5191
5191
|
Start a mock using its path if it lives in your repository, or its id if it lives in Postman cloud (fetched and run locally).
|
|
@@ -5209,7 +5209,7 @@ Show the requests a live mock server has received and the responses it sent, usi
|
|
|
5209
5209
|
Delete a mock using its path if it lives in your repository, or its id if it lives in Postman cloud. Cannot be undone.
|
|
5210
5210
|
|
|
5211
5211
|
.SS "mock generate"
|
|
5212
|
-
Generate a mock from a Postman collection, an OpenAPI file or a dataset, or from a built\-in sample shopping
|
|
5212
|
+
Generate a mock from a Postman collection, an OpenAPI file or a dataset, or a static mock from a built\-in sample shopping cart (POST /cart/items, GET /cart, POST /checkout). Writes a local mock by default, or a cloud mock with \-\-workspace. Add \-\-deploy to also make it a live mock server.
|
|
5213
5213
|
|
|
5214
5214
|
.B Usage:
|
|
5215
5215
|
[sourcePath] [options]
|
|
@@ -5220,10 +5220,10 @@ Generate a mock from a Postman collection, an OpenAPI file or a dataset, or from
|
|
|
5220
5220
|
Folder to save the mock in. Relative or absolute, e.g. ./postman/mocks/orders. Defaults to postman/mocks/<name>.
|
|
5221
5221
|
.TP
|
|
5222
5222
|
.B \-n, \-\-name <name>
|
|
5223
|
-
Name for the mock. Taken from the source when you provide one; required for the sample.
|
|
5223
|
+
Name for the mock. Taken from the source when you provide one; required for the sample. With \-\-update, renames the mock.
|
|
5224
5224
|
.TP
|
|
5225
5225
|
.B \-\-port <port>
|
|
5226
|
-
Port the mock runs on (e.g. 4010
|
|
5226
|
+
Port the mock runs on (e.g. 4010; default 4500). With \-\-update, changes the mock's port.
|
|
5227
5227
|
.TP
|
|
5228
5228
|
.B \-\-mode <mode>
|
|
5229
5229
|
How the mock behaves: static (replays examples, the default), stateful (keeps records: create, read, list, update, delete), or ai (stateful, plus realistic data and business rules; generated by Postman, needs `postman login`).
|
|
@@ -5232,7 +5232,10 @@ How the mock behaves: static (replays examples, the default), stateful (keeps re
|
|
|
5232
5232
|
Same as \-\-mode stateful. Generated offline for a local file, by Postman with \-\-workspace, \-\-spec, \-\-collection or \-\-dataset (validated, with seed data). Endpoints that are not CRUD\-shaped stay static.
|
|
5233
5233
|
.TP
|
|
5234
5234
|
.B \-\-instructions <text>
|
|
5235
|
-
With \-\-mode ai: guidance for the AI, e.g. "Orders can only be cancelled before they ship".
|
|
5235
|
+
With \-\-mode ai: guidance for the AI, up to 2000 characters, e.g. "Orders can only be cancelled before they ship". Recorded with the mock, so \-\-update reuses them.
|
|
5236
|
+
.TP
|
|
5237
|
+
.B \-\-strict
|
|
5238
|
+
With \-\-mode ai: fail instead of falling back. Postman refuses a mock it would build without AI (exit 1, nothing written or saved). A mock whose AI rules reached only some operations, or one an older Postman built without AI anyway, is kept but exits 4.
|
|
5236
5239
|
.TP
|
|
5237
5240
|
.B \-\-spec <specId>
|
|
5238
5241
|
Generate from a spec in Postman (by id) instead of a local file. With \-\-workspace, the mock stays linked to it and is regenerated when it changes.
|
|
@@ -5244,22 +5247,22 @@ Generate from a collection in Postman (by id) instead of a local file. With \-\-
|
|
|
5244
5247
|
Generate from a dataset: its tables become resources and their first 20 rows the records. A dataset in Postman (by id) or a local .dataset.yaml (CSV and JSON sources). Generated by Postman in stateful (the default) or ai mode; AI sees the column names and types, never the rows.
|
|
5245
5248
|
.TP
|
|
5246
5249
|
.B \-\-force
|
|
5247
|
-
|
|
5250
|
+
Replace the mock's files if the target folder already holds a mock. A folder with other files and no mock is never written to.
|
|
5248
5251
|
.TP
|
|
5249
|
-
.B \-u, \-\-update <
|
|
5250
|
-
Regenerate an existing mock in place
|
|
5252
|
+
.B \-u, \-\-update <mockPathOrId>
|
|
5253
|
+
Regenerate an existing mock in place: one in your repository by path (e.g. ./postman/mocks/orders), or one in Postman cloud by id. Without a source or \-\-mode, it uses the ones the mock recorded (and an ai mock's instructions). Cannot be used with \-\-output.
|
|
5251
5254
|
.TP
|
|
5252
5255
|
.B \-w, \-\-workspace <id>
|
|
5253
|
-
Save the mock to this Postman cloud workspace (by id) instead of your repository. Cannot be used with \-\-output, \-\-force, or \-\-update
|
|
5256
|
+
Save the mock to this Postman cloud workspace (by id) instead of your repository. Cannot be used with \-\-output, \-\-force, or \-\-update <mockPath>; with \-\-deploy it only picks the workspace, and with \-\-update <cloudMockId> it names the workspace the mock is in.
|
|
5254
5257
|
.TP
|
|
5255
5258
|
.B \-\-deploy
|
|
5256
5259
|
After generating, upload the mock to Postman cloud and deploy it to a live mock server (private by default). Uses \-\-workspace, else the workspace linked to this project.
|
|
5257
5260
|
.TP
|
|
5258
5261
|
.B \-\-public
|
|
5259
|
-
With \-\-deploy, let anyone with the link reach the server (default: callers need an API key)
|
|
5262
|
+
With \-\-deploy, let anyone with the link reach the server (default: callers need an API key). Requires \-\-deploy.
|
|
5260
5263
|
.TP
|
|
5261
5264
|
.B \-s, \-\-slug <slug>
|
|
5262
|
-
With \-\-deploy, the short label used in the server's web address
|
|
5265
|
+
With \-\-deploy, the short label used in the server's web address. Requires \-\-deploy.
|
|
5263
5266
|
.TP
|
|
5264
5267
|
.B \-\-timeout <ms>
|
|
5265
5268
|
How long to wait for Postman to generate the mock, in milliseconds (default 75000).
|
|
@@ -5284,6 +5287,7 @@ Eg. postman mock generate ./my\-collection.json
|
|
|
5284
5287
|
postman mock generate ./openapi.yaml \-\-stateful # CRUD handlers backed by pm.state
|
|
5285
5288
|
postman mock generate ./openapi.yaml \-\-mode ai \-\-instructions "Orders ship in 2 days"
|
|
5286
5289
|
postman mock generate \-\-spec <specId> \-\-mode stateful \-w <workspaceId> # linked cloud mock
|
|
5290
|
+
postman mock generate \-\-update <cloudMockId> # regenerate a cloud mock from its linked source
|
|
5287
5291
|
postman mock generate \-\-dataset ./postman/datasets/shop/shop.dataset.yaml # rows as records
|
|
5288
5292
|
postman mock generate \-\-update ./postman/mocks/orders # regenerate from its recorded source
|
|
5289
5293
|
postman mock generate \-\-spec <specId> \-\-mode ai \-o ./postman/mocks/orders \-\-json
|
|
@@ -7167,6 +7171,12 @@ Create or update scripts executed by a webhook.
|
|
|
7167
7171
|
.TP
|
|
7168
7172
|
.B webhook forward
|
|
7169
7173
|
Forward incoming webhook requests to a local port.
|
|
7174
|
+
.TP
|
|
7175
|
+
.B webhook environment
|
|
7176
|
+
Get or set the cloud environment associated with a webhook.
|
|
7177
|
+
.TP
|
|
7178
|
+
.B webhook auth
|
|
7179
|
+
Get or set authentication for incoming webhook requests.
|
|
7170
7180
|
|
|
7171
7181
|
.SS "webhook create"
|
|
7172
7182
|
Create a new webhook and print its public URL.
|
|
@@ -7448,6 +7458,162 @@ Examples:
|
|
|
7448
7458
|
|
|
7449
7459
|
|
|
7450
7460
|
|
|
7461
|
+
.SS "webhook environment"
|
|
7462
|
+
Get or set the cloud environment associated with a webhook.
|
|
7463
|
+
|
|
7464
|
+
.B Usage:
|
|
7465
|
+
[options] [command]
|
|
7466
|
+
|
|
7467
|
+
.B Subcommands:
|
|
7468
|
+
.TP
|
|
7469
|
+
.B webhook environment get
|
|
7470
|
+
Print the associated cloud environment ID.
|
|
7471
|
+
.TP
|
|
7472
|
+
.B webhook environment set
|
|
7473
|
+
Associate a cloud environment ID with a webhook; local files are not supported.
|
|
7474
|
+
|
|
7475
|
+
.SS "webhook environment get"
|
|
7476
|
+
Print the associated cloud environment ID.
|
|
7477
|
+
|
|
7478
|
+
.B Usage:
|
|
7479
|
+
[options] <webhookId>
|
|
7480
|
+
|
|
7481
|
+
.B Options:
|
|
7482
|
+
.TP
|
|
7483
|
+
.B \-w, \-\-workspace <workspaceId>
|
|
7484
|
+
Postman workspace ID (falls back to .postman/resources.yaml or .postman/config.json)
|
|
7485
|
+
.TP
|
|
7486
|
+
.B \-\-api\-key <key>
|
|
7487
|
+
Postman API key for CLI authentication
|
|
7488
|
+
.TP
|
|
7489
|
+
.B \-\-timeout <ms>
|
|
7490
|
+
Request timeout in milliseconds (default: 30000)
|
|
7491
|
+
.TP
|
|
7492
|
+
.B \-\-json
|
|
7493
|
+
Print the result as JSON
|
|
7494
|
+
|
|
7495
|
+
.TP Examples:
|
|
7496
|
+
|
|
7497
|
+
Example:
|
|
7498
|
+
postman webhook environment get <webhookId>
|
|
7499
|
+
|
|
7500
|
+
|
|
7501
|
+
|
|
7502
|
+
.SS "webhook environment set"
|
|
7503
|
+
Associate a cloud environment ID with a webhook; local files are not supported.
|
|
7504
|
+
|
|
7505
|
+
.B Usage:
|
|
7506
|
+
[options] <webhookId> <environmentId>
|
|
7507
|
+
|
|
7508
|
+
.B Options:
|
|
7509
|
+
.TP
|
|
7510
|
+
.B \-w, \-\-workspace <workspaceId>
|
|
7511
|
+
Postman workspace ID (falls back to .postman/resources.yaml or .postman/config.json)
|
|
7512
|
+
.TP
|
|
7513
|
+
.B \-\-api\-key <key>
|
|
7514
|
+
Postman API key for CLI authentication
|
|
7515
|
+
.TP
|
|
7516
|
+
.B \-\-timeout <ms>
|
|
7517
|
+
Request timeout in milliseconds (default: 30000)
|
|
7518
|
+
.TP
|
|
7519
|
+
.B \-\-json
|
|
7520
|
+
Print the result as JSON
|
|
7521
|
+
|
|
7522
|
+
.TP Examples:
|
|
7523
|
+
|
|
7524
|
+
Example:
|
|
7525
|
+
postman webhook environment set <webhookId> 12345678\-00000000\-0000\-4000\-8000\-000000000000
|
|
7526
|
+
|
|
7527
|
+
|
|
7528
|
+
|
|
7529
|
+
.SS "webhook auth"
|
|
7530
|
+
Get or set authentication for incoming webhook requests.
|
|
7531
|
+
|
|
7532
|
+
.B Usage:
|
|
7533
|
+
[options] [command]
|
|
7534
|
+
|
|
7535
|
+
.B Subcommands:
|
|
7536
|
+
.TP
|
|
7537
|
+
.B webhook auth get
|
|
7538
|
+
Show webhook authentication details without credential values.
|
|
7539
|
+
.TP
|
|
7540
|
+
.B webhook auth set
|
|
7541
|
+
Set Basic or API key authentication, or disable authentication.
|
|
7542
|
+
|
|
7543
|
+
.SS "webhook auth get"
|
|
7544
|
+
Show webhook authentication details without credential values.
|
|
7545
|
+
|
|
7546
|
+
.B Usage:
|
|
7547
|
+
[options] <webhookId>
|
|
7548
|
+
|
|
7549
|
+
.B Options:
|
|
7550
|
+
.TP
|
|
7551
|
+
.B \-w, \-\-workspace <workspaceId>
|
|
7552
|
+
Postman workspace ID (falls back to .postman/resources.yaml or .postman/config.json)
|
|
7553
|
+
.TP
|
|
7554
|
+
.B \-\-api\-key <key>
|
|
7555
|
+
Postman API key for CLI authentication
|
|
7556
|
+
.TP
|
|
7557
|
+
.B \-\-timeout <ms>
|
|
7558
|
+
Request timeout in milliseconds (default: 30000)
|
|
7559
|
+
.TP
|
|
7560
|
+
.B \-\-json
|
|
7561
|
+
Print the result as JSON
|
|
7562
|
+
|
|
7563
|
+
.TP Examples:
|
|
7564
|
+
|
|
7565
|
+
Example:
|
|
7566
|
+
postman webhook auth get <webhookId>
|
|
7567
|
+
|
|
7568
|
+
|
|
7569
|
+
|
|
7570
|
+
.SS "webhook auth set"
|
|
7571
|
+
Set Basic or API key authentication, or disable authentication.
|
|
7572
|
+
|
|
7573
|
+
.B Usage:
|
|
7574
|
+
[options] <webhookId>
|
|
7575
|
+
|
|
7576
|
+
.B Options:
|
|
7577
|
+
.TP
|
|
7578
|
+
.B \-\-type <type>
|
|
7579
|
+
Authentication type
|
|
7580
|
+
.TP
|
|
7581
|
+
.B \-\-username <username>
|
|
7582
|
+
Basic auth username or variable reference
|
|
7583
|
+
.TP
|
|
7584
|
+
.B \-\-password <password>
|
|
7585
|
+
Basic auth password or variable reference
|
|
7586
|
+
.TP
|
|
7587
|
+
.B \-\-secret <secret>
|
|
7588
|
+
Webhook API key value or variable reference
|
|
7589
|
+
.TP
|
|
7590
|
+
.B \-\-source <source>
|
|
7591
|
+
Where incoming credentials are read (default: headers)
|
|
7592
|
+
.TP
|
|
7593
|
+
.B \-\-key <key>
|
|
7594
|
+
Header or query parameter name (default: Authorization for Basic, x\-api\-key for API key)
|
|
7595
|
+
.TP
|
|
7596
|
+
.B \-w, \-\-workspace <workspaceId>
|
|
7597
|
+
Postman workspace ID (falls back to .postman/resources.yaml or .postman/config.json)
|
|
7598
|
+
.TP
|
|
7599
|
+
.B \-\-api\-key <key>
|
|
7600
|
+
Postman API key for CLI authentication
|
|
7601
|
+
.TP
|
|
7602
|
+
.B \-\-timeout <ms>
|
|
7603
|
+
Request timeout in milliseconds (default: 30000)
|
|
7604
|
+
.TP
|
|
7605
|
+
.B \-\-json
|
|
7606
|
+
Print the result as JSON
|
|
7607
|
+
|
|
7608
|
+
.TP Examples:
|
|
7609
|
+
|
|
7610
|
+
Examples:
|
|
7611
|
+
postman webhook auth set <webhookId> \-\-type basic \-\-username '{{username}}' \-\-password '{{password}}'
|
|
7612
|
+
postman webhook auth set <webhookId> \-\-type api\-key \-\-secret '{{webhookApiKey}}'
|
|
7613
|
+
postman webhook auth set <webhookId> \-\-type none
|
|
7614
|
+
|
|
7615
|
+
|
|
7616
|
+
|
|
7451
7617
|
.SS "dataset"
|
|
7452
7618
|
Work with Postman datasets in local YAML files or the cloud.
|
|
7453
7619
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "postman-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.85.0",
|
|
4
4
|
"description": "Official Postman CLI - Command-line companion for API development, testing, and automation",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"postman",
|
|
@@ -57,10 +57,10 @@
|
|
|
57
57
|
"scripts/"
|
|
58
58
|
],
|
|
59
59
|
"optionalDependencies": {
|
|
60
|
-
"@postman/pm-bin-macos-arm64": "1.
|
|
61
|
-
"@postman/pm-bin-macos-x64": "1.
|
|
62
|
-
"@postman/pm-bin-linux-x64": "1.
|
|
63
|
-
"@postman/pm-bin-linux-arm64": "1.
|
|
64
|
-
"@postman/pm-bin-windows-x64": "1.
|
|
60
|
+
"@postman/pm-bin-macos-arm64": "1.85.0",
|
|
61
|
+
"@postman/pm-bin-macos-x64": "1.85.0",
|
|
62
|
+
"@postman/pm-bin-linux-x64": "1.85.0",
|
|
63
|
+
"@postman/pm-bin-linux-arm64": "1.85.0",
|
|
64
|
+
"@postman/pm-bin-windows-x64": "1.85.0"
|
|
65
65
|
}
|
|
66
66
|
}
|