> For clean Markdown content of this page, append .md to this URL. For the complete documentation index, see https://learning.postman.com/llms.txt.

# Simulate your API in Postman with a mock server

Postman lets you simulate your API without a real backend using mocks and mock servers:

* **Mocks** use JavaScript request handlers and response logic to return dynamic responses. Use a mock when you need custom behavior, stateful responses, or more control over how requests are handled. You can start a mock locally and send requests to it, or deploy it as a mock server.
* **Mock servers** are deployed to the Postman cloud and are always available to handle requests. You can create a mock server from a mock or from an existing collection.

## Get started with mock servers in Postman

To create a mock, see [Build API mocks with JavaScript](/docs/design-apis/mock-apis/local-mock-servers/).

To create a mock server, you can [create one from a mock or an existing collection](/docs/design-apis/mock-apis/set-up-mock-servers/), or build one from your [request history](/docs/design-apis/mock-apis/set-up-mock-servers/#create-from-history).

After setting up your mock server, you can [make calls](/docs/design-apis/mock-apis/mock-server-calls/) to it 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.

To test how your service responds when multiple dependencies fail at the same time, you can [create and run simulations](/docs/design-apis/simulate-conditions) with Postman Simulator.

Mock servers created from a collection can [generate dynamic responses](/docs/design-apis/mock-apis/create-dynamic-responses/) using variables and templates.

#### [Try free mocking tools — no signup](https://www.postman.com/tools?utm_source=docs\&utm_medium=link\&utm_campaign=signed_out_tools_cta)

Skip the setup and try our free browser tools: [mock every endpoint from an OpenAPI spec at once](https://www.postman.com/tools/mock-from-spec?utm_source=docs\&utm_medium=link\&utm_campaign=signed_out_tools_cta), [spin up a live mock endpoint from a resource template](https://www.postman.com/tools/instant-mock-api?utm_source=docs\&utm_medium=link\&utm_campaign=signed_out_tools_cta), or [paste JSON and get an editable mock endpoint](https://www.postman.com/tools/editable-mock?utm_source=docs\&utm_medium=link\&utm_campaign=signed_out_tools_cta). No account required.

## 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](/docs/design-apis/mock-apis/tutorials/mock-with-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](/docs/design-apis/mock-apis/tutorials/mock-with-api/). You'll learn how to use the [Postman API](/docs/reference/postman-api/intro-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](/docs/design-apis/mock-apis/matching-algorithm/) and learn how to create examples so you always get the responses you expect from the mock server.