How to create a mock server in Postman?


We can create a Mock Server in Postman. A Mock Server is used to simulate the working of an actual server to test APIs and Responses. These are very common if certain APIs require to be tested but they are presently unavailable on the web servers due to security concerns on the real server.

The steps to create a Mock Server are listed below -

Step 1 − Click on New from the top of the Postman application. Then click on the Mock Server link.

Step 2 − Choose the option GET from the Method field, add a Request Path as /user/home, enter 200 in the Response Code field and the text- This is Postman Tutori in Tutorialspoint in the Response Body. Finally, click on the Next button.

Step 3 − Provide a Mock Server name, then click on Create Mock Server.

Step 4 − A Mock Server is generated having a Mock URL. Also, the button Copy Mock URL is provided to copy the Mock link. Click on Close.

Step 5 − Choose the option Mock Server as the Environment from the right upper corner of the screen. Then click on Send. In the below image, we find that the Response code is 200 OK and body is - This is Postman Tutorial in Tutorialspoint(which is the same as the Response Body we sent in Step2).

Step 6 − The value of variable url can be obtained by clicking on the eye icon available to the right upper corner of the Postman application.

Thus the request Mock URL is This is because of the format {{url}}/user/home we have added at the end of the variable url in the Request Path field in Step2.

Updated on 03-Aug-2021 13:16:29