All-in-one Collaborative API Development Platform

API Design

API Documentation

API Designing

API Mock

API Automated Testing

Sign up for free
Home / Tutorials / Postman Tutorial: How to Create A Mock Server in Postman

Postman Tutorial: How to Create A Mock Server in Postman

This guide will walk you through setting up mock servers and show you how to create a mock server on Postman.

What is Postman

Postman is a popular API tool that simplifies developing, testing, and managing APIs. It offers an intuitive interface where developers can send HTTP requests, view responses, and automate testing scenarios. Postman supports RESTful and GraphQL APIs and provides collaborative features for team-based projects, making API development more streamlined and efficient. Its wide range of features also includes saving environments, managing version control, and generating API documentation.

What is A Mock Server in Postman

As you embark on the journey of designing, building, and testing APIs, one tool shines brightly in the constellation of Mock Servers - Postman. Hailed as a versatile powerhouse in the API cosmos, Postman's Mock Server forms the very core of numerous application ecosystems.

The Postman Mock Server, a cornerstone of Postman's toolset, has become a sought-after companion for developers worldwide. It fuels streamlined testing, rapid prototyping, and unhindered parallel development by simulating the behavior of an actual server.

Key Features of Postman's Mock Server

Postman's Mock Server showcases a formidable set of features that harmonize to form a smooth and efficient API development journey.

Seamless Setup: Postman's Mock Server is as intuitive as possible. With a few clicks, your mock server is up and running, primed for your API calls.

Dynamic Responses: Craft responses dynamically using JavaScript in the pre-request script. Add logic and manipulate responses based on incoming requests, offering a playground to prototype virtually any API scenario.

API Evolution Support: It promotes a contract-first approach, allowing developers to design, mock, and test APIs before developing. This encourages a robust, error-free, and evolutionary API design process.

Collaborative Platform: Postman's Mock Server goes beyond an individual's workspace. It encourages team collaboration, allowing you to share your mock servers with your team for seamless parallel development.

Multiple Mock Examples: The ability to generate multiple mock examples for the same endpoint is remarkable. This flexibility lets developers test different scenarios and responses, fortifying the API's resilience to varying requests.

How to Create A Mock Server in Postman

This guide will walk you through setting up mock servers on Postman. A mock server simulates the behavior of a real API server by accepting requests and returning responses. It can be a powerful tool in your development process, especially for testing.

Setting Up a Mock Server

  • Create Request: In Postman, create and save a request to any API in a collection.
  • Save Response: After sending the request, save the response as an example.
Create Request
  • Create Mock Server:

Click on the three dots next to your collection in the sidebar and select "Mock collection." Assign a name to your mock server and click "Create Mock Server."

Create Mock Server
  • Replace URL: Copy the mock URL provided by Postman and replace the original base URL of your saved request with it.
Replace URL
  • Test Mock Server: Click the "Send" button. Postman will return the example response you saved, this time from the mock server.
Test Mock Server

Configuring Mock Server Details

  • Naming: Name your new mock server.
  • Delay Configuration: You can configure a delay before the mock server sends responses to simulate network delays.
  • Privacy Setting: To make your mock server private, add a Postman API key in the request header when sending requests to the mock server.
Configuring Mock Server Details

Limitations of Postman’s Mock Server

While Postman's Mock Server is a stalwart in the API development landscape, it is full of challenges. For instance, beginners may face a steep learning curve due to its extensive and rich feature set. This can pose a hurdle for those seeking a lightweight and super-intuitive platform.

Moreover, while its dynamism is a strength, managing multiple versions of APIs with different responses can become complex and cumbersome. And while it does provide collaboration options, large teams might need help with version control and maintaining the uniformity of the mock server setup across multiple workspaces.

Postman's Mock Server offers unparalleled features and flexibility despite these potential challenges. It’s essential to recognize and address these limitations to leverage the full power of this extraordinary tool and stride confidently in your API development journey.

What is Apidog

Apidog is a comprehensive platform designed to streamline the entire API lifecycle, from design to development and testing. It aids Research & Development teams in applying the best practices for API Design-first development.

The platform offers a visual editor for API design, supports automated testing, generates visually appealing API documentation, and provides a smart mock server. Apidog encourages seamless collaboration within teams and is adaptable to various API protocols and database systems. It also facilitates effortless synchronization of API specifications and modifications, ensuring consistency across the API lifecycle.

Introduction to Apidog's Mock Server:

The contemporary API development and testing world has seen a thrilling addition - Apidog's Mock Server. A remarkable blend of simplicity, versatility, and efficiency, Apidog is the fresh catalyst poised to revolutionize the API design, development, and testing paradigm.

