*** title: Mock server commands approved: 2026-03-16T00:00:00.000Z topictype: reference slug: docs/postman-cli/postman-cli-mock max-toc-depth: 2 ---------------- This topic covers mock server commands for the [Postman CLI](/docs/postman-cli/postman-cli-overview/). ## `postman mock run` You can use the `postman mock run` command to start a mock server from a configuration file. To run a collection against a mock server, use the `--mock` option with the [`postman collection run` command](/docs/postman-cli/postman-cli-collections/#postman-collection-run). This command starts a mock server from a configuration file in JSON format. With the configuration file, you can configure details like the mock server's port number, name, script, and more. The mock server runs on the specified port until you stop it. Make sure you also have a JavaScript file with an HTTP server that sets the request and example response for simulating real API behavior. Add the command to your CI/CD script to start a mock server as a dependency for your application or test suite. Once running, your service or external tests can send requests to it as if it were a real API. This enables you to simulate API behavior for testing and development. Learn how to [create a mock server in your Git repository](/docs/design-apis/mock-apis/local-mock-servers). ### Usage ```bash postman mock run ``` The path to the mock server configuration file in JSON format. ### Example ```bash postman mock run mock-config.json ``` Learn more at [Mock APIs](/docs/design-apis/mock-apis/mocking-intro/).