CLI reference
Blueprints CLI command reference
Reference documentation for the Sanity CLI Blueprints command.
The blueprints CLI command enables initializing, managing, and deploying Blueprints and resources like Functions.
npx sanity blueprints --help
pnpm dlx sanity blueprints --help
yarn dlx sanity blueprints --help
bunx sanity blueprints --help
Commands
add
USAGE
$ sanity blueprints add TYPE
ARGUMENTS
TYPE Type of resource to add (only "function" is supported)
FLAGS
--example=<EXAMPLE> Example to use for the function resource. Discover examples at https://www.sanity.io/exchange/type=recipes/by=sanity
-n, --name=<NAME> Name of the resource to add
--fn-type=<FN-TYPE> Document change event(s) that should trigger the function; you can specify multiple events by specifying this flag multiple times
--language=<LANGUAGE> Language of the new function
--javascript Use JavaScript instead of TypeScript
--fn-helpers Add helpers to the new function
--fn-installer=<FN-INSTALLER> Which package manager to use when installing the @sanity/functions helpers
-i, --install Shortcut for --fn-installer npm
DESCRIPTION
Scaffolds a new Sanity Function in your Blueprint. Functions are serverless handlers triggered by document events (create, update, delete, publish) or media library events.
After adding a function, use 'functions dev' to test locally, then 'blueprints deploy' to publish it.
EXAMPLES
sanity blueprints add function
sanity blueprints add function --helpers
sanity blueprints add function --name my-function
sanity blueprints add function --name my-function --fn-type document-create
sanity blueprints add function --name my-function --fn-type document-create --fn-type document-update --lang jsconfig
USAGE
$ sanity blueprints config
FLAGS
-e, --edit Modify the configuration interactively, or directly when combined with ID flags.
--project-id=<PROJECT-ID> Directly set the project ID in the configuration. Requires --edit flag
--stack=<STACK> Stack name or ID to set in the configuration. Requires --edit flag
DESCRIPTION
Manages the local Blueprint configuration, which links your Blueprint to a Sanity project and Stack.
Without flags, displays the current configuration. Use --edit to interactively modify settings, or combine --edit with ID flags to update values directly (useful for scripting and automation).
If you need to switch your Blueprint to a different Stack, use --edit --stack.
EXAMPLES
sanity blueprints config
sanity blueprints config --edit
sanity blueprints config --edit --project-id <projectId>
sanity blueprints config --edit --project-id <projectId> --stack <name-or-id>deploy
USAGE
$ sanity blueprints deploy
FLAGS
--stack=<STACK> Stack name or ID to use instead of the locally configured Stack
--no-wait Do not wait for Stack deployment to complete
DESCRIPTION
Pushes your local Blueprint configuration to the remote Stack; provisioning, updating, or destroying resources as needed. This is the primary command for applying infrastructure changes.
Before deploying, run 'blueprints plan' to preview changes. After deployment, use 'blueprints info' to verify Stack status or 'blueprints logs' to monitor activity.
Use --no-wait to queue the deployment and return immediately without waiting for completion.
Use --fn-installer to force which package manager to use when deploying functions.
Set SANITY_ASSET_TIMEOUT (seconds) to override the 60-second timeout for processing resource assets.
EXAMPLES
sanity blueprints deploy
sanity blueprints deploy --no-wait
sanity blueprints deploy --fn-installer npmdestroy
USAGE
$ sanity blueprints destroy
FLAGS
--force Force Stack destruction (skip confirmation)
--project-id=<PROJECT-ID> Project associated with the Stack
--stack=<STACK> Stack name or ID to destroy (defaults to the locally configured Stack)
--no-wait Do not wait for Stack destruction to complete
DESCRIPTION
Permanently removes the remote Stack and all its provisioned resources. Your local Blueprint files remain untouched, allowing you to redeploy later with 'blueprints init' + 'blueprints deploy'.
This is a destructive operation. You will be prompted to confirm unless --force is specified.
Use this to clean up test environments or decommission a Stack you no longer need.
EXAMPLES
sanity blueprints destroy
sanity blueprints destroy --stack <name-or-id> --project-id <projectId> --force --no-waitdoctor
USAGE
$ sanity blueprints doctor
FLAGS
--json Format output as json.
-p, --path=<PATH> Path to a Blueprint file or directory containing one
--verbose Verbose output; defaults to true
--fix Interactively fix configuration issues
DESCRIPTION
Analyzes your local Blueprint and remote Stack configuration for common issues, such as missing authentication, invalid project references, or misconfigured resources.
Run this command when encountering errors with other Blueprint commands. Use --fix to interactively resolve detected issues.info
USAGE
$ sanity blueprints info
FLAGS
--stack=<STACK> Stack name or ID to use instead of the locally configured Stack
DESCRIPTION
Displays the current state and metadata of your remote Stack deployment, including deployed resources, status, and configuration.
Use this command to verify a deployment succeeded, check what resources are live, or confirm which Stack your local Blueprint is connected to.
Run 'blueprints stacks' to see all available Stacks in your project or organization.
EXAMPLES
sanity blueprints info
sanity blueprints info --stack <name-or-id>init
USAGE
$ sanity blueprints init [DIR]
ARGUMENTS
[DIR] Directory to create the local Blueprint in
FLAGS
--verbose Verbose output
--dir=<DIR> Directory to create the local Blueprint in
--example=<EXAMPLE> Example to use for the local Blueprint
--blueprint-type=<BLUEPRINT-TYPE>Blueprint manifest type to use for the local Blueprint
--project-id=<PROJECT-ID> Sanity project ID used to scope local Blueprint and remote Stack
--stack-id=<STACK-ID> Existing Stack ID used to scope local Blueprint
--stack-name=<STACK-NAME> Name to use for a new Stack provisioned during initialization
DESCRIPTION
A Blueprint is your local infrastructure-as-code configuration that defines Sanity resources (datasets, functions, etc.). A Stack is the remote deployment target where your Blueprint is applied.
[NOTE: Currently, accounts are limited to three (3) Stacks per project scope.]
This is typically the first command you run in a new project. It creates a local Blueprint manifest file (sanity.blueprint.ts, .js, or .json) and provisions a new remote Stack.
Additionally, a Blueprint configuration file is created in .sanity/ containing the scope and Stack IDs. This is .gitignored by default.
After initialization, use 'blueprints plan' to preview changes, then 'blueprints deploy' to apply them.
EXAMPLES
sanity blueprints init
sanity blueprints init [directory]
sanity blueprints init --blueprint-type <json|js|ts>
sanity blueprints init --blueprint-type <json|js|ts> --project-id <projectId> --stack-id <stackId>
sanity blueprints init --blueprint-type <json|js|ts> --stack-name <stackName>logs
USAGE
$ sanity blueprints logs
FLAGS
--stack=<STACK> Stack name or ID to use instead of the locally configured Stack
-w, --watch Watch for new Stack logs (streaming mode)
DESCRIPTION
Retrieves Stack deployment logs, useful for debugging and monitoring deployment activity.
Use --watch (-w) to stream logs in real-time.
If you're not seeing expected logs, verify your Stack is deployed with 'blueprints info'.
EXAMPLES
sanity blueprints logs
sanity blueprints logs --watchplan
USAGE
$ sanity blueprints plan
FLAGS
--stack=<STACK> Stack name or ID to use instead of the locally configured Stack
DESCRIPTION
Use this command to preview what changes will be applied to your remote Stack before deploying. This is a safe, read-only operation—no resources are created, modified, or deleted.
Run 'blueprints plan' after making local changes to your Blueprint manifest to verify the expected diff. When ready, run 'blueprints deploy' to apply changes.
EXAMPLES
sanity blueprints planstacks
USAGE
$ sanity blueprints stacks
FLAGS
--project-id=<PROJECT-ID> Project ID to show Stack deployments for
DESCRIPTION
Shows all Stacks associated with a project or organization. By default, lists Stacks scoped to the local Blueprint.
Use this to discover existing Stacks you can scope a local Blueprint to (using 'blueprints config --edit'), or to audit what's deployed across your project.
EXAMPLES
sanity blueprints stacks
sanity blueprints stacks --project-id <projectId>
sanity blueprints stacks --organization-id <organizationId>