← PostmanCONTENT HISTORY

Update to Postman

Snapshot Oct 24, 2026 · 12:56 UTC · version 0.4.0

Collection source: downloaded plugin package. These snapshots do not have a confirmed matching collection source. Differences in file lists alone do not establish changes to the package.

WHAT CHANGED

Payment or plan references changed

Full description — Now says: Finds, builds, runs and publishes a stand-in for one API — the owning team's published mock when there is one, otherwise one built from its spec or...

Observed in published text. Live prices and checkout terms have not been verified by this change.

Save Postman and check future changes in Following.

Up to 3 plugins free · no card required.

All fields and original values.

Full description

Before

Sep 30, 2026 · 23:09 UTC

Stands up a fake backend that behaves like a real API — from a collection or an OpenAPI spec, running locally or pushed to Postman's cloud for a durable URL — plus request-time scenario and status-code overrides for testing failure paths...

After

Oct 24, 2026 · 12:56 UTC

Finds, builds, runs and publishes a stand-in for one API — the owning team's published mock when there is one, otherwise one built from its spec or collection that behaves like the real API, stateful when callers write then read. Use whe...

Skill instructions

Before

Sep 30, 2026 · 23:09 UTC

Stands up a fake backend that behaves like a real API — from a collection or an OpenAPI spec, running locally or pushed to Postman's cloud for a durable URL — plus request-time scenario and status-code overrides for testing failure paths...

After

Oct 24, 2026 · 12:56 UTC

Finds, builds, runs and publishes a stand-in for one API — the owning team's published mock when there is one, otherwise one built from its spec or collection that behaves like the real API, stateful when callers write then read. Use whe...

Compare saved observations

Download comparison JSON

SKILL.md text changes

− removed · + added

--- before
+++ after
@@ -1,141 +1,123 @@
 ---
 name: api-mocking
-description: Stands up a fake backend that behaves like a real API — from a collection or an OpenAPI spec, running locally or pushed to Postman's cloud for a durable URL — plus request-time scenario and status-code overrides for testing failure paths. Use when the user asks to "mock this API," "create a mock server," "fake the backend," "run tests without hitting the real API," or "simulate an error/out-of-stock response." Covers `postman mock`. Depends on bootstrap for the workspace id only once a mock is pushed to the cloud (`-w`, or the workspace linked in `.postman/resources.yaml`) — generating and running a mock locally needs nothing from bootstrap.
+description: Finds, builds, runs and publishes a stand-in for one API — the owning team's published mock when there is one, otherwise one built from its spec or collection that behaves like the real API, stateful when callers write then read. Use when something needs an API that isn't built or reachable yet (a frontend, client or demo), when other teams should build against your API before it ships, or when asked to mock an API or fake a backend. To run and test your own code against the services it calls, use api-simulation. Covers `postman mock` and `postman dependency add mock`.
 ---
 
 # API Mocking
 
