How to create mock servers using Postman 

Updated 16 July 2025

Save

In this blog, we will learn how to create mock servers using Postman.

Introduction

Mock servers simulate real API responses so developers can test without a live backend. Postman simplifies creating and managing mock APIs for efficient testing and collaboration.

banner image

Why Use Mock Servers

  1. Enable parallel development by allowing frontend and backend teams to work independently.
  2. Help test API responses before the actual backend is ready — simply set up a mock server.
  3. Simulate different scenarios like success, failure, or timeout responses.
  4. Save time by eliminating the need to wait for real APIs.
  5. Allow testing of edge cases that are hard to reproduce in live environments.
  6. Improve collaboration and communication between teams.
  7. Support faster prototyping and iterative development.

Creating a Mock API And Mock Server in Postman

1. Open Postman and Navigate to Mock Servers

Launch the Postman application on your computer. From the left sidebar, click on the Mock Servers tab.

1

2. Start Creating a New Mock Server

Click on the “Create Mock Server” button or the “+” icon next to the Collections tab to begin setting up a new mock server.

2

3. Create a Mock Request

To create a mock request, set the following:

  1. Method: Choose GET, POST, PUT, or DELETE.
  2. Request URL: Enter the endpoint path, e.g., api/users/123.
  3. Response Code: Choose a suitable HTTP code (e.g., 200 for success).
  4. Response Body: Paste a sample JSON response.

Click Next to proceed.

3

4. Configure the Mock Server

In the configuration section:

  1. Mock Server Name: Set it to something like “Mock Users API”, or choose your own name.
  2. Save as Environment Variable: Check this to save the mock server URL for reuse.
  3. Click “Create Mock Server” at the bottom right to finish the setup.

Additional Options:

  1. Environment: Use environments to manage variables like base URLs or tokens.
  2. Make Mock Server Private: Enable this to secure your mock API with authentication.
  3. Simulate Fixed Network Delay: Use this to test how your app handles network latency or slow responses.

4

5. Test the Mock Request

Go to the Collections tab in the left sidebar, open the mock API collection you created, and select the api/users/123 request.

5

Click the Send button in the top right corner of Postman to view the sample JSON response from your mock server.

6

Conclusion

Mock servers in Postman simplify API testing and development by simulating real endpoints. They help teams work faster and more efficiently without waiting for the backend.

Thanks for reading this blog.

Please check my other blogs here.

 

 

author
. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


Be the first to comment.

Start a Project


    success

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home