- Installation and updates
- Sending your first request
- Navigating Postman
- New button
- Creating the first collection
- Postman account
- Keyboard Shortcuts
- Troubleshooting In-app Issues
- Authorizing requests
- Working with Tabs
- Visualize API responses
- Validating Requests Against Schema
- Generate code snippets
- Using GraphQL
- Making SOAP requests
- Capturing HTTP requests
- Debugging and logs
- Troubleshooting API requests
- Intro to collections
- Creating collections
- Sharing collections
- Commenting on collections
- Managing collections
- Version Control for Collections
- Using Markdown for descriptions
- Data formats
- Working with OpenAPI
- Collaborating in Postman
- Roles and permissions
- Managing your team
- Requesting access
- Team Settings
- Audit logs
- Intro to scripts
- Pre-request scripts
- Test scripts
- Test examples
- Branching and looping
- Postman Sandbox API reference
- Intro to collection runs
- Starting a collection run
- Using environments in collection runs
- Building workflows
- Running multiple iterations
- Sharing collection runs
- Working with data files
- Debugging a collection run
- Command line integration with Newman
- Integration with Jenkins
- Integration with Travis CI
- Newman with Docker
- Documenting your API
- Authoring your documentation
- Publishing your docs
- Viewing documentation
- Custom documentation domains
- Intro to mock servers
- Setting up a mock server
- Mocking with examples
- Mocking with the Postman API
- Matching algorithm
- Intro to Monitoring
- Setting up a monitor
- Viewing monitor results
- Monitoring APIs and websites
- Set up integrations to receive alerts
- Running Postman monitors using static IPs
- Troubleshooting monitors
- FAQs for monitors
- Intro to Workspaces
- Creating Workspaces
- Using Workspaces
- Managing Workspaces
- Viewing changelogs and restoring collections
- The API Workflow
- Managing and Sharing APIs
- Versioning APIs
- Viewing and analyzing APIs
- Validating Elements Against Schema
- Customizing Postman
- Find and Replace
- Purchasing Postman
- Intro to SSO
- Configuring SSO for a team
- Logging in to an SSO team
- Configuring Microsoft AD FS with Postman SSO
- Setting a custom SAML in Azure AD
- Setting up custom SAML in Duo
- Setting up custom SAML in GSuite
- Setting up custom SAML in Okta
- Setting up custom SAML in Onelogin
- Setting up custom SAML in Ping Identity
- Intro to Integrations
- Custom Webhooks
- Microsoft Flow
- Microsoft Teams
- Publishing API documentation
Setting up a mock server
Mock Servers in Postman let you simulate APIs. You can create mock servers from the Postman app, from the web dashboard, and using the Postman API. You will need a Postman account to set up a mock server.
Mocks in Postman are tied to a collection. Postman matches requests and generates responses for mocks from the Examples in the requests of a collection. You can create a mock server even if you don't have an existing collection.
- Creating mock servers in the web dashboard
- Using HTTP access control for a mock
- Using free mock server calls
- Editing mock servers
- Next steps
You can create a mock in several ways in the Postman app:
- Using the New button
- From the Launch screen
- Using Examples in an existing collection
The video below runs you through the steps in creating a mock server from the New button in the Postman app.
To create your mock server, click the New button in the top left of the header toolbar.
Click Mock Server in the Create New tab.
Choose whether you want to mock a new API or an existing collection. If you create a new API to mock, you will select a request method and enter the request path, response code, and response body. If you use an existing collection to mock, you will select a collection from a list of existing or team collections.
When you have selected or created the request you want to mock, click Next.
In the Set up the mock server tab, you can configure your mock server.
- Enter the name of the mock.
- Select an environment (optional).
- Check the checkbox if you want to make the mock server private.
- Check the checkbox if you want to save the mock server URL as an environment variable.
- Click Next to continue.
The number of calls made to mock servers may be limited by your Postman account. Check your usage limits.
In the Next steps tab, you will see a list of suggested next steps to maximize the effectiveness of your mock server.
Launchpad appears by default when you launch the Postman app. To create a mock server, open the Postman app, navigate to Start something new > ... View More > Create a mock server.
Follow the process outlined in the New Button section to complete the mock server setup steps.
At the bottom, you can choose whether you want the Launchpad tab to display each time you open Postman by toggling the Open Launchpad option on or off.
You can create a mock server from an existing API. Navigate to the API you'd like to add a mock server to, then click Develop. Select Add Mock Server, then choose between creating a new mock server or adding an existing one.
This will launch the Create mock server modal. Follow the process outlined in the New button section to complete the mock server setup.
You can create a mock server from an existing collection in the left sidebar. To do that, expand the collection details pane, switch over to the Mocks tab in the pane, and click Create a mock server.
This will launch the Create mock server modal. Follow the process outlined in the New Button section to complete the mock server setup steps.
If you already have mock servers created from the same collection, you will see an Add mock button instead of Create a mock server.
You can mock a single request from the History tab in the left sidebar. Hover over an entry, and click View more actions (...) to expand the dropdown menu. Choose Mock Request.
This will open the Set up the mock server modal. Pass the values outlined in the New button section. Click Create Mock Server.
This process of creating a mock server will also create a collection with the same title as the mock server. This collection will have a copy of the same request that you chose from the History sidebar. The mock server created is tied to this new collection.
You can create a mock from an existing collection from the Browse view. Click the Browse toggle button on the bottom right of the Postman app. Change to the Collections tab for the current workspace. Click the View more actions (...) button for the corresponding collection. Select Mock Collection from the dropdown.
This will open the Create mock server modal. Follow the steps to finish creating the mock server.
You can create a mock server from the Web dashboard with existing collections and environments. Login to your Postman team dashboard, and navigate to your workspace by clicking your workspace name. In the workspace dashboard, click the Mock servers tab.
Click the button to create a new mock server, and you will see the configuration screen. Set the relevant configuration.
- Enter the name of the mock.
- Select a collection to mock.
- Select a version tag of the collection to use for the mock. Leave it to CURRENT if you want to the mock server to use the latest version of your collection.
- Select an environment to use with the mock (optional).
- Select the checkbox if you want to make the mock server private.
- Click Create Mock Server to create the mock and go back to the Mock servers dashboard.
In addition to using the Postman app to make requests to mock endpoints, you can also make those requests in a browser.
A web browser makes a cross-origin HTTP request when it requests a resource from a domain, protocol, or port that's different from its own.
Cross-Origin Resource Sharing (CORS) is a standard that defines a way in which a browser and server can interact securely, in this case referring to how a web browser interacts with the mock endpoints hosted on the Postman server.
CORS is enabled for Postman mock servers. As a result, you can stub your web apps with mocked data using the mock endpoints. Development or production web apps can then make requests to your Postman mock endpoint and receive an example response.
Your Postman account gives you a limited number of free mock server calls per month.
You can edit existing mock servers in Postman since version
7.7.0. The following properties of a mock server can be updated through the Postman app and web dashboard:
- Name of the mock server
- Version tag of the underlying collection
- Environment associated with the mock server
- Private or public status of the mock server
There are three ways to edit a mock server. You can edit from the Collection pane, through the Mock Server listing in Browse mode, or through the web dashboard of your workspace Mock Servers section.
Editing mocks in Build mode:
Editing mocks in Browse mode:
Editing mocks from the Web Dashboard:
You can view and search the details of calls to your mock servers using the mock call log. Open a mock from the Postman app by clicking it in Collections, in APIs, or by switching to Browse > Mocks and clicking the mock name. Your mock call log will open in the web dashboard—you can also open it from the collection in the browser, by selecting Mock Servers.
The mock call log lists an overview of calls made to the mock url, together with request and response details.
Mock call log entries indicate the time a request was sent, the request method and path, and a response overview. Click an entry to see more detail on request headers and body, or response headers and body. You can drill down into response data returned by a mock call.
Use the search field to find particular calls, and the refresh button at the top of the list to view up to date requests.
You can use the mock call log to troubleshoot your requests to mock servers.
If you see
No matching requests listed in the Response column, this may mean that your mock server is not setup correctly. Make sure you have an example saved for the request in the collection you have the mock connected to.
For more information about mock servers, see the following resources: