> For clean Markdown content of this page, append .md to this URL. For the complete documentation index, see https://learning.postman.com/llms.txt.

# Dependency commands

This topic covers dependency commands for the [Postman CLI](/docs/postman-cli/postman-cli-overview/).

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

```bash
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

```bash
postman dependency add collection "My Collection" --workspace 12345678-90ab-cdef-1234-567890abcdef

postman dependency add environment 123456-1b4d90f0-b724-4aa2-b1bb-b5d4f6435fc3
```