
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeGreat question! Here's what you need to know about dataset deletion and data recovery in Sanity:
Sanity does not keep automatic backups of your datasets. If you delete a dataset entirely, that's a permanent action and there's no built-in way to restore it from Sanity's side.
Sanity does provide Document History which allows you to revert individual documents to previous versions, but this only works for documents that still exist and within your plan's retention period:
You can access document history by clicking the document status indicator at the bottom of the editor or through the contextual menu. You can also use the History API to programmatically restore previous versions using the _rev property.
If you accidentally delete individual documents (not the entire dataset), you can restore them within your history retention period using the document's _id via the Studio URL or the History API programmatically. However, if the document is deleted entirely and you're outside the retention period, it's gone.
Since Sanity doesn't maintain dataset-level backups, you need to create your own backups using the Sanity CLI:
Export a dataset:
sanity dataset export datasetnameRestore from backup:
sanity dataset import datasetname.tar.gz datasetnameI'd strongly recommend setting up regular automated exports if you want point-in-time recovery capabilities at the dataset level. This is especially important for production environments where you might need to roll back significant changes or recover from accidental deletion. You could automate this with a cron job or scheduled task to export your dataset daily or weekly, depending on your needs.
The key takeaway: Document History is great for individual document changes within the retention period, but for full dataset protection, you need to manage your own backups via export/import.
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