CLI reference
Backup CLI command reference
Reference documentation for the sanity backup CLI command.
This is a paid feature
This feature is available on certain Enterprise plans. Talk to sales to learn more.
This is reference documentation for the CLI's backup command. If you're new to the backup feature, check out our getting started guide.
npx sanity backup --help
pnpm dlx sanity backup --help
yarn dlx sanity backup --help
bunx sanity backup --help
Commands
disable
USAGE
$ sanity backup disable [DATASET]
ARGUMENTS
[DATASET] Dataset name to disable backup for
FLAGS
-p, --project-id=<PROJECT-ID> Project ID to disable backups for (overrides CLI configuration)
DESCRIPTION
Disable backup for a dataset.
EXAMPLES
Interactively disable backup for a dataset
sanity backup disable
Disable backup for the production dataset
sanity backup disable productiondownload
USAGE
$ sanity backup download [DATASET]
ARGUMENTS
[DATASET] Dataset name to download backup from
FLAGS
-p, --project-id=<PROJECT-ID> Project ID to download backup from (overrides CLI configuration)
--backup-id=<BACKUP-ID> The backup ID to download
--concurrency=<CONCURRENCY> Concurrent number of backup item downloads (max: 24)
--out=<OUT> The file or directory path the backup should download to
--overwrite Allows overwriting of existing backup file
DESCRIPTION
Download a dataset backup to a local file.
EXAMPLES
Interactively download a backup
sanity backup download
Download a specific backup for the production dataset
sanity backup download production --backup-id 2024-01-01-backup-1
Download backup to a specific file
sanity backup download production --backup-id 2024-01-01-backup-2 --out /path/to/file
Download backup and overwrite existing file
sanity backup download production --backup-id 2024-01-01-backup-3 --out /path/to/file --overwriteenable
USAGE
$ sanity backup enable [DATASET]
ARGUMENTS
[DATASET] Dataset name to enable backup for
FLAGS
-p, --project-id=<PROJECT-ID> Project ID to enable backups for (overrides CLI configuration)
DESCRIPTION
Enable backup for a dataset.
EXAMPLES
Interactively enable backup for a dataset
sanity backup enable
Enable backup for the production dataset
sanity backup enable productionlist
USAGE
$ sanity backup list [DATASET]
ARGUMENTS
[DATASET] Dataset name to list backups for
FLAGS
-p, --project-id=<PROJECT-ID> Project ID to list backups for (overrides CLI configuration)
--after=<AFTER> Only return backups after this date (inclusive, YYYY-MM-DD format)
--before=<BEFORE> Only return backups before this date (exclusive, YYYY-MM-DD format)
-l, --limit=<LIMIT> Maximum number of backups returned
DESCRIPTION
List available backups for a dataset.
EXAMPLES
List backups for a dataset interactively
sanity backup list
List backups for the production dataset
sanity backup list production
List up to 50 backups for the production dataset
sanity backup list production --limit 50
List up to 10 backups created after 2024-01-31
sanity backup list production --after 2024-01-31 --limit 10