Workspace commands

View as Markdown

This topic covers workspace management commands for the Postman CLI.

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.

Usage

$postman workspace prepare [options]

Options

--collections-dir <path>
Defaults to postman/collections

Path to the collections directory.

--environments-dir <path>
Defaults to postman/environments

Path to the environments directory.

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.

Examples

$postman workspace prepare

Learn more at Native Git workflows.

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.

Usage

$postman workspace push [options]

Options

--collections-dir <path>
Defaults to postman/collections

Path to the collections directory.

--environments-dir <path>
Defaults to postman/environments

Path to the environments directory.

--no-prepare

Skip the prepare step before pushing.

-y, --yes

Skip all confirmation prompts.

Workflow

  1. Validate — Checks if the collections, environments, and specifications exist globally and in the target workspace.
  2. Prepare (unless --no-prepare) — Runs prepare automatically if invalid or missing IDs are detected.
  3. Sync — Creates, updates, or deletes entities to match your local state.
  4. 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.

The .postman/workflows.yaml file contains the synchronization settings for collections generated from specifications and specifications generated from a collection. When you run the postman workspace push command, it uses those settings to synchronize changes between a specification and collection to the cloud.

The system creates the workflows.yaml file when:

  • You pull a specification and its generated collection into Local View.
  • When you pull a collection and its generated specification into Local View.
  • When you generate a collection in Local View.

If the file already exists and you perform one of these actions in Local View, the system adds a new sync entry in the workflows.yaml file.

Examples

Push with automatic prepare and interactive prompts
$postman workspace push
Push without the prepare step
$postman workspace push --no-prepare
Automatic push without prompts (useful for CI/CD)
$postman workspace push --yes

Learn more at Native Git workflows.