Skip to content
Sanity
    • Platform

      Sanity Studio

      Flexible editing environment

      APIs

      Connect to anything

      Content Lake

      Real-time database

      Try product demo

      Features

      Real-time collaboration

      Fearlessly work with content

      Precise content querying

      Treat content as data with GROQ

      Localization

      Coherent messaging across territories

    • Use cases

      E-commerce

      Richer shopping experiences

      Marketing sites

      Control your story

      Products & services

      Innovate and automate

      Mobile apps

      Content backend for every OS

      View all

      Integrations

      Shopify
      Mux
      Vercel
      Netlify
      Algolia
      Cloudinary
      BigCommerce
      Commerce Layer
      Smartling
      Transifex
      View all
    • Learn

      Documentation
      Studio API Reference
      API reference
      Guides
      GROQ cheat sheet
      Sanity UI
      Get started

      Build and share

      Templates
      Tools and plugins
      Schemas and snippets
      Project showcase
      Share your work
      Browse Exchange

      Frameworks

      React
      Vue
      Next.js
      Nuxt.js
      Svelte
      Remix
      Gatsby
      Astro
      Angular
      Eleventy
      View all
    • Discover

      Blog
      Resource library
      Agency partners
      Become a partner
      Technical support
      Talk to sales

      Case studies

      Puma

      Source of truth for global markets

      Aether

      Unique digital shopping experience

      Morning Brew

      Omnichannel media distribution

      InVision

      Delivering exceptional customer experiences

      View all

      Popular guides

      Headless CMS
      Structured content
      Content modeling
      Headless SEO
      Static websites
      View all
    • Enterprise
    • Pricing
    • Log in
    • Contact sales
    • Get started
Contact salesGet started
Published June 25th 2019

Introducing History API & Experience

We're happy to introduce document history for Sanity Studio, as well an a documented History API. Now you can roll back documents to earlier revisions and see who did changes.

Even Eidsten Westvang

Sanity.io co-founder and product person

We’re thrilled to announce that we have released a new document history experience in Sanity Studio, as well as a new API for querying document revisions. Upgrade your Studio (sanity upgrade) to get the new features, and visit our documentation.

Now you can browse revisions for documents, as well as restore earlier versions. Both via an API and in Sanity Studio. You can now also see who made the edits which is a significant improvement to collaborative workflows.

The History API and Experience

To make a History Experience for people working with content in the Studio, we had to build APIs that it could query. Obviously, since the Studio is open source and can be hosted anywhere, we had to make these APIs are available for you to use however you see fit outside of the Studio as well. To learn more about the different endpoints and how they work, check out the API documentation.

What we call “History Experience” is the user interface for browsing through revisions, and restoring them within the Studio. This includes some new labels for document status, which we hope will make it easier to spot if a document is a draft, and if it has been published.

This UI is only the first public iteration. Features like diffing between revisions will come at a later point. It's a non-trivial design challenge, since Sanity allows you to have deeply nested structured content. We really want to get diffing right, so it's both intuitive and useful for people who work with content.

How long do we remember?

History retention is the amount of time you have access to these revisions before they are automatically deleted. The latest version of your published and drafted document will always be available.

The retention period on your documents are defined by the plan you are on. We count retention time backward from the current day.

The retention time for the different plans are:

  • Standard (free, pay-as-you-go): 3 days
  • Advanced: 90 days, can be upgraded to 365 days
  • Enterprise: 365 days, or contact us for custom retention

Revisions that are older than the cutoff will be truncated into one revision item, older transactions will be permanently deleted. The document history is truncated regularly every day.

GDPR and the ability to forget

In order to make Sanity Studio real-time we made it send debounced keystrokes as patches to the backend. From when we launched publicly in fall 2017, to spring 2018, we kept a complete history of these patches. But in order to be compliant with the European General Data Protection Regulation (GDPR), we had to build the mechanisms to be able to also forget all these patches. Forgetting is actually a feature.

According to the GDPR, you need to be able to guarantee your data is actually scrubbed within a given time limit. This absolutely also goes for personally sensitive data in your content. This means that staying GDPR compliant will be a breeze with Sanity, compared to other content platforms where you would have to build mechanisms to clean your history in Git or in your database.

Obviously, if you choose export your documents or patch events outside of Sanity, it will be on you to take care of in terms of GPDR compliance. Fortunately, that shouldn't be too difficult with structured content.

Page content

  • The History API and Experience
    • How long do we remember?
    • GDPR and the ability to forget

Product

Sanity StudioAPIsContent LakeSecurity & Compliance
  • Sanity vs Contentful
  • Sanity vs Strapi
  • Sanity vs Wordpress
  • Sanity vs Adobe Experience Manager
  • Sanity vs Hygraph
  • Sanity vs Sitecore
  • Sanity vs Storyblok
  • Sanity vs Contentstack
  • Sanity vs Prismic
  • Sanity vs Drupal
  • Sanity vs ButterCMS

Resources

DocumentationBlogResource libraryCase Studies
  • React Blog
  • Gatsby Blog
  • Next.js Landing Pages
  • Making a PWA
  • Single Page Application
  • Svelte & Typescript App
  • Vue & Tailwind Blog
  • Developer Portfolio Templates
  • Form validation with Yup
  • Live Preview with Next.js and Sanity.io
  • Next.js blog
  • Next.js personal website
  • Clean Next.js + Sanity app
  • Clean Remix + Sanity app
  • Clean SvelteKit + Sanity app
  • All Templates
  • Agency partners
  • Technology partners
  • Headless CMS 101
  • Static Sites 101
  • Headless Commerce 101
  • CMS for enterprise
  • Headless SEO
  • Localization
  • Content as a Service
  • What is a DXP?
  • Typescript 101
  • Ecommerce SEO
  • What is a Composable DXP?
  • What is an API?
  • GraphQL vs REST
  • React CMS
  • Next.JS CMS
  • CMS for Shopify
  • API-first CMS
  • Content platform
  • Multilingual CMS
  • Static Site CMS
  • Gatsby CMS
  • Node CMS
  • E-commerce CMS
  • Vue CMS
  • Angular CMS
  • GraphQL CMS
  • Newspaper CMS
  • Magazine CMS
  • CMS for apps
  • Remix CMS
  • Nuxt CMS
  • SvelteKit CMS
  • Agile CMS
  • Eleventy CMS

Company

Contact SalesEnterpriseCareersTerms of ServicePrivacy PolicyAccessibility Statement

Stay connected

  • GitHub
  • Slack
  • Twitter
  • YouTube
  • Stack Overflow
  • Blog RSS
  • Newsletter
©Sanity 2023