# Run a collection using the Postman CLI
You can use the [Postman CLI](/docs/postman-cli/postman-cli-overview/) to manually run collections to test the functionality of your API. You can also use the Postman CLI to automate collection runs in CI/CD pipelines.
Postman supports running HTTP collections. You can't run multi-protocol collections.
When the Postman CLI runs a collection, the collection and its tests run locally, and the results are sent to the Postman cloud using an API call.
The Postman CLI doesn't support OAuth 2.0 authentication. To learn how to use an OAuth 2.0 token with the Postman CLI, see [OAuth 2.0 overview](/docs/sending-requests/authorization/oauth-20/#oauth-20-overview).
## Run a collection locally with the Postman CLI
You can use the Postman CLI to run the requests in a [collection](/docs/collections/use-collections/create-collections/) or a [folder](/docs/collections/use-collections/manage-collections/#add-folders-to-a-collection).
1. [Download and install the Postman CLI](/docs/postman-cli/postman-cli-installation/).
2. Click **Collections** in the sidebar and select the collection or folder you want to run.
You can also run a collection or folder that's linked to an API. Learn more about [adding a collection to an API in the Postman API Builder](/docs/design-apis/api-builder/develop-apis/adding-api-elements/#add-a-collection-to-your-api).
3. Click
**Run**.
4. On the **Functional** tab, click **Automate runs via CLI**.
If you're running a [collection linked to an API](/docs/design-apis/api-builder/develop-apis/adding-api-elements/) that's connected to a [Git repository](/docs/design-apis/api-builder/versioning-an-api/overview/), replace the collection ID with the path to the collection file in your remote repository.
5. Under **Run on Postman CLI**, click **Add API Key**. Do one of the following:
* Click **Generate Key** to create a new API key. Enter a name for the API key and click **Generate**. Click
**Copy** to copy the key and save it somewhere safe.
* Click **Use Existing Key** and enter a valid API key.
6. Click **Insert Key**.
7. Click
**Copy** to copy the commands.
8. Paste and run the commands in your terminal. After running the commands, the Postman CLI outputs a run report and a link to the run results in Postman.
In the run report, `test-scripts` refers to [post-response scripts](/docs/tests-and-scripts/write-scripts/test-scripts/).
9. Follow the link to check the results in Postman.
## Run a collection in CI/CD
When the collection runs to your satisfaction, you can copy the commands into your CI/CD script to integrate them into your workflows. When adding the commands to your CI/CD script, you may want to replace the API key with a variable.
To run a collection in CI/CD, do the following:
1. Click **Collections** in the sidebar and select the collection or folder you want to run.
You can also run a collection or folder that's linked to an API. Learn more about [adding a collection to an API in the Postman API Builder](/docs/design-apis/api-builder/develop-apis/adding-api-elements/#add-a-collection-to-your-api).
2. Click
**Run**.
3. On the **Functional** tab, click **Automate runs via CLI**.
4. Under **Run on CI/CD**, click **Configure command**.
5. Click a **Collection** to run during pipeline builds. You can also select an **Environment** to use.
If needed, click
**Add Another Collection** to select more collections to run.
6. Click the **CI/CD Provider** and **Operating system** for your CI/CD pipeline.
7. To copy the Postman CLI configuration, click
**Copy** or **Copy Postman CLI Command**.
8. Add the Postman CLI configuration to your CI/CD script. This process depends on your CI tool.
## Run a collection in a specific order
By default, when you generate the command to run a collection from the Collection Runner, a single Collection ID for the collection is specified. This runs the folders and requests in that collection in the sequence they're listed in the collection.
If you need to change the request order, select a request in the Collection Runner and drag it to its new location in the order. You can also remove an individual request from the run by clearing the checkbox next to its name.
When you change the folder and request sequence, the generated command also changes. In addition to the Collection ID, the generated command specifies a number of folder and request UIDs with the `-i` option. This runs each of the folders or requests in that specified order.
## Run a collection that uses test data files
The Postman CLI can't run requests that use files in your local [working directory](/docs/getting-started/installation/settings/#working-directory) to send [body data](/docs/sending-requests/create-requests/parameters/). If your collection has requests that use files, [upload your test data files](/docs/sending-requests/create-requests/test-data/) to make them available to the Postman CLI.
## Run a collection that uses packages
Using the Postman CLI to run packages from your team's Postman Package Library is available with [Postman Professional and Enterprise plans](https://www.postman.com/pricing/).
You can use the Postman CLI to run collections with scripts that import packages from your team's [package library](/docs/tests-and-scripts/write-scripts/packages/package-library/). Learn how to [add packages](/docs/tests-and-scripts/write-scripts/packages/package-library/#add-a-package) to the package library, and [import packages](/docs/tests-and-scripts/write-scripts/packages/package-library/#import-a-package) into your scripts.
You can also use the Postman CLI to run collections that [import external packages](/docs/tests-and-scripts/write-scripts/packages/external-package-registries/) from npm or JSR package registries.