# `npx @sanity/cli blueprints stacks`

List remote Stacks for a project or organization. Use this read-only command to discover a Stack ID before running a targeted info, logs, config, deploy, promote, or destroy command.

## Run

List Stacks for the locally configured scope:

```sh
npx @sanity/cli blueprints stacks --json
```

Select a scope explicitly when working outside the local Blueprint:

```sh
npx @sanity/cli blueprints stacks --project-id PROJECT_ID --json
npx @sanity/cli blueprints stacks --organization-id ORGANIZATION_ID --json
```

Always pass a scope flag or `--all` when automating. With no scope to resolve the command prompts for an organization, then for a project if you pick project scope; without a terminal, or with `--json`, it fails with a missing-scope error instead.

The JSON result contains `stacks`, `scopeType`, and `scopeId`; each entry carries `resourceCount` rather than a full `resources` array. Zero results prints `No stacks found`, and under `--json` returns an empty `stacks` array. Match both the Stack and its scope; names alone may be ambiguous.

To also include Stacks scoped to the organization's projects:

```sh
npx @sanity/cli blueprints stacks --organization-id ORGANIZATION_ID --include-projects --json
```

`--include-projects` requires `--organization-id`, cannot be combined with `--project-id`, and only queries the organization's first 50 projects.

To sweep every organization and project the token can reach:

```sh
npx @sanity/cli blueprints stacks --all --json
```

`--all` cannot be combined with the scope flags or `--include-projects`. It is best effort: scopes that return an error are skipped and reported as a count, and only the first 200 projects are queried. Its JSON result contains `stacks` and no top-level `scopeType`/`scopeId`; read each entry's own `scopeType` and `scopeId` instead.

This command does not change the local Blueprint target; use `blueprints config --edit` for that.
