# `npx @sanity/cli blueprints config`

Read or update `.sanity/blueprint.config.json`, written next to the Blueprint manifest, which connects the local Blueprint to a Sanity scope and Stack.

## Inspect first

Run from the Blueprint directory and request structured output:

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

Without `--edit`, the command only displays the current configuration; with no config file on disk, `--json` emits nothing and exits `0`. Treat the project or organization ID and Stack ID as a single target; changing one can redirect later plan, deploy, info, logs, promote, or destroy commands.

## Update

For agent-driven changes, pass the intended values instead of using the interactive editor:

```sh
npx @sanity/cli blueprints config --edit --project-id PROJECT_ID --stack NAME_OR_ID --json
```

Use `--organization-id ORGANIZATION_ID` instead of `--project-id` for an organization scope. The two scope flags are mutually exclusive. `--stack` accepts a Stack name or ID.

Scope or Stack flags without `--edit` write nothing: the command prints `To update the Blueprint config, use the --edit flag.` (suppressed under `--json`) and exits `0`, so a successful exit does not mean the change was applied.

## Switching scope

An update only sets the keys it was given. Adding `--organization-id` to a config that already holds `projectId` leaves both in the file, and project scope takes precedence over organization scope, so the switch has no effect on later commands.

To move a Blueprint from project to organization scope, either edit `.sanity/blueprint.config.json` to remove `projectId`, or use `blueprints promote`, which clears it as part of the scope change.

After an update, run `blueprints config --json` again and verify every ID before executing a mutating command.
