Postman CLI commands and options
Availability of some Postman CLI commands depend on your Postman plan.
This topic covers the commands and options supported by the Postman CLI.
Basic command options
postman
The base command of the Postman CLI is postman. Run this command with the syntax and options detailed below.
Options
Tip
You can run the man postman command to return a manual page with the Postman CLI commands and options.
Example
Sign in and out
You can use the Postman CLI to sign in and out of Postman with the login and logout commands.
Any local operations work without a login requirement. Commands that interact with the Postman cloud require you to be signed in.
If you’re using the Postman CLI from a network with outbound restrictions, you must allowlist specific domains to connect to Postman.
postman login
The login command prompts you to securely sign in and authenticate from the browser.
If you purchased a Postman EU Data Residency plan, the login command also requires the --region option. Use this option with the argument eu to specify that your instance of Postman is hosted in the EU region.
You can also use the --with-api-key option to authenticate using your Postman API key. This method is recommended when using the Postman CLI from your CI/CD pipeline, but you can also use this method from your local machine.
You remain signed in until you use the logout command or your Postman credentials or API key expire.
Options
Examples
postman logout
This command signs you out of Postman and deletes the stored API key.
Example
Sync local elements with workspaces
The Postman CLI includes workspace commands to validate, synchronize, and push local collections, environments, and specifications to Postman workspaces in the cloud. Add the commands to your CI/CD script to automate these tasks during the deployment process. Learn more about adding workspace commands to your CI/CD pipeline.
postman workspace prepare
This command validates and prepares local collections and environments for pushing to a Postman workspace. It checks for valid UUIDs, regenerates IDs if needed, and ensures all items and responses have proper IDs.
Options
Configuration
The command expects a .postman/resources.yaml file in your working directory.
Collection and environment paths can be relative (resolved from .postman/) or absolute. Only valid JSON files are processed. Invalid paths like empty strings and non-JSON files are automatically filtered with warnings.
Example
postman workspace push
This command pushes local collection, environment, and specification changes to your Postman workspace. It synchronizes your local files with the workspace in the Postman cloud, performing create, update, and delete operations as needed.
To use this command, sign in to Postman with the postman login command.
Options
Workflow
- Validate - Checks if the collections, environments, and specifications exist globally and in the target workspace.
- Prepare (unless
--no-prepare) - Runs prepare automatically if invalid or missing IDs are detected. - Sync - Creates, updates, or deletes entities to match your local state.
- Update Local Files - After successful creation, updates local files with server-returned IDs.
Configuration
The command expects a .postman/resources.yaml file in your working directory.
If the resources.yaml file contains collection, environment, or specification paths, those specific files are used instead of directory scanning.
Example push with automatic prepare and interactive prompts
Example push without the prepare step
Example automatic push without prompts (useful for CI/CD)
Run collections
You can run your collections with HTTP requests using the postman collection run command. With a paid plan, you can also run collections with gRPC and GraphQL requests.
postman collection run
This command runs a collection and displays run results in the terminal. If you’re signed in to Postman, the command sends the run results to the Postman cloud. Learn how to sign in to Postman with the postman login command.
Specify the collection with its file path if you’re running it locally. If you’re signed in to Postman, specify the collection with its ID to send the results to the Postman cloud.
You can find the collection ID in Postman. Click the Items tab, click Collections in the sidebar, and select a collection. Then click the
Info tab in the right sidebar to view or copy the collection ID.
Options
Examples
Migrate collections
You can migrate collections from the v2.1 JSON format to the v3 YAML format with the postman collection migrate command.
postman collection migrate
Use this command to migrate your existing v2.1 collection to the new v3 collection format.
Options
Examples
Run requests
You can test and debug HTTP requests from the command line with the postman request command.
postman request
Use this command to test and debug HTTP requests from the command line with the Postman CLI. Use many of Postman’s features for sending requests, including authentication, environment variables, test assertions, and more. The command accepts the request’s method (GET, POST, PUT, DELETE, PATCH, HEAD, or OPTIONS) as the first argument, defaulting to GET if a method isn’t provided. The command accepts the target URL as the second argument.
In Postman, you can also convert an API request into a Postman CLI code snippet. Copy the generated code snippet, add options to help you test your request, then send the request with the Postman CLI.
Options
Examples
Run monitors
You can use the postman monitor run command to trigger monitor runs within your CI/CD pipeline. You can also use the postman runner start command to run your organization’s APIs from your internal network.
postman monitor run
This command runs a monitor in the Postman cloud. Add the command into your CI/CD script to trigger a monitor run during your deployment process. Then your team can use your Postman tests to catch regressions and configuration issues. Learn more at Run a monitor using the Postman CLI.
The command also invokes the monitor and polls Postman for the run’s completion, returning the monitor results. Specify the monitor with its monitor ID.
To use this command, sign in to Postman with the postman login command.
You can find the monitor ID in Postman. Click the Services tab, click Monitors in the sidebar, and select a monitor. Then click the
Monitor details tab in the right sidebar to view or copy the monitor ID.
Options
Example
postman runner start
Private API Monitoring is available on Postman Enterprise plans.
With Private API Monitoring, you can use runners to monitor and test your organization’s APIs from your internal network, without publicly exposing your endpoints.
Run this command to start a runner from your internal network that regularly polls Postman for upcoming monitor runs. The collection’s tests run in your internal network. Then the test results are sent back to the Postman cloud, making them available in the monitor results. Provide the runner ID and key from the command you copied when you created the runner. Learn more about setting up a runner in your internal network.
Optionally, you can configure the runner to route HTTP and HTTPS traffic through a proxy server that enforces outbound request policies. You can use the --proxy option to provide the URL for the proxy server used by your organization. Or you can use the --egress-proxy option to enable the built-in proxy and use the --egress-proxy-authz-url option to provide the URL for the runner authorization service that evaluates outbound request policies. Learn more about configuring a runner to use a proxy server.
You can’t use the --proxy and --egress-proxy options together.
If the runner is running in the background, stop the runner using your system’s process control. You can also press Control+C or Ctrl+C to stop the runner.
To use this command, sign in to Postman with the postman login command.
Options
Examples
Run flows
You can use the postman flows commands to run, manage, and analyze flows.
postman flows list
The postman flows list command lists the flows available in a workspace. Specify the workspace by its ID.
To use this command, sign in to Postman with the postman login command.
Options
Example
postman flows trigger
You can use the postman flows trigger command to trigger a deployed flow to run. The deployed flow must have a request trigger. This command requires the flow’s ID as an argument. You can also assign values to the flow’s inputs with the --input option.
To use this command, sign in to Postman with the postman login command.
Options
Example
postman flows deploy
You can use the postman flows deploy command to deploy a flow to the Postman cloud. This command requires the flow’s ID as an argument and the --path option. The --path option is the URL segment for the trigger, and must be unique for the team. For example, in the URL deployed-flow.flows.pstmn.io/api/default/new-flow, the path is /new-flow.
To use this command, sign in to Postman with the postman login command.
Options
Example
postman flows run
This command runs a single flow from your local repo. The flow runs requests and logic blocks entirely locally on your machine, making it ideal for CI/CD workflows. Successful runs return status and output. The postman flows run command has options to set input values, show run log information, and use values from a scenario. This command requires the local flow’s file path as an argument.
The postman flows run command is available with Postman Enterprise plans.
To use this command, sign in to Postman with the postman login command.
Options
Examples
postman flows update
You can use the postman flows update command to update auth and online/offline settings for a deployed flow. This command requires the flow’s ID as an argument.
To use this command, sign in to Postman with the postman login command.
Options
Example
postman flows list-runs
You can use the postman flows list-runs command to fetch run history for a deployed flow in a specified workspace. The result displays the run’s timestamp, ID, duration, status, and flow name in a table. This command requires the --workspace option.
To use this command, sign in to Postman with the postman login command.
Options
Example
postman flows get-run
You can use the postman flows get-run command to analyze a specific run.
To use this command, sign in to Postman with the postman login command.
Options
Example
Run performance tests
You can use the postman performance run command to configure and run performance tests for collections within your CI/CD pipeline.
postman performance run
This command runs a performance test for a specified collection in the Postman cloud. Add the command into your CI/CD script to run a performance test during your deployment process. Then your team can use your Postman tests to catch performance issues. Learn more at Run a performance test using the Postman CLI.
The command runs the performance test against the specified collection, returning the performance test results in Postman. Specify the collection with its ID.
To use this command, sign in to Postman with the postman login command.
Options
Examples
Run mock servers
You can use the postman mock run command to start a mock server from a configuration file.
To run a collection against a mock server, use the --mock option with the postman collection run command.
postman mock run
This command starts a mock server from a configuration file in JSON format. With the configuration file, you can configure details like the mock server’s port number, name, script, and more. The mock server runs on the specified port until you stop it. Make sure you also have a JavaScript file with an HTTP server that sets the request and example response for simulating real API behavior.
Add the command to your CI/CD script to start a mock server as a dependency for your application or test suite. Once running, your service or external tests can send requests to it as if it were a real API. This enables you to simulate API behavior for testing and development.
Learn how to create a mock server in your Git repository.
Example
Governance and security
API governance is the practice of applying a defined set of standards consistently across the API design and testing phases of your development process. The Postman CLI includes commands that checks your API specifications in Spec Hub and the Postman API Builder against your team’s configured Postman API governance and security rules.
postman spec lint
This command runs syntax validation and governance rule checks against a single- or multi-file API specification in Spec Hub. Provide the local file path or ID for a specification that’s in OpenAPI 2.0, 3.0, or 3.1 format. If you’re providing the local file path for a multi-file specification, provide the path to the root file.
By default, if you provide a local file path for a specification, the command runs syntax validation and governance checks using the All workspaces governance group. Use the --workspace-id option to run governance checks using the rules from a specific workspace.
To use this command, sign in to Postman with the postman login command.
You can find the specification ID in Postman. Click Items tab, click Specs in the sidebar, and select a specification. Then click the
Specification Info tab in the right sidebar to view or copy the specification ID.
Options
Example
Example output
You can change the output of governance rule violations to JSON or CSV. If you don’t specify an output, it defaults to table view.
The following is an example of the output in table format (default):

