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

Deleting lost data in Sanity.io using the API

9 replies
Last updated: Oct 28, 2020
Another question: I deleted a content type named “Category” but it seems the data that was created with it is still there somewhere. I get a graphql warning that documents exists with this type that I cannot access anymore. Is there a way to clean up this “lost data”?
Oct 28, 2020, 10:48 AM
you can try to fetch documentIds and remove it through API
Oct 28, 2020, 11:47 AM
I have the documentIds. How can you remove them through the API?
Oct 28, 2020, 2:24 PM
client.delete('bike-123')
  .then(res => {
    console.log('Bike deleted')
  })
  .catch(err => {
    console.error('Delete failed: ', err.message)
  })
Oct 28, 2020, 2:25 PM
Thx again!
Oct 28, 2020, 2:26 PM
I have the documentIds. How can you remove them through the API?
Oct 28, 2020, 2:24 PM
client.delete('bike-123')
  .then(res => {
    console.log('Bike deleted')
  })
  .catch(err => {
    console.error('Delete failed: ', err.message)
  })
Oct 28, 2020, 2:25 PM
Thx again!
Oct 28, 2020, 2:26 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?