Joint session with Vercel: How to build intelligent storefronts (May 15th) →

How to back up entire Sanity dataset?

2 repliesLast updated: Nov 29, 2025

đź‘‹ Hello, team!
I need to back up my entire Sanity dataset, but I can't find any option to do so through the Sanity UI.
Thanks


help asset-sources
AI Update

You're right that there's no UI option for backing up datasets—this is done through the Sanity CLI. Here's how to back up your entire dataset including assets:

Quick Backup Command

The simplest way to export your entire dataset is:

sanity dataset export production

This creates a production.tar.gz file in your current directory containing all your documents and assets.

You can also specify a custom filename and location:

sanity dataset export production ./backups/backup-2024-01-15.tar.gz

What Gets Included

The export includes:

Note: The export doesn't include your schema definition (that lives in your Studio code) or access control settings.

Export Formats

By default, you get a tar.gz archive with documents in NDJSON format plus assets in separate folders. If you only need documents without assets, you can export to NDJSON format instead.

Restoring from Backup

If you ever need to restore, use the import command:

sanity dataset import backup-2024-01-15.tar.gz production

Best Practices

Since Sanity doesn't provide built-in backup storage, you should:

For enterprise plans, there's also a managed Backup feature with retention policies and a Cloud Clone feature for server-side dataset copying without downloading locally.

Make sure you have the Sanity CLI installed (npm install -g @sanity/cli) and are authenticated (sanity login) before running export commands!

Show original thread
2 replies

Was this answer helpful?

Sanity – Build the way you think, not the way your CMS thinks

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.

Related contributions