Unlock seamless workflows and faster delivery with our latest releases - Join the deep dive

How to switch between datasets in Sanity Studio Desk using Experimental Spaces API

3 replies
Last updated: Jun 12, 2023
I have a website using a production dataset with all the content already filled. I would like to create a production clone of this website but with some changes on the dataset content, no the structure. I’m currently using sanity v2, I tired creating a new data set on the same project and coping the contents from the original dataset to the new, this worked for cloning the dataset however I’m not sure how to select which dataset I want to edit when working on the Sanity Studio Desk. Any ideas? Thank you! 🙏
Jun 12, 2023, 7:09 PM
In V2, you can use the Experimental Spaces API to switch between datasets. Here’s an example of what you would add to your `sanity.json`:
"__experimental_spaces": [
    {
      "name": "production",
      "title": "Prod",
      "default": true,
      "api": {
        "projectId": "my-project-id",
        "dataset": "production"
      }
    },
    {
      "name": "staging",
      "title": "Staging",
      "api": {
        "projectId": "my-project-id",
        "dataset": "staging"
      }
    }
  ],
Jun 12, 2023, 7:12 PM
This worked nicely, thanks!
Jun 12, 2023, 7:21 PM
Great!
Jun 12, 2023, 7:22 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?