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

Restoring accidentally deleted documents in Sanity dataset without exporting.

34 repliesLast updated: Nov 29, 2025

Is there a way to restore docs from a dataset in sanity, I accidentally wiped all my products.
AI Update

I'm really sorry to hear about your products getting wiped! The good news is that yes, you can likely restore them using Sanity's document history system, as long as the deletion happened within your plan's retention period.

Quick Recovery Steps

The fastest way to restore your deleted products is through the History API. Here's what you need to know:

First, check your retention window:

If your deletion happened within this window, your data is still recoverable!

How to Restore Deleted Documents

Even though documents are deleted, you can still access them if you know their _id. You have two main options:

Option 1: Via Studio URL (Manual)

Use the History API to retrieve previous versions of your deleted products, then restore them using the JavaScript client's createOrReplace() method with the entire document from the history API as the payload.

Here's a basic approach:

You can find detailed guidance on this process in the restoring deleted documents guide and these community answers about restoring accidentally deleted documents.

Important Notes

If you're on a Free plan and it's been more than 3 days, or if you need help with the restoration process, I'd recommend reaching out to Sanity support directly—they may be able to help depending on your situation.

Show original thread
34 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