Restoring accidentally deleted documents in Sanity dataset without exporting.

34 replies
Last updated: Jan 28, 2026
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:

  • Free plan: 3 days
  • Growth plan: 90 days
  • Enterprise plan: 365 days

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)

  1. Navigate directly to the document using its ID in your Studio URL: https://your-studio.sanity.studio/desk/yourDocumentType;documentId
  2. Once there, you can view the document history and restore it

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:

  1. Query the History API to get the previous state of your products
  2. Use the _rev property to identify the revision you want to restore
  3. Use client.createOrReplace() with the retrieved document data

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

  • The latest version of both published and draft documents always remains available, even after the retention period
  • History beyond your retention period is permanently deleted, so act quickly
  • Sanity stores all document patches as transactions in the Content Lake, creating a complete revision history that tracks who made changes and when

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

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.

Was this answer helpful?