Postman CLI quickstart
In this tutorial, you use the Postman CLI 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:
-
Sign in to Postman:
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.
-
Check that you’re signed in:
Set up a project
Create a folder for the project, turn it into a Git repository, and run 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.
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:
The command prints the location of the new collection:
Add a request and a test
Add a request to the collection with postman collection request add:
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:
Run the collection
Run the collection with postman collection run:
The command sends the request, runs the test, and prints a run report. The start of the report looks like this:
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:
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
--yestopostman initandpostman workspace pushso they don’t stop to ask questions. - Read the exit code of
postman collection runto decide whether a build or an agent task passed. - Add
--output <folder>topostman collection runto 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.