The following is an example of the output in JSON format:
The following is an example of the output in CSV format:
postman api lint
The postman api lint command is only supported for API Builder objects in Postman v11. The Postman API Builder isn’t supported in Postman v12 and later. Learn about using the API Builder in Postman v11 and earlier.
This command runs validation checks for governance and security rules against the API specification provided in the Postman config file, a local file, or a UUID. The api lint command shows a warning if it’s unable to find the API ID to send data back to Postman.
This command supports APIs in the Postman API Builder that aren’t linked to Git.
To use this command, sign in to Postman with the postman login command.
Options
Example
Publish an API version
You can publish API versions in the Postman API Builder from the command line with the Postman CLI. Use the Postman CLI to automate the API version publishing process.
postman publish api
The postman publish api command is only supported for API Builder objects in Postman v11. The Postman API Builder isn’t supported in Postman v12 and later. Learn about using the API Builder in Postman v11 and earlier.
Publish a snapshot of an API for the given apiId. All elements linked to the API are published by default. You can choose which elements to publish by using other command options.
When publishing an API that’s linked with Git, you must enter the command from inside the local Git repo. Also, you must provide paths to the schema directory and collection paths instead of IDs.
To use this command, sign in to Postman with the postman login command.
Options
Example for repos not linked with Git
Examples for repos linked with Git
The options for the api publish command differ depending on if you specified a schema folder or schema root file when setting up the Git integration. Git integrations added in Postman v10.18 or later use a schema root file. Git integrations added in other Postman versions use a schema folder.
-
If the API uses a schema folder, publish the API using the
--api-definition <schemaDirectoryPath>option: -
If the API uses a schema root file, publish the API using the
--api-definition <schemaRootFilePath>option:
If you specify a file when a folder is required, or a folder when a file is required, the api publish command returns the following error: API Definition <file/folder> isn't part of API <apiId>. Try the command again using the other option.