Simulate your API in Postman with a mock server

Use a mock server to simulate your API without having to configure a real API server. You can use any HTTP collection to set up a mock server. When you send a request to the mock server, Postman returns a real-world response using data from your collection.

Get started with mock servers in Postman

Before you set up a new mock server, create a collection with the HTTP requests you want to mock, then add saved examples to each request. The examples have the data you want the mock server to return in response to each request.

You can only add mock servers to HTTP collections.

Once you have your collection, you're ready to create a new mock server. You can then make calls to the mock server from Postman or from a client application. The mock server simulates your API's behavior, so you can test your API or develop new functionality before your API is production ready.

If needed, the mock server can generate dynamic responses using variables and templates, to better simulate real-world behavior.

Level up with step-by-step guides

If you need more help setting up a mock server, follow the step-by-step guide to mock your API using saved response examples. You'll learn how to add requests and examples to your collection, then use the collection to configure and use a mock server.

If you want to automate your mock servers, follow the step-by-step guide to set up mock servers using the Postman API. You'll learn how to use the Postman API to mock a collection and get the mock server URL.

Learn how Postman mock servers work

When you send a request to a mock server, Postman uses an algorithm to choose the saved example that best matches the request. The mock server then returns a response using the data in the saved example.

Dive deeper into the matching algorithm and learn how to create examples so you always get the responses you expect from the mock server.

Last modified: 2024/10/18