> 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 flow in CI/CD

You can generate a [Postman CLI](/docs/postman-cli/postman-cli-overview/) command from an open flow and add it to your CI/CD pipeline to run local and deployed flows. You can include collections and an environment in the same configuration to run them alongside the flow.

## Cloud runs vs. local runs

The generated Postman CLI configuration runs the flow in one of two ways, depending on whether you select **Run locally**:

* **Run locally** not selected (default) — The command uses [`postman flows trigger`](/docs/postman-cli/postman-cli-flows/#postman-flows-trigger) to run a [deployed flow](/flows/build-flows/structure/actions/) in the Postman cloud. The flow must be deployed before you generate the configuration.
* **Run locally** selected — The command uses [`postman flows run`](/docs/postman-cli/postman-cli-flows/#postman-flows-run) to run the flow's local files directly on your machine. The flow's local files must be accessible to the CI/CD runner, typically by including them in the same repo as your build configuration. You can use this option if the flow calls private APIs that aren't reachable from the Postman cloud. To create a flow's local files, use [Local View](/flows/get-started/flows-native-git/#local-view) in the Postman desktop app. This option is available with [Postman Enterprise plans](https://www.postman.com/pricing/).

## Generate the Postman CLI configuration

To generate the Postman CLI configuration for a flow, do the following:

1. Open the flow you want to run in your CI/CD pipeline.

2. In the upper right, click <img alt="Options icon" src="https://assets.postman.com/postman-docs/aether-icons/action-options-stroke.svg#icon" width="16px" /> **More options** and select **Run in CI**. The **Generate Postman CLI Configuration** page opens with the current flow already selected under **Flows**.

3. (Optional) Under **Choose the items you want to run**, do any of the following:

   * Select a **Collection** to run during pipeline builds, and select an **Environment** to use. Click <img alt="Add icon" src="https://assets.postman.com/postman-docs/aether-icons/v12/icon-action-add-stroke.svg#icon" width="20px" /> **Add Another Collection** to include multiple collections.
   * Under **Flows**, click <img alt="Add icon" src="https://assets.postman.com/postman-docs/aether-icons/v12/icon-action-add-stroke.svg#icon" width="20px" /> **Add Another Flow** to include additional flows.

4. (Optional) To run the flow's local files on your CI/CD machine instead of triggering the deployed flow in the Postman cloud, select **Run locally**. See [Cloud runs vs. local runs](#cloud-runs-vs-local-runs) for the differences between the two modes.

5. Under **CI/CD configuration**, select a **CI/CD Provider** and an **Operating system for CI/CD**.

6. Review the generated command under **Postman CLI command preview**.

7. Click **Copy Postman CLI Command** to copy the command to your clipboard.

8. Paste the command into your build configuration file. This process depends on your CI tool.

To learn more about the underlying commands and their options, see [`postman flows trigger`](/docs/postman-cli/postman-cli-flows/#postman-flows-trigger) and [`postman flows run`](/docs/postman-cli/postman-cli-flows/#postman-flows-run). To learn more about running other Postman elements in CI/CD, see [Run tests in CI/CD pipelines](/docs/tests-and-scripts/run-tests/run-tests-with-ci-cd/).