# `npx @sanity/cli blueprints mint-deploy-token`

Create a robot token for deploying Blueprints from CI, scoped to one project or organization. The role granted is `blueprints-deployer` for a project, `blueprints-deployer-robot` for an organization.

## Protect the credential

- Obtain authorization before creating a new robot credential.
- Confirm the exact scope and use a label that identifies the CI system or deployment purpose.
- Send the token only to the user-approved secret destination.
- Never write the token to source files, commit it, paste it into an issue, or include it in a response or log.
- Revoke unused tokens in Sanity Manage.

## Run

The default command prints the robot label, ID, and expiry, then prompts for clipboard, terminal, or discard handling. For automation, `--print` emits only the raw token:

```sh
npx @sanity/cli blueprints mint-deploy-token --project-id PROJECT_ID --label "production-ci" --print
```

Use `--organization-id ORGANIZATION_ID` instead of `--project-id` for organization scope. The two scope flags are mutually exclusive.

`--json` returns the full robot response, including sensitive token material. Do not use it when output is collected in ordinary build logs.

A `ROLE_UNAVAILABLE` error means the role does not exist in that project or organization. Other access or permission errors mean the account needs project or organization administrator access. Do not mint repeated replacement tokens without checking whether the earlier request succeeded.