Apidog's Mock Server is designed with the modern developer in mind, effortlessly bridging the gap between conceptualization and realization. It has swiftly emerged as a robust tool, equipping developers to create, run, and manage APIs easily and conveniently.

Apidog's Mock Server:

Apidog's Mock Server introduces unique and user-friendly features that firmly establish its presence in the API development domain. Here's a detailed exploration of what sets Apidog apart:

Zero-Configuration Mock Data: One of Apidog’s standout features is its zero-configuration mock data generation. By interpreting the data structure and data type in the API definition, Apidog can automatically generate mock rules, producing highly efficient, user-friendly mock data. If a field contains certain keywords such as "image," "time," or "city," Apidog smartly populates this field with appropriate mock data. The automation and efficiency of this process significantly reduce the manual configuration effort, making it a prime feature of Apidog's Mock Server.

Local vs. Cloud Services: Apidog's Mock Server provides the flexibility to choose between local and cloud mock services. The local mock service is beneficial when using the Apidog desktop app, providing quick access and easy testing in a local development environment. On the other hand, the mock cloud service is essential for remote work or collaborative scenarios, enabling developers to access the mock server from anywhere.

Custom Mock Rules: Apidog's Mock Server supports custom mock rules to accommodate various personalized needs. Developers can define their own mock rules in the data structure definition and use advanced settings for data fields. This powerful feature gives developers control over their API mock responses and allows them to simulate complex scenarios more accurately.

Smart Mock: The Smart Mock feature is an automated solution for generating realistic mock data. The system automatically generates the mock data if mock rules for fields in the return response are not provided.

Step-by-Step Guide to Creating Mock Servers in Apidog

Navigating through the feature-rich Apidog platform may seem overwhelming at first. Here's a comprehensive step-by-step guide on using Apidog's Mock Server to make your experience smoother.

Step 1: Sign up for Free

You can Register an account on the Apidog or sign up for free. After confirming your registration via email, log in to start.

Step 2: Create A New API and Configuration it

Click on the "New API" button to enter your API URL or create a new request by clicking the "+" button.

Create A New API
New Request

Step 3: Set Up Mock Server

Go to "Mock" in your project dashboard. This section presents you with two options - Local Mock and Cloud Mock. These options correspond to where your mock server will be hosted.

Set Up Mock Server

Local Mock Server

The Local Mock Server allows you to run and test APIs directly on your local machine, making it an excellent option for developers in a secured, offline environment. To set this up, click "Set Up Local Server" and follow the prompts after clicking “Request”. This setup process involves copying a locally-hosted URL provided by Apidog and using it as your base URL for testing your APIs.

Local Mock Server

Optional: Cloud-Based Mock Server

Apidog also provides a Cloud-Based Mock Server for developers who prefer to run and test their APIs over the Internet. This feature is particularly useful for remote teams or developers who need to share their work with clients or colleagues elsewhere. To activate this, click on "Cloud Mock." Like the Local Mock Server, you'll be provided with a cloud-hosted URL which you will use as your base URL for testing.

Cloud-Based Mock Server

Step 4: Send Your API for Mocking

Send your API for Mocking, append the specific API route, and run the test.

Send Your API for Mocking

Apidog's Mock Server can generate user-friendly dummy data even without set rules due to its Smart Mock feature. The platform thus provides an efficient way for API development and testing.

Apidog's Advantages Over Postman’s Mock Server

While Postman’s Mock Server is undoubtedly a powerful tool, Apidog presents several unique selling points. The zero-configuration mock data generation is a clear standout, providing user-friendly data without requiring detailed configuration.
The Mock feature enables the generation of mock data based on interface/data structure definitions, mock rule configurations, and mock expectation settings. Users can easily generate various mock data according to their specific needs without complex configurations. This feature provides a highly flexible and user-friendly way to construct mock data.

Moreover, switching between local and cloud mock services offers flexibility to adapt to various work setups. Custom mock rules give developers greater control over their mock data, enabling more precise and realistic simulations. Additionally, Apidog's approach to mock rule prioritization ensures the most relevant data is used.


As we unravel the capabilities of Apidog’s Mock Server, it becomes evident that it is a potent tool for API development. By offering unique, user-centric features and providing flexible solutions to common problems, Apidog proves to be a commendable alternative to Postman’s Mock Server. As API development continues to evolve, tools like Apidog will undoubtedly play a pivotal role in shaping its future.

Join Apidog's Newsletter

Subscribe to stay updated and receive the latest viewpoints anytime.