Create and use mock servers for API testing or development in Postman
Last Updated :
24 Apr, 2025
Postman, a comprehensive API platform, includes a robust API client for exploring, testing and defining requests. Its notable feature is the ability to create mock servers, simulating API responses for testing and development purposes. Developers can organize requests in collections, generate mock servers, and customize settings to mimic desired API behavior. This functionality proves invaluable when testing against realistic responses in the absence of a fully developed or available API.
Prerequisites
What is a mock-server:
Mock server serves as a simulated or pseudo server that mimics authentic server behavior. They return controlled responses to requests, letting you design and create JSON API responses without writing a single line of code.
Let use assume that you are working as front-end developer in a large team that is tasked with building a web application that relies on a back-end API to fetch data. However, the back-end development is still in progress, and the API endpoints are not available yet. To avoid delays in front-end development, you decide to use a mock server in Postman.
Steps to Create and Use mock server using Postman API
Step 1: Open the postman application on your computer then click on the mock servers tab on the left side navigation bar.

Step 2: To create a new mock server, click on the create mock server or the plus symbol beside the collections tab.

Step 3: Create mock request:
To create a sample mock request, you’ll need to understand the following concept:
- Request Method: This dropwown allows you to select our prefared http methods. example: GET, POST, PUT, DELETE
- Request URL: This is used to specify the exact route in our mock endpoints.
- Response Code: http response codes ranging from 100 to 599 can be used depending on our desired response
- Response Body: This input field is used to pass a sample json response

Now that you have understood the above concept, We are going to modify the input fields. for the purpose of this article, we will create a mock api to get the list of users in our application.
Start by setting the request url input field to users. Next copy JSON response below and paste in the response body. Then click next to continue.
JavaScript
[{
"id" : 1,
"name" : "Leanne Graham",
"username" : "Bret",
"email" : "[email protected]",
"address" : {
"street" : "Kulas Light",
"suite" : "Apt. 556",
"city" : "Gwenborough",
"zipcode" : "92998-3874",
"geo" : { "lat" : "-37.3159", "lng" : "81.1496" }
},
"phone" : "1-770-736-8031 x56442",
"website" : "hildegard.org",
"company" : {
"name" : "Romaguera-Crona",
"catchPhrase" :
"Multi-layered client-server neural-net",
"bs" : "harness real-time e-markets"
}
},
{
"id" : 2,
"name" : "Ervin Howell",
"username" : "Antonette",
"email" : "[email protected]",
"address" : {
"street" : "Victor Plains",
"suite" : "Suite 879",
"city" : "Wisokyburgh",
"zipcode" : "90566-7771",
"geo" : { "lat" : "-43.9509", "lng" : "-34.4618" }
},
"phone" : "010-692-6593 x09125",
"website" : "anastasia.net",
"company" : {
"name" : "Deckow-Crist",
"catchPhrase" : "Proactive didactic contingency",
"bs" : "synergize scalable supply-chains"
}
},
{
"id" : 3,
"name" : "Clementine Bauch",
"username" : "Samantha",
"email" : "[email protected]",
"address" : {
"street" : "Douglas Extension",
"suite" : "Suite 847",
"city" : "McKenziehaven",
"zipcode" : "59590-4157",
"geo" : { "lat" : "-68.6102", "lng" : "-47.0653" }
},
"phone" : "1-463-123-4447",
"website" : "ramiro.info",
"company" : {
"name" : "Romaguera-Jacobson",
"catchPhrase" :
"Face to face bifurcated interface",
"bs" : "e-enable strategic applications"
}
}
]
Step 4: Mock server configuration:
Within the configuration tab, we are going to set the mock server name to mock users api. You can set it to your preffared name. next, select the Save the mock server URL as an environment variable checkbox. now that you have completed the configuration, click on the create mock server button on your bottom right. before proceeding to the next step, let us understand some important concept in the configuration.
- Environment: Environments help manage variables like URLs or tokens.
- Make mock server private: is used when you want to make your mock api secure by adding authentication
- Simulate fixed network delay: this feature for testing how your application behaves under different network conditions. It allows you to identify potential issues related to network latency and ensure that your application handles delays appropriately.

Step 5: Test mock request:
Navigate to the collections tab on the left side of the navigation bar, then click on the mock server api collection which we created and select users.

Next, click on the send button on the top right hand of your postman to see sample JSON request.

Similar Reads
What are the key benefits of using Postman for API development?
Postman is an API(application programming interface) development tool that helps to build, test and modify APIs. In this tutorial, we will see what are the key benefits of using Postman for API development?Table of ContentWhat is API?Benefits of PostmanSteps to use Postman for API developmentPrerequ
3 min read
Use of data files (CSV, JSON) in Postman for data-driven testing
It is a software testing method having all test input data stored or documented in a single CSV/JSON file and using a single test script for testing the API request with various input scenarios. It separates the test script logic from the test data. In Postman, we can perform this using variables an
2 min read
How to create mock servers using Postman
Postman is a comprehensive API platform used by developers; this platform provides a set of tools that support API design, testing, documentation, mocking, and API Monitoring. It also simplifies each step of the API lifecycle and streamlines collaboration, enabling developers to create and use APIs
7 min read
How to create and write tests for API requests in Postman?
Postman is an API(utility programming interface) development device that enables to construct, take a look at and alter APIs. It could make numerous varieties of HTTP requests(GET, POST, PUT, PATCH), store environments for later use, and convert the API to code for various languages(like JavaScript,
3 min read
Create and Send API Requests in Postman
Postman serves as a flexible tool, simplifying the system of crafting and checking out API requests. In the world of software, APIs(Application Programming Interfaces) are the constructing blocks for packages to speak with each other. In this article, you will find out how Postman turns into your go
4 min read
Introduction to Postman for API Development
Postman: Postman is an API(application programming interface) development tool that helps to build, test and modify APIs. Almost any functionality that could be needed by any developer is encapsulated in this tool. It is used by over 5 million developers every month to make their API development eas
7 min read
Role of Postman in the API development lifecycle.
Postman is an API(application programming interface) development tool which helps to build, test, and modify APIs. Almost any functionality that could be needed by any developer is provided by this tool. It can make various types of HTTP requests(GET, POST, PUT, PATCH). In this article, we will expl
4 min read
Postman vs. Rest Assured for API Testing
API testing is an essential aspect of modern software development, ensuring that the Application Programming Interfaces (APIs) function as expected and deliver accurate responses to various requests. To conduct effective API testing, developers and testers often rely on specialized tools like Postma
5 min read
How to use postman for testing express application
Testing an Express app is very important to ensure its capability and reliability in different use cases. There are many options available like Thunder client, PAW, etc but we will use Postman here for the testing of the Express application. It provides a great user interface and numerous tools whic
3 min read
How to create and send GET requests in Postman?
Postman is an API(application programming interface) development tool which helps to build, test and modify APIs. It has the ability to make various types of HTTP requests(GET, POST, PUT, PATCH), saving environments for later use, converting the API to code for various languages(like JavaScript, Pyt
1 min read