👋 Next.js Conf 2024: Come build, party, run, and connect with us! See all events

How to backup and restore data in Sanity.io using the CLI.

2 replies
Last updated: Dec 12, 2023
Hello i was wondering what would happen if i delete a dataset, is there a way to revert data to a certain point in time ?
Dec 12, 2023, 6:09 PM
you need to backup your own data using the CLI
sanity dataset export datasetname
and then restore that data using the import command
sanity dataset import datasetname.tar.gz datasetname
Dec 12, 2023, 6:20 PM
We do not keep backups. You could technically use the History API to try to revert changes within document, but if it’s deleted entirely that’s a no go. It’s best to use the method Parker mentioned on a regular basis.
Dec 12, 2023, 7:41 PM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?