Dependency commands

View as Markdown

This topic covers dependency commands for the Postman CLI.

Workspace dependencies let you reuse a collection, environment, or mock from another workspace in your local project.

postman dependency add

Adds a collection, environment, or mock from another workspace as a dependency of your local project, so you can reuse it. The command copies the element into your project’s postman/.dependencies/ directory and records it in your .postman/resources.yaml file.

Usage

postman dependency add <type> <nameOrId> [options]
<type>

The type of element to add as a dependency: collection, environment, or mock.

<nameOrId>

The name or ID of the element to add.

Options

-w, --workspace <id>

The ID of the workspace the dependency comes from. Defaults to the current workspace.

-y, --yes

Skips all confirmation prompts.

--json

Prints the result as JSON for machine-readable output.

Examples

postman dependency add collection "My Collection" --workspace 12345678-90ab-cdef-1234-567890abcdef
postman dependency add environment 123456-1b4d90f0-b724-4aa2-b1bb-b5d4f6435fc3