# API mocking

> API mocking is an open-source agent skill for developer tools. Finds, builds or pulls a stand-in API for frontends, clients and tests. It is available on Claude Code.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code
- **Website:** https://github.com/postmanlabs/postman-plugin/tree/main/agent-plugin/skills/api-mocking
- **Repository:** https://github.com/postmanlabs/postman-plugin
- **GitHub stars:** 49
- **License:** Apache-2.0
- **Skill name:** api-mocking
- **Collection:** https://github.com/postmanlabs/postman-plugin
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-12-03

## About

This skill helps an agent produce a stand-in for an API that is not built or reachable yet. It first looks for a published mock from the API's owner or a verified publisher, since a maintained mock reflects the real contract and state. If none exists, it builds a local mock folder with a Node handler, generated from a spec or collection, or written from how the calling code uses the API.

The workflow covers pulling a mock as a dependency, running it locally with the Postman CLI, optionally backing responses with real records from a dataset, and keeping write-then-read behavior in state. It also explains how to test the mock against the contract with requests or a collection run, and how to publish a mock to a workspace or deploy it to a mock server for other teams.

It expects the Postman CLI, and a signed-in account for searching, pushing, deploying and dataset-backed generation. Handlers are written in Node.js using CommonJS.

## When your agent uses it

> 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. Finds, builds, runs and publishes a stand-in for one API — a published mock when its owner or a verified publisher has one, otherwise one built from its spec or collection, stateful when callers write then read, answering with real records from a sheet or database. To run your own code against the services it calls, use postman:api-simulation. Covers `postman mock` and `postman dependency add mock`.

## What it can access

From a static check of the files on GitHub; nothing was run.

- [Instructions only, no scripts](https://github.com/postmanlabs/postman-plugin/tree/HEAD/agent-plugin/skills/api-mocking)
- [License: Apache-2.0](https://github.com/postmanlabs/postman-plugin/tree/HEAD/agent-plugin/skills/api-mocking)

## Features

- **Published mock lookup:** Searches workspaces and mock listings for an existing maintained mock before writing a new one.
- **Contract-based generation:** Generates a mock handler from an API spec or collection, with documented responses.
- **Dataset-backed answers:** Lets the handler query real records from a dataset instead of hand-written JSON.
- **Stateful responses:** Keeps records in state so writes can be read back, with a reset route for tests.
- **Contract verification:** Runs requests or a collection against the mock to check documented responses and scenarios.
- **Workspace publishing:** Pushes mocks to a Postman workspace and deploys them to a mock server for callers.

## Good for

- Build a mock API so a frontend can develop before the backend ships
- Find and pull a published mock for a third-party payment or email API
- Generate a mock handler from an OpenAPI spec
- Make a demo backend that stores and returns records between requests
- Publish a mock to the team workspace so other teams can build against it

## Install

### Claude Code

This skill ships in the `postman` plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):

```sh
/plugin marketplace add postmanlabs/postman-plugin
/plugin install postman@postman
```

Or copy only this skill to `~/.claude/skills/api-mocking`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/postmanlabs/postman-plugin.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/api-mocking &&
cp -R "$tmp/agent-plugin/skills/api-mocking" ~/.claude/skills/api-mocking &&
rm -rf "$tmp"
```

For one project only, put the folder in `.claude/skills/api-mocking` inside it instead.

### Codex

Copy the skill folder to `~/.agents/skills/api-mocking` to use it in every repository:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/postmanlabs/postman-plugin.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/api-mocking &&
cp -R "$tmp/agent-plugin/skills/api-mocking" ~/.agents/skills/api-mocking &&
rm -rf "$tmp"
```

For one repository only, put the folder in `.agents/skills/api-mocking` inside it instead.

### Cursor

Copy the skill folder to `~/.cursor/skills/api-mocking` to use it in every project:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/postmanlabs/postman-plugin.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/api-mocking &&
cp -R "$tmp/agent-plugin/skills/api-mocking" ~/.cursor/skills/api-mocking &&
rm -rf "$tmp"
```

For one project only, put the folder in `.cursor/skills/api-mocking` inside it instead.

### Gemini CLI

Run in a terminal (add `--scope workspace` to install it for the current workspace only):

```sh
gemini skills install https://github.com/postmanlabs/postman-plugin.git --path agent-plugin/skills/api-mocking
```

Or copy the folder to `~/.gemini/skills/api-mocking` yourself.

### VS Code

For GitHub Copilot in VS Code, copy the skill folder to `~/.copilot/skills/api-mocking`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/postmanlabs/postman-plugin.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/api-mocking &&
cp -R "$tmp/agent-plugin/skills/api-mocking" ~/.copilot/skills/api-mocking &&
rm -rf "$tmp"
```

For one project only, put the folder in `.github/skills/api-mocking` inside it instead.

### Other agents

Get the folder:

```sh
git clone --depth 1 https://github.com/postmanlabs/postman-plugin.git
```

Then copy `postman-plugin/agent-plugin/skills/api-mocking` into your agent's skills folder as `api-mocking`. Agents that support SKILL.md read one folder per skill.

## FAQ

### Do I need a Postman account to use API mocking?

Searching for published mocks, pushing, deploying and dataset-backed generation need a signed-in CLI. Running a local mock from your repo works without signing in, and file-based datasets also work signed out.

### Where does the mock live?

A mock is a folder with config.yaml and a handler such as default.js, kept in postman/mocks/<name>/ in your repo. It can also be pushed to a Postman workspace or deployed to a mock server.

### Which Node module syntax does the handler use?

The handler loads as CommonJS, so it should use require rather than import, even in an ESM project.

### Can I edit a mock pulled from another team?

Do not edit postman/.dependencies/, since dependency update overwrites it. Copy the mock to postman/mocks/ to make changes.

### How do I install API mocking in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/api-mocking to use it in all your projects, or to .claude/skills/api-mocking in one project. Or install the postman plugin, which includes it: /plugin marketplace add postmanlabs/postman-plugin, then /plugin install postman@postman.

### Does API mocking run scripts?

No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

### Which AI agents can use API mocking?

Claude Code. It reads skills in the SKILL.md format; the install steps on this page show where to put the folder.

### What are the best alternatives to API mocking?

The closest alternatives to API mocking are API discovery, API testing, API simulation, API mock helper and API documentation.

## Where this comes from

- Description: from the skill's own SKILL.md.

## Alternatives

- [API discovery](https://ai-powered.com/skills/api-discovery): API discovery is an open-source agent skill for developer tools.
- [API testing](https://ai-powered.com/skills/api-testing): API testing is an open-source agent skill for developer tools.
- [API simulation](https://ai-powered.com/skills/api-simulation): API simulation is an open-source agent skill for developer tools.
- [API mock helper](https://ai-powered.com/skills/api-mock-helper): API mock helper is an open-source agent skill for developer tools.
- [API documentation](https://ai-powered.com/skills/api-documentation-postmanlabs): API documentation is an open-source agent skill for developer tools.
- [API engineer](https://ai-powered.com/skills/api-engineer): API engineer is an open-source agent skill for legal and government.
- [API to testcase generator](https://ai-powered.com/skills/api-to-testcase-generator): API to testcase generator is an open-source agent skill for developer tools.
- [API monitoring](https://ai-powered.com/skills/api-monitoring): API monitoring is an open-source agent skill for developer tools.

---
Source: https://ai-powered.com/skills/api-mocking