-## Overview
-
-This skill covers the Postman CLI (`postman mock`) for **Code Mocks** — the
-code-based mock product. It is not the postman-app UI (Local Mode sidebar,
-Agent Mode tools, Simulations), nor the older classic/collection mocks that
-serve saved collection examples from a `*.mock.pstmn.io` URL — that's a
-different product (the MCP `createMock` flow), not this skill.
-
-A **local** mock is two files on disk: `config.yaml` (name, port, scenarios) and
-`default.js` — a plain Node HTTP server, and the mock itself, not a wrapper
-around one. Generating, inspecting, running, and calling a local mock work for
-a logged-out guest. Only sharing it — pushing to the cloud and deploying a
-durable URL — needs `postman login`. The progression is one model in three
-places: local folder ──`push`──▶ Code Mock (cloud definition) ──`deploy`──▶
-Mock Server (the reachable URL).
-
-Default path: write a local folder, then `mock push` later if something other
-than you needs to hit it over the network (a teammate, CI elsewhere, a webhook
-sender). A purely local mock answering a `postman request` on your machine
-never needs cloud. The exception is `generate -w`, which creates the mock in a
-workspace only and writes no local files — use that only when you intentionally
-skip the repo copy.
-
-## Process
-
-1. **Generate.** `postman mock generate -n NAME` with no source scaffolds a
-   sample shopping-cart mock (`POST /cart/items`, `GET /cart`, `POST /checkout`)
-   — the fastest way to a server that already answers, useful whenever the
-   point is exercising mock *behavior* rather than a specific API's shape. Pass
-   a real source — `postman mock generate SOURCE -n NAME`, where `SOURCE` is a
-   collection file/directory or an `openapi.yaml` — when the endpoints need to
-   mirror an actual API. Either form writes `config.yaml` + `default.js` into
-   `postman/mocks/NAME/` (default port 4500).
-   - `postman mock generate SOURCE --update ./postman/mocks/NAME` regenerates
-     the default handler from the source in place, keeping the existing name,
-     port, and scenarios. `--update` still needs the `SOURCE`; it cannot be
-     combined with `--output`.
-   - `-w <workspaceId>` saves the mock to a cloud workspace *instead of* the
-     repository — it writes no local files and requires being logged in. Cannot
-     be combined with `--output`, `--force`, or `--update`. Prefer local
-     generate + later `push` when you still need `mock run` from a folder.
-2. **Run it.** `postman mock run ./postman/mocks/NAME` starts the server and
-   prints the bound URL (`... at http://localhost:PORT`). If the port in
-   `config.yaml` is taken and `--port` wasn't passed explicitly, it falls back
-   to a free OS-assigned port instead of erroring — read the real port off that
-   line rather than assuming the configured one. Naming `--port N` explicitly
-   makes a taken port a hard error; `--port auto` always picks a free one.
-3. **Call it.** Plain `postman request localhost:PORT/route` returns the
-   default scenario's response. Two headers can change that per-request, with no
-   restart: `x-mock-scenario: <name>` selects a scenario the mock defines
-   (valid names live in `config.yaml`); a name the mock doesn't define is not an
-   error — it falls back to the default scenario. `x-mock-response-code: <code>`
-   filters an endpoint's saved example responses to the one with that status, so
-   it only changes anything when that endpoint actually has an example for that
-   code — mocks generated from a collection/spec with multiple example statuses
-   honor it; the built-in sample mock has one response per route and ignores it.
-   A wrong route comes back as `Endpoint not defined`. There's no hot reload: a
-   `default.js` edit does nothing until you Ctrl+C the running server and
-   `mock run` it again.
-4. **Push it, if it needs to leave your machine.**
-   `postman mock push ./postman/mocks/NAME` is safe to re-run — `Created` the
-   first time, `Updated` after — and records the cloud mapping in
-   `.postman/resources.yaml`; commit that change. If a mock server is already
-   live for this mock, the push updates what it serves.
-5. **Deploy it, for a URL that outlives your terminal.**
-   `postman mock deploy CLOUD_ID -s SLUG -y` prints
-   `https://SLUG.mock.<team-domain>.postman.dev`. Deployed private by default —
-   callers need a Postman API key (`x-api-key`) — add `--public` only when the
-   mock should be reachable by anyone with the URL. `--auto-deploy` re-publishes
-   the live server automatically whenever the mock changes; even without it, a
-   later `push` already updates a live server, so you only re-`deploy` for the
-   first URL or after taking the server down.
-6. **See who's calling it.** `postman mock get CLOUD_ID` (table or `--json`)
-   returns `mockServerId`; feed that into `postman mock log MOCK_SERVER_ID` for
-   call entries (filter with `--method` / `--status` / `--path` / `--since` /
-   `--until` / `--limit`, or `--json`). An empty log means the URL genuinely
-   hasn't been hit — a rejected caller still shows up, recorded with its failing
-   status code.
-7. **Tear down.**
-   - Local: `postman mock delete ./path --yes` — refuses while that mock is
-     **running** locally; stop `mock run` first.
-   - Cloud: `postman mock delete CLOUD_ID --yes` — refuses while the mock is
-     **running locally** *or* **deployed**; stop the local run and take the
-     mock server down first.
-   Cloud delete doesn't touch `.postman/resources.yaml`; drop that line by hand
-   afterward or the repo keeps claiming a mock that's gone.
-
-To point real request/assertion runs at a mock instead of hand-editing
-base-URL variables, see the `api-testing` skill's `--use-mock`/`--mock` flags
-on `collection run`.
-
-## The two ids that matter
-
-- **Code-mock id** — the `id` in `config.yaml`, and the id that `push` and
-  `generate -w` print (often the same value). Use it for `get`, `deploy`,
-  `delete`, and `run` by cloud id.
-- **`mockServerId`** — a different value from `mock get CLOUD_ID` (table or
-  `--json`). Use it for `mock log`, and nothing else.
-
-## Critical Rules
-
-1. **When you're not signed in, every gated cloud command fails closed:**
-   `Authentication required. Run postman login or provide --api-key`, exit 1,
-   nothing half-done. (Signed in but lacking access fails differently — a
-   permission or missing-workspace error.) Whether a command is gated is decided
-   by what you pass it, not the verb — `mock get`/`mock run` take either a local
-   path (ungated) or a cloud ID (gated); `mock list` is gated only when called
-   with no path.
-2. **`push` is what moves an existing local mock to the cloud — `-w` at
-   `generate` time is optional, not a fork you must choose up front.** A mock
-   built as a guest can be pushed and deployed later with no rework. Do not
-   assume `generate -w` left a `postman/mocks/NAME/` folder to `run`.
-3. **`--public` on `deploy` is the one action here with real exposure** — it
-   stands up a server anyone with the URL can hit, with no API key. The default
-   (private) is the safe one; confirm intent before adding it.
-4. **To change a mock:** refresh it from a source with
-   `postman mock generate SOURCE --update PATH`, or edit `default.js` by hand
-   and restart `mock run`. Never pass a code-mock id to `mock log` — that
-   command takes a `mockServerId`.
-5. **`-w`/`--workspace` only exists on `generate`, `list`, `push`, and
-   `deploy`.** `get`, `run`, `log`, and `delete` already take a path or an id
-   that says where the mock is — there's nothing left for `-w` to resolve on
-   those.
-
-## Verification
-
-A mock isn't done because `generate` or `run` exited 0 — hit it with
-`postman request` and check the actual status/body, or `mock get CLOUD_ID
---json` for a cloud one, then state whether it ended up local or cloud, and
-(if deployed) private or public. For a scenario check, confirm a *valid* name
-from `config.yaml` actually changed the response — a typo'd name falls back to
-the default, so a 200 alone proves nothing. For a status-code check, use an
-endpoint that has an example for that code (not the sample mock). A passing
-exit code from `request` is not enough.
+A mock is a folder, `config.yaml` plus a handler such as `default.js`, that
+answers like an API. The handler is a Node HTTP server that calls
+`listen(process.env.PORT)`. It loads as CommonJS even in an ESM project, so
+`import` fails: use `require`. The same mock lives in your repo
+(`postman/mocks/<name>/`, run with `postman mock run`, no sign-in needed),
+in a Postman workspace after `postman mock push`, where other teams pull it
+from, and on a mock server after `postman mock deploy`, for callers that
+can't run it themselves.
+
+Several APIs at once, for a service, a frontend or a test suite? Use
+`api-simulation`, which gets each member's mock here.
+
+## Use the owner's mock first
+
+When the API belongs to another team, look for their published mock before
+writing one: theirs encodes their contract and their service's state; yours
+encodes a guess. It needs `postman login`; signed out, build one and say the
+owner search was skipped.
+
+1. Find the owner's workspace with `postman search workspaces "<service>" -o json`.
+   Name the service plainly, as your code does, not by what it returns: a
+   description matches lookalike services. Prefer a Git-connected workspace
+   (`isGitConnected`) named for that service.
+2. List its mocks with `postman mock list -w <workspaceId> --json`.
+   `postman search mocks` misses some, and its `classicMock` results only
+   replay a collection's saved examples: `postman mock` can't pull or run
+   them, so call one at `https://<mockId>.mock.pstmn.io` with
+   `postman request`, or generate a code mock from its collection. A
+   same-named mock in another workspace isn't the owner's.
+3. Pull it with `postman dependency add mock <mockId>` and use it as it is.
+   Never edit `postman/.dependencies/`: `dependency update` overwrites it,
+   so copy a mock to `postman/mocks/` to change it. A pulled copy loses
+   `interceptRequests`, so fork one whose handler reads `req.body` or relies
+   on sessions. A mock is code that runs as you; pull only from workspaces
+   you trust.
+
+## Or build one that behaves like the real API
+
+Callers shouldn't be able to tell the difference on the paths they use. A
+mock that returns invented JSON passes your tests and fails against the
+real service.
+
+- **Start from the contract.** `postman mock generate <spec or collection>`
+  writes each documented response. It's a replay: a `POST` and a later
+  `GET` share nothing, and it accepts any request, so a call that breaks the
+  contract still gets its answer. `x-mock-response-code` picks only a
+  documented status; any other code gets the default 200, so put the errors
+  callers handle (the unknown-id 404, the conflict 409, the bad-input 400) in
+  the contract. From a spec
+  it serves the server URL's base path (`/v2/...`); from a collection,
+  routes start after the base-URL variable. `--update` regenerates the
+  handler and overwrites your edits. With no contract, write it from how
+  your code calls the API and say what you assumed.
+- **Set `interceptRequests: true` in `config.yaml`.** Without it `req.body`
+  and `req.query` are undefined, `x-mock-session` is ignored, and a throw in
+  an async handler kills the mock instead of returning a `500`.
+- **Make it stateful when callers write then read.** Keep records in
+  `pm.state`, seed them on first use, add a reset route so a test can start
+  clean, and answer an unknown id with the real 404. Every `mock run` starts
+  empty.
+- **Know who shares state.** Locally, all callers share one state unless
+  each sends `x-mock-session: <id>`. A mock server deployed from the CLI
+  isolates each caller: one that keeps neither the same `x-mock-session` nor
+  the `pm_mock_session` cookie starts from the seed on every request, so its
+  `POST` and later `GET` never meet.
+- **Scenarios** are named handlers in `config.yaml`'s `scenarios` list, picked
+  per request with `x-mock-scenario: <name>`. An unknown name falls back to
+  the default locally but is a `404` on a mock server.
+
+## Check it against the contract
+
+`postman mock run` prints the URL it bound; a busy configured port moves
+unless you pass `--port`, so take the URL from that line. Nothing reloads:
+restart it after an edit.
+
+A mock checked against the handler you just wrote proves nothing, so call
+it with requests from the contract: `postman request`, or the API's
+collection with
+`postman collection run <collection> --use-mock "{{baseUrl}} mock:postman/mocks/<name>"`
+(`--mock` alone only starts it). That form replaces the variable's whole
+value, base path included, so a mock generated from a spec that serves
+`/v2/...` answers `404`; start that one with `--mock <path> --port <n>` and
+pass `--env-var "baseUrl=http://localhost:<n>/v2"`. To check your own calls
+against a contract, compare each one, from the code or a simulation log,
+with the spec; the mock won't reject a wrong one.
+
+## Publish it for other teams
+
+- **Push it to the service's own workspace,** the one this repo is linked
+  to or the one the user names, never one chosen by name match: other
+  teams' simulations look there. Signed out, the push fails but the local
+  mock still works; build it, say so and ask the user to sign in. Keep it
+  honest: change the mock in the same PR as the API and run the API's
+  collection against it.
+- **Deploy only when a caller needs a URL.** The server takes a slug of 3–32
+  lowercase letters, digits and single hyphens, starting and ending with a
+  letter or digit; the CLI accepts more, and its default can be too long.
+  It's private: callers send an API key as `x-api-key`, or, if they can
+  view the workspace, an access token as `x-access-token`. Deploying needs a paid plan; a team's first
+  server can take minutes to answer, and teams that review deploys hold them
+  for approval. Each later `push` changes what every caller of the server
+  gets, so treat it as a release, not a backup.
+- **Write it for where it runs.** A mock server runs each scenario as one
+  file with Node's built-ins, not `fs` or `child_process`: no local
+  `require`s, no `pm.mock` examples, no environment, no console output, and
+  no caller `authorization`, `cookie` or `x-api-key` headers. A mock that
+  relies on any of these works locally and breaks once deployed.
+- **Ask before `--public`.** It serves the mock and its data to anyone with
+  the URL, and a scripted redeploy can't make it private again.
+
+## Before you say it's done
+
+A mock isn't done because it started. Call it: a documented error comes
+back, a valid scenario changes the response, a `POST` then `GET` shows state
+if it should. Say where it runs and who can call it, where it lives, and
+what you assumed.
Full technical diff · 2 changed fields

