Start a runner with the built-in proxy server
Private API Monitoring is available with Postman Basic, Professional, and Enterprise plans. To enable Private API Monitoring in your Enterprise team, contact your Postman Customer Success Manager.
Use the following examples to start a runner with Postman’s built-in proxy server. With the built-in proxy server, you can control outbound requests using your own authorization service without deploying or managing your own proxy server.
First, create a runner authorization service API with an endpoint that validates outbound requests using the required JSON formats. Create a runner authorization service with rules that determine which requests from the runner are allowed or blocked. After the authorization service is deployed and running, you can start a runner or containerize a runner using Docker in your cloud network, such as a virtual private cloud.
You can use the Postman CLI to trigger monitor runs for internal APIs within your CI/CD pipeline. Then your team can use your Postman tests to automatically catch regressions and configuration issues during your deployment process. Learn more about running a monitor with the Postman CLI.
Runner authorization service API
Create a runner authorization service API that exposes a POST /validate endpoint. The built-in proxy server calls the endpoint to validate outbound requests from the runner. The runner makes HTTP requests to the runner authorization service based on the URL you specify using the --egress-proxy-authz-url option.
Requests to the runner authorization service must send a JSON payload in the following format:
Responses from the runner authorization service must return a JSON response in the following format:
Create a runner authorization service
Use the following example code to create and deploy your own runner authorization service in Node.js (v18 or later) with Express. You can implement the runner authorization service using any technology stack and deploy it however you prefer. The only requirement is that the runner authorization service API exposes a POST /validate endpoint using the specified JSON request and response format. Before you start a runner, the runner authorization service must be deployed and running.
-
Use the following JavaScript code example to create your own runner authorization service with rules that decide which requests are allowed or blocked.
-
Install dependencies for the runner authorization service:
-
Run the runner authorization service:
Once the service is running, you can start a runner with the built-in proxy server or containerize a runner using Docker in your cloud network. Use the --egress-proxy-authz-url option to specify the runner authorization service URL, such as http://localhost:8080.
Start a runner
To start a runner, install the Postman CLI and then use the postman runner start command to begin polling Postman for monitor runs. To start the runner with the built-in proxy server, use the --egress-proxy option that enables the built-in proxy server and the --egress-proxy-authz-url option for specifying the URL for the runner authorization service.
You can also learn how to containerize a runner using Docker in your cloud network.
-
Install the Postman CLI. You can run the following command to install the Postman CLI using npm:
-
Run the Postman CLI
runnercommand with the runner ID, key, and authorization service URL.In this example, the value of
<authorization-service-url>is the root URL of the authorization service, such ashttp://localhost:8080.
Start a runner in your cloud network
Use the following example Dockerfile to create your own that installs the Postman CLI and starts the runner with the postman runner start command. The example includes the --egress-proxy option that enables the built-in proxy server and the --egress-proxy-authz-url for specifying the URL for the runner authorization service. This example shows best practices for running the runner in a containerized environment.
You can also learn how to start the runner from your machine with the built-in proxy server.
-
Use the following example Dockerfile to install the latest version of the Postman CLI, start the runner with the built-in proxy server enabled, and specify the runner authorization service URL:
Learn more about installing the Postman CLI and the
postman runner startcommand to help you configure your Dockerfile. -
Build an image using your Dockerfile. Tag the image with “postman-runner”.
-
Run the container using the image tagged with “postman-runner”. Provide the runner ID, key, and authorization service URL.
In this example, the value of
<authorization-service-url>is the root URL of the authorization service, such ashttp://localhost:8080.
Docker containers can’t use localhost to reach authorization services on your computer. If your authorization service is running on your computer (not in the same Docker container), use the following hosts depending on your platform. Replace 8080 with your authorization service’s port number.
- Mac/Windows:
http://host.docker.internal:8080 - Linux:
http://172.17.0.1:8080(The default gateway IP address for a bridge network. Your gateway IP address may vary based on your network’s configuration.)
For more information and the latest recommended approaches, see Docker’s networking documentation.