Setting up a mock server

Mock Servers in Postman let you simulate APIs. You can create mock servers from the Postman app, from the web dasboard and using the Postman API. You will need a Postman account to set up a mock server.

Mocks in Postman are tied to a collection. Postman matches requests and generates responses for mocks from the Examples in the requests of a collection. You can create a mock server even if you don't have an existing collection.


You can create a mock in several ways in the Postman app:

New button

The video below runs you through the step of creating a mock server from the "New" button in the Postman app.

Mock creation flow using New button

Here are the steps you need to follow:

Start by clicking the New button

In the header toolbar, click the New button. It is located in the top-left of the Postman app. Click "Mock Server" in the "Create New" tab.

Choose "Mock Server" from the dialog box

Select if you want to mock a new API or an existing collection. If you create a new API to mock, you have to select a request method and enter the request path, response code, and response body. If you use an existing collection to mock, you must select a collection from a list of existing or team collections.

Set request path and response body

After you select or create the request you want to mock, click the Next button.

In the "Set up the mock server" tab, you can fill in mock server specific information:

Set mock server configuration

  1. Enter the name of the mock
  2. Select an environment (optional)
  3. Select the checkbox if you want to make the mock server private
  4. Select the checkbox if you want to save the mock server URL as an environment variable
  5. Click "Next" to continue

Note: The number of calls made to mock servers may be limited by your Postman account. Check your usage limits.

In the Next steps tab, see a list of suggested next steps to maximize the effectiveness of your mock server.

Next steps after mock is created

Launch screen

The "Create New" tab appears by default when you launch Postman.

Open the Postman app.

In the "Create New" tab, click "Mock Server".

Follow the steps in the previous section.

Note: At the bottom, you can select "Show this window at launch" to indicate whether you want the Create New tab to display each time you open Postman.

In web dashboard

You can create a mock server from the Web dashboard with existing collections and environments. To do that, login to your Postman team dashboard, navigate to your workspace by clicking on your workspace name. In the workspace dashboard, click on the "Mock servers" tab.

Mock servers web dashboard

Click on the button to create new mock server, and you will see the mock server configuration screen. Set the relevant configuration.

Mock servers web dashboard configuration

  1. Enter the name of the mock
  2. Select a collection to mock
  3. Select a version tag of the collection to use for the mock. Leave it to "CURRENT" if you want to the mock server to use the latest version of your collection
  4. Select an environment to use with the mock (optional)
  5. Select the checkbox if you want to make the mock server private
  6. Click "Create Mock Server" to create the mock and go back to the "Mock servers" dashboard

Using HTTP access control for a mock

In addition to using the Postman app to make requests to mock endpoints, you also can make those requests in a browser.

A web browser makes a cross-origin HTTP request when it requests a resource from a domain, protocol, or port that's different from its own.

Cross-Origin Resource Sharing (CORS) is a standard that defines a way in which a browser and server can interact securely. In this case, we are referring to how a web browser interacts with the mock endpoints hosted on the Postman server.

CORS is enabled for Postman mock servers. As a result, you can stub your web apps with mocked data using the mock endpoints. So development or production web apps can make requests to the Postman mock endpoint you just created and receive an example response.

Using free mock server calls

Your Postman account gives you a limited number of free mock server calls per month.

You can check your usage limits in the Postman API or in the account usage page.

Editing Mock Servers

You can edit existing Mock Servers in Postman since version 7.7.0. These are the properties of a Mock Server that can be updated through the Postman app and web dashboard:

  • Name of the Mock Server
  • Version tag of the underlying collection
  • Environment associated with the Mock Server
  • Make the Mock Server private or public

Postman Mock Server edit options

There are three ways you can edit a mock server. You can either edit a Mock Server from the Collection pane, through the Mock Server listing in Browse mode, or through the web dashboard of your Workspace's Mock Servers section.

Editing Mocks in Build mode:

Postman Mock Server edit in Build mode

Editing Mocks in Browse mode:

Postman Mock Server edit in Browse mode

Editing Mocks from the Web Dashboard:

Postman Mock Server edit in Build mode

Further reading

For more information about mock servers, see: