CLI reference

Migrations CLI command reference

Create, list, and run content migrations

npx sanity migrations --help

Commands

create

USAGE
  $ sanity migrations create [TITLE]

ARGUMENTS
  [TITLE]  Title of migration

DESCRIPTION
  Create a new migration within your project

EXAMPLES
  Create a new migration, prompting for title and options

    $ sanity migrations create

  Create a new migration with the provided title, prompting for options

    $ sanity migrations create "Rename field from location to address"

list

USAGE
  $ sanity migrations list

DESCRIPTION
  List available migrations

EXAMPLES
  List all available migrations in the project

    $ sanity migrations list

run

USAGE
  $ sanity migrations run [ID] [-p <id>] [--api-version <value>] [--concurrency <value>] [--confirm] [--dataset <value>] [--dry-run] [--from-export <value>] [--progress]

ARGUMENTS
  [ID]  ID

FLAGS
      --api-version=<value>  API version to use when migrating. Defaults to v2024-01-29.
      --concurrency=<value>  How many mutation requests to run in parallel. Must be between 1 and 10. Default: 6.
      --confirm              Prompt for confirmation before running the migration (default: true). Use --no-confirm to skip.
      --dataset=<value>      Dataset to migrate. Defaults to the dataset configured in your Sanity CLI config.
      --dry-run              By default the migration runs in dry mode. Use --no-dry-run to migrate dataset.
      --from-export=<value>  Use a local dataset export as source for migration instead of calling the Sanity API. Note: this is only supported for dry runs.
      --progress             Display progress during migration (default: true). Use --no-progress to hide output.

OVERRIDE FLAGS
  -p, --project=<id>  Project ID of the dataset to migrate (overrides CLI configuration)

DESCRIPTION
  Run a migration against a dataset

EXAMPLES
  dry run the migration

    $ sanity migrations run <id>

  execute the migration against a dataset

    $ sanity migrations run <id> --no-dry-run --project xyz --dataset staging

  execute the migration using a dataset export as the source

    $ sanity migrations run <id> --from-export=production.tar.gz --no-dry-run --project xyz --dataset staging

Was this page helpful?

Sanity logosanity.ioAll Systems Operational© Sanity 2026
Change site theme