> This page is for Postman Docs, version Latest (v12) (default).
> For other versions, use one of these documentation indexes:
> - Latest (v12) (default): https://learning.postman.com/latest-v-12/llms.txt
> - v11: https://learning.postman.com/v11/llms.txt

> For clean Markdown content of this page, append .md to this URL. For the complete documentation index, see https://learning.postman.com/llms.txt.

# Run a mock locally and inspect its logs and state

> Start a mock on your machine, send local requests to it, and inspect its logs, state, and run history as you develop.

Run a [mock](/docs/design-apis/mock-apis/mocks/overview) locally to develop against it before you deploy it. Start the mock on your machine, send requests to it at `localhost`, and watch its logs and state as it handles each request. To make a mock always available to your team instead, [deploy it as a mock server](/docs/design-apis/mock-apis/mock-servers/from-a-mock).

> **Note**
>
> The steps in this section use the Postman desktop app. To run a mock from the command line, including in CI, use the [`postman mock run`](/docs/postman-cli/postman-cli-mock#postman-mock-run) command.

## Start a mock and send local requests \[#start-a-mock-and-send-local-requests]

Start a mock and send it HTTP requests to validate that it behaves as expected. The URL is `http://localhost:<port>`, where the port is specified in the [mock's settings](/docs/design-apis/mock-apis/mocks/create-a-mock#edit-a-mock). If the specified port is already in use, the mock falls back to an available port assigned by the OS. You can manually start and stop the mock to control when it listens for requests.

1. Click the ![Items icon](https://assets.postman.com/postman-docs/aether-icons/v12/descriptive-items-stroke.svg#icon) **Items** tab in the sidebar.
2. Click **Mocks**.
3. Select the mock.
4. Click **Start** in the upper right. You can also select ![Options icon](https://assets.postman.com/postman-docs/aether-icons/v12/action-options-stroke.svg#icon) **View more actions > Start** next to a mock in the sidebar.
5. In the upper right, click ![Open in Postman icon](https://assets.postman.com/postman-docs/aether-icons/v12/icon-action-openInPostman-stroke.svg#icon) **Open in a new request** to open a new request with the URL auto-filled. You can also click ![Copy icon](https://assets.postman.com/postman-docs/aether-icons/v12/icon-action-copy-stroke.svg#icon) **Copy URL** to copy the URL and use it in an HTTP request.
6. Send requests to the URL and observe the responses.

Click **Stop** in the upper right to stop the mock.

You can also start a mock locally from the Postman CLI with the [`postman mock run`](/docs/postman-cli/postman-cli-mock#postman-mock-run) command.

## Inspect a running mock \[#inspect-a-running-mock]

View requests, responses, and state information for a running mock.

1. Click the ![Items icon](https://assets.postman.com/postman-docs/aether-icons/v12/descriptive-items-stroke.svg#icon) **Items** tab in the sidebar, click **Mocks**, then select a mock.
2. Use the **Session** dropdown list to inspect a specific state session. Requests that use the same session identifier share state and display together.
3. Use the **Logs** and **State** tabs to inspect requests, responses, and state information for the mock.

### View logs \[#view-logs]

View incoming requests, responses, and state operations in the **Logs** tab.

You can filter logs by path, type, method, status, time range, and header to focus on specific requests and responses. For example, you can filter by a specific endpoint to see all requests made to that endpoint and the corresponding responses.

Select a log entry to view more details about the request and response, including headers and body content.

Logs with the simulator icon ![Simulator icon](https://assets.postman.com/postman-docs/aether-icons/v12/icon-simulator-stroke.svg#icon) indicate requests that ran with a simulation applied.

Click ![Delete icon](https://assets.postman.com/postman-docs/aether-icons/v12/action-delete-stroke.svg#icon) **Clear logs** to remove all logs for the mock.

### View state \[#view-state]

If your mock uses `pm.state`, you can inspect the current state values for the selected session in the **State** tab.

State entries are displayed as key-value pairs. Expand a state entry to view its contents and inspect how requests have modified state over time.

Click ![Delete icon](https://assets.postman.com/postman-docs/aether-icons/v12/action-delete-stroke.svg#icon) **Clear session** to remove all state values for the selected session.

## View mock history \[#view-mock-history]

Each time you start a mock, Postman records the run. Use mock history to review past runs, including who started each one, how long it ran, and the logs and state captured during the run.

Click **History** to view the mock's past runs.

The history table lists each run with the following details:

| Column         | Description                                                |
| -------------- | ---------------------------------------------------------- |
| **Start time** | The date and time the run started.                         |
| **Source**     | Where the run was started from, either **App** or **CLI**. |
| **Started by** | The user who started the run.                              |
| **Duration**   | How long the mock ran.                                     |
| **Calls**      | The number of requests the mock handled.                   |
| **Status**     | The status of the run, such as **Stopped**.                |

Use the **Started by** and **Source** filters to narrow the list.

> **Info**
>
> You can also open a mock's past runs from the ![History icon](https://assets.postman.com/postman-docs/aether-icons/descriptive-history-stroke.svg#icon) **History** tab in the sidebar. To learn more, see [History](/docs/getting-started/basics/navigating-postman#history).