Archived topic — some details may be out of date.
Mock servers built from saved collection examples are still supported. Postman now also has code-based mocks: JavaScript request handlers plus aconfig.yaml, stored as files in your Git repository, which you can run locally or deploy. Create one in the app, or use the Postman CLI to generate one from an OpenAPI spec, collection or dataset (postman mock generate) and run it (postman mock run). See About mocks and Create a mock.
Working with an AI coding agent? The Postman plugin can build and run mocks for you.
For current help, see the Postman docs, try the free Postman tools (no account needed), or join us on Discord.
I’ve just completed the Bootcamp tutorial, Designing and mocking APIs > Design an API in a minute.
I’m confused about where I add mock responses to an existing collection.
These are the steps I followed:
I create a New > Mock Server. I’m provided with a table to create a collection of requests and responses:
Enter request paths for your API endpoints and then the expected response code and response body to create an example.
I create two items:
- Method:
GET
Request Path:hello
Response Code:200
Response Body:Hello world - Method:
GET
Request Path:goodbye
Response Code:200
Response Body:Goodbye, cruel world
After clicking Next I name the mock server: Hello and Goodbye. Then I click Create Mock Server and finally Close the modal.
My Collection now correctly appears with two GET requests: hello and goodbye.
In the Environment dropdown at the top right of the UI, I choose Hello and Goodbye.
Now I can select one of the GET requests in my collection and Send it, and the response is as expected/mocked.
Now. When I click on the Examples dropdown, there is Default and Add Example. This is confusing as I added two examples when I created my mock server. But these two examples only appear in my (request) collection.
So I now want to add a third request to my collection. I click on the ··· menu and click Add Request. I only have access to the Request name here, so I name it hellohello and save it to my collection.
When I select the new request in the collection, all of the fields are blank. I set the method to GET and the URL to {{url}}/hellohello. But where do I set the mock response?






