
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeGreat question! Dataset backups are definitely something you should have a strategy for. Here's what the community typically does:
The most common approach is using the Sanity CLI's export command. It's straightforward and gives you complete control:
sanity dataset export productionThis creates a production.tar.gz file containing all your documents and assets. You can specify a custom filename/location too:
sanity dataset export production ./backups/backup-2024-01-15.tar.gzThe export includes everything - all documents, assets (images/files), and hidden configuration documents used by Studio and plugins. What it doesn't include is your schema definition (that lives in your code) or system-level documents.
By default, exports are compressed as .tar.gz archives with assets included. The CLI command sanity dataset export automatically includes assets and compresses the output. If you only need documents without assets, you can export to NDJSON format, though the standard tar.gz approach is recommended for complete backups since it contains both the NDJSON data stream and your asset files in separate folders.
For production sites, manual exports aren't ideal. Here are common automation approaches:
GitHub Actions: You can set up automated backups using GitHub Actions that run on a schedule and store exports as artifacts or push them to cloud storage.
CI/CD Pipelines: Many folks integrate exports into their deployment pipelines, especially before running content migrations.
Scheduled Scripts: Write a simple script that runs sanity dataset export and uploads the result to S3, Google Cloud Storage, or your preferred backup service.
One critical practice: always export before running content migrations:
sanity dataset export production backup-before-migration.tar.gz
sanity migration run your-migrationIf something goes wrong, you can restore with:
sanity dataset import backup-before-migration.tar.gz productionIf you're on an Enterprise plan, there are managed options:
Important note: Sanity doesn't provide built-in backup storage, so you'll need to handle that yourself. Store your exports in cloud storage services with appropriate retention policies for your compliance needs.
The combination of regular automated exports to external storage plus pre-migration backups covers most disaster recovery scenarios pretty well!
Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.
Content operations
Content backend


The only platform powering content operations
By Industry


Tecovas strengthens their customer connections
Build and Share

Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag store