> 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.

# Postman CLI quickstart

> Install and sign in to the Postman CLI, set up a project, create and run your first collection with a test, and push it to a Postman workspace.

In this tutorial, you use the [Postman CLI](/docs/postman-cli/postman-cli-overview/) to set up a project, create a collection with one request and one test, run it, and push it to a Postman workspace. Every step is a command you can run yourself or have a coding agent run for you.

## Prerequisites

Before you start, do the following:

1. [Install the Postman CLI](/docs/postman-cli/postman-cli-installation/).

2. Sign in to Postman:

   ```bash
   postman login
   ```

   The command opens your browser to sign in. For more on signing in, including API keys and temporary sessions, see [Postman CLI authentication and configuration](/docs/postman-cli/postman-cli-authenticate-and-configure/).

3. Check that you're signed in:

   ```bash
   postman whoami
   ```

## Set up a project

Create a folder for the project, turn it into a Git repository, and run [`postman init`](/docs/postman-cli/postman-cli-init/#postman-init):

```bash
mkdir postman-quickstart
cd postman-quickstart
git init
postman init
```

The command adds a `.postman/` folder with the project configuration, an `AGENTS.md` file, and Postman's agent skills under `postman/skills/`. Because you're signed in, it also offers to create a Postman workspace and connect your project to it. Answer yes, and choose **personal** visibility so the workspace is private to you.

> **Info**
>
> To skip the prompts, for example in a script or from an agent, run `postman init --yes --visibility personal`.

## Create a collection

Create a local collection named `Quickstart` with [`postman collection new`](/docs/postman-cli/postman-cli-collections/#postman-collection-new):

```bash
postman collection new "Quickstart"
```

The command prints the location of the new collection:

```text
Created postman/collections/Quickstart
```

## Add a request and a test

Add a request to the collection with [`postman collection request add`](/docs/postman-cli/postman-cli-collections/#postman-collection-request-add):

```bash wordWrap
postman collection request add "Get echo" --collection Quickstart
```

The new request is empty. Set its method and URL, and add a test script that checks for a `200` status, with [`postman collection request update`](/docs/postman-cli/postman-cli-collections/#postman-collection-request-update):

```bash wordWrap
postman collection request update "Get echo" --collection Quickstart \
  --method GET \
  --url https://postman-echo.com/get \
  --scripts 'test:pm.test("Status is 200", function () { pm.response.to.have.status(200); });'
```

## Run the collection

Run the collection with [`postman collection run`](/docs/postman-cli/postman-cli-collections/#postman-collection-run):

```bash wordWrap
postman collection run postman/collections/Quickstart
```

The command sends the request, runs the test, and prints a run report. The start of the report looks like this:

```text
Quickstart

Root Get echo

  GET https://postman-echo.com/get [200 OK, 1.21 KB, 175 ms]
  Pass  Status is 200
```

A summary table follows, with the number of requests, test scripts, and assertions that ran and failed. The command exits with code `0` when everything passes and a non-zero code when a request or test fails, so a script or pipeline can act on the result.

## Push the collection to your workspace

Send the collection to the workspace that `postman init` connected to your project, with [`postman workspace push`](/docs/postman-cli/postman-cli-workspace/#postman-workspace-push):

```bash
postman workspace push
```

The `Quickstart` collection now appears in your workspace in Postman.

## Run it from an agent or CI

The same commands work without a person at the keyboard:

* Pass `--yes` to `postman init` and `postman workspace push` so they don't stop to ask questions.
* Read the exit code of `postman collection run` to decide whether a build or an agent task passed.
* Add `--output <folder>` to `postman collection run` to write a YAML run report that a script or an agent can read.

To learn more about non-interactive use, output formats, and exit codes, see [Use the Postman CLI with AI agents and CI/CD](/docs/postman-cli/postman-cli-agents-and-ci/).