How to delete all docs of a specific doc type via cli?

3 replies
Last updated: Nov 13, 2020
Hi all, just ran an import, there's some issues with some of the data so I need to delete all docs of a specific doc type... any ideas via cli?
sanityClient.delete({
  query: `*[_type == "post"]`
})
And allow read/write access to your token
Thanks for the tip!

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?