changed /description

BEFORE
"Stands up a fake backend that behaves like a real API — from a collection or an OpenAPI spec, running locally or pushed to Postman's cloud for a durable URL — plus request-time scenario and status-code overrides for testing failure paths. Use when the user asks to \"mock this API,\" \"create a mock server,\" \"fake the backend,\" \"run tests without hitting the real API,\" or \"simulate an error/out-of-stock response.\" Covers `postman mock`. Depends on bootstrap for the workspace id only once a mock is pushed to the cloud (`-w`, or the workspace linked in `.postman/resources.yaml`) — generating and running a mock locally needs nothing from bootstrap."
AFTER
"Finds, builds, runs and publishes a stand-in for one API — the owning team's published mock when there is one, otherwise one built from its spec or collection that behaves like the real API, stateful when callers write then read. Use when something needs an API that isn't built or reachable yet (a frontend, client or demo), when other teams should build against your API before it ships, or when asked to mock an API or fake a backend. To run and test your own code against the services it calls, use api-simulation. Covers `postman mock` and `postman dependency add mock`."

changed /skill_md_contents

BEFORE
"---\nname: api-mocking\ndescription: Stands up a fake backend that behaves like a real API — from a collection or an OpenAPI spec, running locally or pushed to Postman's cloud for a durable URL — plus request-time scenario and status-code overrides for testing failure paths. Use when the user asks to \"mock this API,\" \"create a mock server,\" \"fake the backend,\" \"run tests without hitting the real API,\" or \"simulate an error/out-of-stock response.\" Covers `postman mock`. Depends on bootstrap for the workspace id only once a mock is pushed to the cloud (`-w`, or the workspace linked in `.postman/resources.yaml`) — generating and running a mock locally needs nothing from bootstrap.\n---\n\n# API Mocking\n\n## Overview\n\nThis skill covers the Postman CLI (`postman mock`) for **Code Mocks** — the\ncode-based mock product. It is not the postman-app UI (Local Mode sidebar,\nAgent Mode tools, Simulations), nor the older classic/collection mocks that\nserve saved collection examples from a `*.mock.pstmn.io` URL — that's a\ndifferent product (the MCP `createMock` flow), not this skill.\n\nA **local** mock is two files on disk: `config.yaml` (name, port, scenarios) and\n`default.js` — a plain Node HTTP server, and the mock itself, not a wrapper\naround one. Generating, inspecting, running, and calling a local mock work for\na logged-out guest. Only sharing it — pushing to the cloud and deploying a\ndurable URL — needs `postman login`. The progression is one model in three\nplaces: local folder ──`push`──▶ Code Mock (cloud definition) ──`deploy`──▶\nMock Server (the reachable URL).\n\nDefault path: write a local folder, then `mock push` later if something other\nthan you needs to hit it over the network (a teammate, CI elsewhere, a webhook\nsender). A purely local mock answering a `postman request` on your machine\nnever needs cloud. The exception is `generate -w`, which creates the mock in a\nworkspace only and writes no local files — use that only when you intentionally\nskip the repo copy.\n\n## Process\n\n1. **Generate.** `postman mock generate -n NAME` with no source scaffolds a\n   sample shopping-cart mock (`POST /cart/items`, `GET /cart`, `POST /checkout`)\n   — the fastest way to a server that already answers, useful whenever the\n   point is exercising mock *behavior* rather than a specific API's shape. Pass\n   a real source — `postman mock generate SOURCE -n NAME`, where `SOURCE` is a\n   collection file/directory or an `openapi.yaml` — when the endpoints need to\n   mirror an actual API. Either form writes `config.yaml` + `default.js` into\n   `postman/mocks/NAME/` (default port 4500).\n   - `postman mock generate SOURCE --update ./postman/mocks/NAME` regenerates\n     the default handler from the source in place, keeping the existing name,\n     port, and scenarios. `--update` still needs the `SOURCE`; it cannot be\n     combined with `--output`.\n   - `-w <workspaceId>` saves the mock to a cloud workspace *instead of* the\n     repository — it writes no local files and requires being logged in. Cannot\n     be combined with `--output`, `--force`, or `--update`. Prefer local\n     generate + later `push` when you still need `mock run` from a folder.\n2. **Run it.** `postman mock run ./postman/mocks/NAME` starts the server and\n   prints the bound URL (`... at http://localhost:PORT`). If the port in\n   `config.yaml` is taken and `--port` wasn't passed explicitly, it falls back\n   to a free OS-assigned port instead of erroring — read the real port off that\n   line rather than assuming the configured one. Naming `--port N` explicitly\n   makes a taken port a hard error; `--port auto` always picks a free one.\n3. **Call it.** Plain `postman request localhost:PORT/route` returns the\n   default scenario's response. Two headers can change that per-request, with no\n   restart: `x-mock-scenario: <name>` selects a scenario the mock defines\n   (valid names live in `config.yaml`); a name the mock doesn't define is not an\n   error — it falls back to the default scenario. `x-mock-response-code: <code>`\n   filters an endpoint's saved example responses to the one with that status, so\n   it only changes anything when that endpoint actually has an example for that\n   code — mocks generated from a collection/spec with multiple example statuses\n   honor it; the built-in sample mock has one response per route and ignores it.\n   A wrong route comes back as `Endpoint not defined`. There's no hot reload: a\n   `default.js` edit does nothing until you Ctrl+C the running server and\n   `mock run` it again.\n4. **Push it, if it needs to leave your machine.**\n   `postman mock push ./postman/mocks/NAME` is safe to re-run — `Created` the\n   first time, `Updated` after — and records the cloud mapping in\n   `.postman/resources.yaml`; commit that change. If a mock server is already\n   live for this mock, the push updates what it serves.\n5. **Deploy it, for a URL that outlives your terminal.**\n   `postman mock deploy CLOUD_ID -s SLUG -y` prints\n   `https://SLUG.mock.<team-domain>.postman.dev`. Deployed private by default —\n   callers need a Postman API key (`x-api-key`) — add `--public` only when the\n   mock should be reachable by anyone with the URL. `--auto-deploy` re-publishes\n   the live server automatically whenever the mock changes; even without it, a\n   later `push` already updates a live server, so you only re-`deploy` for the\n   first URL or after taking the server down.\n6. **See who's calling it.** `postman mock get CLOUD_ID` (table or `--json`)\n   returns `mockServerId`; feed that into `postman mock log MOCK_SERVER_ID` for\n   call entries (filter with `--method` / `--status` / `--path` / `--since` /\n   `--until` / `--limit`, or `--json`). An empty log means the URL genuinely\n   hasn't been hit — a rejected caller still shows up, recorded with its failing\n   status code.\n7. **Tear down.**\n   - Local: `postman mock delete ./path --yes` — refuses while that mock is\n     **running** locally; stop `mock run` first.\n   - Cloud: `postman mock delete CLOUD_ID --yes` — refuses while the mock is\n     **running locally** *or* **deployed**; stop the local run and take the\n     mock server down first.\n   Cloud delete doesn't touch `.postman/resources.yaml`; drop that line by hand\n   afterward or the repo keeps claiming a mock that's gone.\n\nTo point real request/assertion runs at a mock instead of hand-editing\nbase-URL variables, see the `api-testing` skill's `--use-mock`/`--mock` flags\non `collection run`.\n\n## The two ids that matter\n\n- **Code-mock id** — the `id` in `config.yaml`, and the id that `push` and\n  `generate -w` print (often the same value). Use it for `get`, `deploy`,\n  `delete`, and `run` by cloud id.\n- **`mockServerId`** — a different value from `mock get CLOUD_ID` (table or\n  `--json`). Use it for `mock log`, and nothing else.\n\n## Critical Rules\n\n1. **When you're not signed in, every gated cloud command fails closed:**\n   `Authentication required. Run postman login or provide --api-key`, exit 1,\n   nothing half-done. (Signed in but lacking access fails differently — a\n   permission or missing-workspace error.) Whether a command is gated is decided\n   by what you pass it, not the verb — `mock get`/`mock run` take either a local\n   path (ungated) or a cloud ID (gated); `mock list` is gated only when called\n   with no path.\n2. **`push` is what moves an existing local mock to the cloud — `-w` at\n   `generate` time is optional, not a fork you must choose up front.** A mock\n   built as a guest can be pushed and deployed later with no rework. Do not\n   assume `generate -w` left a `postman/mocks/NAME/` folder to `run`.\n3. **`--public` on `deploy` is the one action here with real exposure** — it\n   stands up a server anyone with the URL can hit, with no API key. The default\n   (private) is the safe one; confirm intent before adding it.\n4. **To change a mock:** refresh it from a source with\n   `postman mock generate SOURCE --update PATH`, or edit `default.js` by hand\n   and restart `mock run`. Never pass a code-mock id to `mock log` — that\n   command takes a `mockServerId`.\n5. **`-w`/`--workspace` only exists on `generate`, `list`, `push`, and\n   `deploy`.** `get`, `run`, `log`, and `delete` already take a path or an id\n   that says where the mock is — there's nothing left for `-w` to resolve on\n   those.\n\n## Verification\n\nA mock isn't done because `generate` or `run` exited 0 — hit it with\n`postman request` and check the actual status/body, or `mock get CLOUD_ID\n--json` for a cloud one, then state whether it ended up local or cloud, and\n(if deployed) private or public. For a scenario check, confirm a *valid* name\nfrom `config.yaml` actually changed the response — a typo'd name falls back to\nthe default, so a 200 alone proves nothing. For a status-code check, use an\nendpoint that has an example for that code (not the sample mock). A passing\nexit code from `request` is not enough.\n"
AFTER
"---\nname: api-mocking\ndescription: Finds, builds, runs and publishes a stand-in for one API — the owning team's published mock when there is one, otherwise one built from its spec or collection that behaves like the real API, stateful when callers write then read. Use when something needs an API that isn't built or reachable yet (a frontend, client or demo), when other teams should build against your API before it ships, or when asked to mock an API or fake a backend. To run and test your own code against the services it calls, use api-simulation. Covers `postman mock` and `postman dependency add mock`.\n---\n\n# API Mocking\n\nA mock is a folder, `config.yaml` plus a handler such as `default.js`, that\nanswers like an API. The handler is a Node HTTP server that calls\n`listen(process.env.PORT)`. It loads as CommonJS even in an ESM project, so\n`import` fails: use `require`. The same mock lives in your repo\n(`postman/mocks/<name>/`, run with `postman mock run`, no sign-in needed),\nin a Postman workspace after `postman mock push`, where other teams pull it\nfrom, and on a mock server after `postman mock deploy`, for callers that\ncan't run it themselves.\n\nSeveral APIs at once, for a service, a frontend or a test suite? Use\n`api-simulation`, which gets each member's mock here.\n\n## Use the owner's mock first\n\nWhen the API belongs to another team, look for their published mock before\nwriting one: theirs encodes their contract and their service's state; yours\nencodes a guess. It needs `postman login`; signed out, build one and say the\nowner search was skipped.\n\n1. Find the owner's workspace with `postman search workspaces \"<service>\" -o json`.\n   Name the service plainly, as your code does, not by what it returns: a\n   description matches lookalike services. Prefer a Git-connected workspace\n   (`isGitConnected`) named for that service.\n2. List its mocks with `postman mock list -w <workspaceId> --json`.\n   `postman search mocks` misses some, and its `classicMock` results only\n   replay a collection's saved examples: `postman mock` can't pull or run\n   them, so call one at `https://<mockId>.mock.pstmn.io` with\n   `postman request`, or generate a code mock from its collection. A\n   same-named mock in another workspace isn't the owner's.\n3. Pull it with `postman dependency add mock <mockId>` and use it as it is.\n   Never edit `postman/.dependencies/`: `dependency update` overwrites it,\n   so copy a mock to `postman/mocks/` to change it. A pulled copy loses\n   `interceptRequests`, so fork one whose handler reads `req.body` or relies\n   on sessions. A mock is code that runs as you; pull only from workspaces\n   you trust.\n\n## Or build one that behaves like the real API\n\nCallers shouldn't be able to tell the difference on the paths they use. A\nmock that returns invented JSON passes your tests and fails against the\nreal service.\n\n- **Start from the contract.** `postman mock generate <spec or collection>`\n  writes each documented response. It's a replay: a `POST` and a later\n  `GET` share nothing, and it accepts any request, so a call that breaks the\n  contract still gets its answer. `x-mock-response-code` picks only a\n  documented status; any other code gets the default 200, so put the errors\n  callers handle (the unknown-id 404, the conflict 409, the bad-input 400) in\n  the contract. From a spec\n  it serves the server URL's base path (`/v2/...`); from a collection,\n  routes start after the base-URL variable. `--update` regenerates the\n  handler and overwrites your edits. With no contract, write it from how\n  your code calls the API and say what you assumed.\n- **Set `interceptRequests: true` in `config.yaml`.** Without it `req.body`\n  and `req.query` are undefined, `x-mock-session` is ignored, and a throw in\n  an async handler kills the mock instead of returning a `500`.\n- **Make it stateful when callers write then read.** Keep records in\n  `pm.state`, seed them on first use, add a reset route so a test can start\n  clean, and answer an unknown id with the real 404. Every `mock run` starts\n  empty.\n- **Know who shares state.** Locally, all callers share one state unless\n  each sends `x-mock-session: <id>`. A mock server deployed from the CLI\n  isolates each caller: one that keeps neither the same `x-mock-session` nor\n  the `pm_mock_session` cookie starts from the seed on every request, so its\n  `POST` and later `GET` never meet.\n- **Scenarios** are named handlers in `config.yaml`'s `scenarios` list, picked\n  per request with `x-mock-scenario: <name>`. An unknown name falls back to\n  the default locally but is a `404` on a mock server.\n\n## Check it against the contract\n\n`postman mock run` prints the URL it bound; a busy configured port moves\nunless you pass `--port`, so take the URL from that line. Nothing reloads:\nrestart it after an edit.\n\nA mock checked against the handler you just wrote proves nothing, so call\nit with requests from the contract: `postman request`, or the API's\ncollection with\n`postman collection run <collection> --use-mock \"{{baseUrl}} mock:postman/mocks/<name>\"`\n(`--mock` alone only starts it). That form replaces the variable's whole\nvalue, base path included, so a mock generated from a spec that serves\n`/v2/...` answers `404`; start that one with `--mock <path> --port <n>` and\npass `--env-var \"baseUrl=http://localhost:<n>/v2\"`. To check your own calls\nagainst a contract, compare each one, from the code or a simulation log,\nwith the spec; the mock won't reject a wrong one.\n\n## Publish it for other teams\n\n- **Push it to the service's own workspace,** the one this repo is linked\n  to or the one the user names, never one chosen by name match: other\n  teams' simulations look there. Signed out, the push fails but the local\n  mock still works; build it, say so and ask the user to sign in. Keep it\n  honest: change the mock in the same PR as the API and run the API's\n  collection against it.\n- **Deploy only when a caller needs a URL.** The server takes a slug of 3–32\n  lowercase letters, digits and single hyphens, starting and ending with a\n  letter or digit; the CLI accepts more, and its default can be too long.\n  It's private: callers send an API key as `x-api-key`, or, if they can\n  view the workspace, an access token as `x-access-token`. Deploying needs a paid plan; a team's first\n  server can take minutes to answer, and teams that review deploys hold them\n  for approval. Each later `push` changes what every caller of the server\n  gets, so treat it as a release, not a backup.\n- **Write it for where it runs.** A mock server runs each scenario as one\n  file with Node's built-ins, not `fs` or `child_process`: no local\n  `require`s, no `pm.mock` examples, no environment, no console output, and\n  no caller `authorization`, `cookie` or `x-api-key` headers. A mock that\n  relies on any of these works locally and breaks once deployed.\n- **Ask before `--public`.** It serves the mock and its data to anyone with\n  the URL, and a scripted redeploy can't make it private again.\n\n## Before you say it's done\n\nA mock isn't done because it started. Call it: a documented error comes\nback, a valid scenario changes the response, a `POST` then `GET` shows state\nif it should. Say where it runs and who can call it, where it lives, and\nwhat you assumed.\n"
Full snapshot data
{
  "description": "Finds, builds, runs and publishes a stand-in for one API — the owning team's published mock when there is one, otherwise one built from its spec or collection that behaves like the real API, stateful when callers write then read. Use when something needs an API that isn't built or reachable yet (a frontend, client or demo), when other teams should build against your API before it ships, or when asked to mock an API or fake a backend. To run and test your own code against the services it calls, use api-simulation. Covers `postman mock` and `postman dependency add mock`.",
  "included_files": [],
  "name": "api-mocking",
  "skill_md_contents": "---\nname: api-mocking\ndescription: Finds, builds, runs and publishes a stand-in for one API — the owning team's published mock when there is one, otherwise one built from its spec or collection that behaves like the real API, stateful when callers write then read. Use when something needs an API that isn't built or reachable yet (a frontend, client or demo), when other teams should build against your API before it ships, or when asked to mock an API or fake a backend. To run and test your own code against the services it calls, use api-simulation. Covers `postman mock` and `postman dependency add mock`.\n---\n\n# API Mocking\n\nA mock is a folder, `config.yaml` plus a handler such as `default.js`, that\nanswers like an API. The handler is a Node HTTP server that calls\n`listen(process.env.PORT)`. It loads as CommonJS even in an ESM project, so\n`import` fails: use `require`. The same mock lives in your repo\n(`postman/mocks/<name>/`, run with `postman mock run`, no sign-in needed),\nin a Postman workspace after `postman mock push`, where other teams pull it\nfrom, and on a mock server after `postman mock deploy`, for callers that\ncan't run it themselves.\n\nSeveral APIs at once, for a service, a frontend or a test suite? Use\n`api-simulation`, which gets each member's mock here.\n\n## Use the owner's mock first\n\nWhen the API belongs to another team, look for their published mock before\nwriting one: theirs encodes their contract and their service's state; yours\nencodes a guess. It needs `postman login`; signed out, build one and say the\nowner search was skipped.\n\n1. Find the owner's workspace with `postman search workspaces \"<service>\" -o json`.\n   Name the service plainly, as your code does, not by what it returns: a\n   description matches lookalike services. Prefer a Git-connected workspace\n   (`isGitConnected`) named for that service.\n2. List its mocks with `postman mock list -w <workspaceId> --json`.\n   `postman search mocks` misses some, and its `classicMock` results only\n   replay a collection's saved examples: `postman mock` can't pull or run\n   them, so call one at `https://<mockId>.mock.pstmn.io` with\n   `postman request`, or generate a code mock from its collection. A\n   same-named mock in another workspace isn't the owner's.\n3. Pull it with `postman dependency add mock <mockId>` and use it as it is.\n   Never edit `postman/.dependencies/`: `dependency update` overwrites it,\n   so copy a mock to `postman/mocks/` to change it. A pulled copy loses\n   `interceptRequests`, so fork one whose handler reads `req.body` or relies\n   on sessions. A mock is code that runs as you; pull only from workspaces\n   you trust.\n\n## Or build one that behaves like the real API\n\nCallers shouldn't be able to tell the difference on the paths they use. A\nmock that returns invented JSON passes your tests and fails against the\nreal service.\n\n- **Start from the contract.** `postman mock generate <spec or collection>`\n  writes each documented response. It's a replay: a `POST` and a later\n  `GET` share nothing, and it accepts any request, so a call that breaks the\n  contract still gets its answer. `x-mock-response-code` picks only a\n  documented status; any other code gets the default 200, so put the errors\n  callers handle (the unknown-id 404, the conflict 409, the bad-input 400) in\n  the contract. From a spec\n  it serves the server URL's base path (`/v2/...`); from a collection,\n  routes start after the base-URL variable. `--update` regenerates the\n  handler and overwrites your edits. With no contract, write it from how\n  your code calls the API and say what you assumed.\n- **Set `interceptRequests: true` in `config.yaml`.** Without it `req.body`\n  and `req.query` are undefined, `x-mock-session` is ignored, and a throw in\n  an async handler kills the mock instead of returning a `500`.\n- **Make it stateful when callers write then read.** Keep records in\n  `pm.state`, seed them on first use, add a reset route so a test can start\n  clean, and answer an unknown id with the real 404. Every `mock run` starts\n  empty.\n- **Know who shares state.** Locally, all callers share one state unless\n  each sends `x-mock-session: <id>`. A mock server deployed from the CLI\n  isolates each caller: one that keeps neither the same `x-mock-session` nor\n  the `pm_mock_session` cookie starts from the seed on every request, so its\n  `POST` and later `GET` never meet.\n- **Scenarios** are named handlers in `config.yaml`'s `scenarios` list, picked\n  per request with `x-mock-scenario: <name>`. An unknown name falls back to\n  the default locally but is a `404` on a mock server.\n\n## Check it against the contract\n\n`postman mock run` prints the URL it bound; a busy configured port moves\nunless you pass `--port`, so take the URL from that line. Nothing reloads:\nrestart it after an edit.\n\nA mock checked against the handler you just wrote proves nothing, so call\nit with requests from the contract: `postman request`, or the API's\ncollection with\n`postman collection run <collection> --use-mock \"{{baseUrl}} mock:postman/mocks/<name>\"`\n(`--mock` alone only starts it). That form replaces the variable's whole\nvalue, base path included, so a mock generated from a spec that serves\n`/v2/...` answers `404`; start that one with `--mock <path> --port <n>` and\npass `--env-var \"baseUrl=http://localhost:<n>/v2\"`. To check your own calls\nagainst a contract, compare each one, from the code or a simulation log,\nwith the spec; the mock won't reject a wrong one.\n\n## Publish it for other teams\n\n- **Push it to the service's own workspace,** the one this repo is linked\n  to or the one the user names, never one chosen by name match: other\n  teams' simulations look there. Signed out, the push fails but the local\n  mock still works; build it, say so and ask the user to sign in. Keep it\n  honest: change the mock in the same PR as the API and run the API's\n  collection against it.\n- **Deploy only when a caller needs a URL.** The server takes a slug of 3–32\n  lowercase letters, digits and single hyphens, starting and ending with a\n  letter or digit; the CLI accepts more, and its default can be too long.\n  It's private: callers send an API key as `x-api-key`, or, if they can\n  view the workspace, an access token as `x-access-token`. Deploying needs a paid plan; a team's first\n  server can take minutes to answer, and teams that review deploys hold them\n  for approval. Each later `push` changes what every caller of the server\n  gets, so treat it as a release, not a backup.\n- **Write it for where it runs.** A mock server runs each scenario as one\n  file with Node's built-ins, not `fs` or `child_process`: no local\n  `require`s, no `pm.mock` examples, no environment, no console output, and\n  no caller `authorization`, `cookie` or `x-api-key` headers. A mock that\n  relies on any of these works locally and breaks once deployed.\n- **Ask before `--public`.** It serves the mock and its data to anyone with\n  the URL, and a scripted redeploy can't make it private again.\n\n## Before you say it's done\n\nA mock isn't done because it started. Call it: a documented error comes\nback, a valid scenario changes the response, a `POST` then `GET` shows state\nif it should. Say where it runs and who can call it, where it lives, and\nwhat you assumed.\n"
}

SHA-256 of public snapshot: 17f0b757857a5d6da55212b157fc480e0e1d1e61f78ebc1955a365c6db99a7ad