Make calls to mock servers

After setting up a mock server, you can begin making calls to its URL. When you send a request to a mock server, the mock server sends back a response based on an example with the same path and method. You can provide multiple examples, and Postman returns the one that best matches your request.

If you configured a delay for your mock server, Postman waits the specified period of time before sending the response.

If you save the URL of a mock server to a variable, you can reference it across requests. For example, if you have a production server and a mock server, you can have an environment for each server. In each environment, create a variable with the same name (for example, {{url}}) for the mock URL. By using the variable in your requests, you can switch between the two environments to call the production server or the mock server.

Using variables with mock servers

Your Postman plan gives you a limited number of free mock server calls per month. Learn more about resource usage in Postman.

Call a mock server

To make a call to a mock server, do the following:

  1. Click Mock servers in the sidebar, select the server, and click Copy icon Copy URL.

  2. Open a new collection request (or edit the address in an existing request), then add the mock server's URL. The URL includes the mock server's ID and the path to the request you want to mock. For example, https://4bb57fc2-219e-421e-86b4-4ffda6bf1b3b.mock.pstmn.io/get.

    Make sure the request you want to mock has at least one saved example. Learn more about adding examples to a request.

  3. If your mock server is private, add your Postman API key to the request as an x-api-key header. See Make calls to a private mock server to learn more.

  4. Click Send to send the request.

    Sending a mock request

Make calls to a private mock server

To make calls to a private mock server, you need to add a Postman API key in the request header when sending requests to the mock server (for example, x-api-key:<Your-Postman-API-key>). If you share the collection, others can use their Postman API keys to make calls to the mock server.

Use HTTP access control for a mock server

In addition to using Postman to call mock endpoints, you can also make requests to a mock server using a web 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, CORS refers to how a web browser interacts with the mock endpoints hosted on the Postman mock server.

CORS is enabled for Postman mock servers, so 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 example responses.

View the mock server call log

You can view and search the details of calls to your mock servers using the mock call log. To view the call log, click Mock servers in the sidebar and select a mock server.

Viewing mock calls

The call log displays a list of calls made to the mock server URL. Each entry shows the time the request was sent, the request method and path, and a response overview.

With mock server call logs, you can:

  • Enter text in the search box to find specific requests.
  • Click Refresh icon Refresh Logs to view the most recent requests.
  • Select an entry for more details about the request headers and body or the response headers and body.
  • Click Delete icon Delete to remove a call log entry.
  • Click Copy icon Copy URL to copy the mock server's URL. You can use it to make calls to the mock server.
  • Click Docs icon View Collection Docs to view the mocked collection's documentation.

Troubleshoot mock calls

You can use the mock call log to troubleshoot your requests to mock servers.

If No matching requests displays in the Response column, this might mean there's a problem with your mock server configuration. Make sure there's an example saved for the request in the collection you're mocking.

Troubleshooting mock calls

In the case of a service outage, you will get an HTTP 502, 503, or 504 response. Check the Postman status page for updates.

Last modified: 2025/06/16