
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeThere are a few ways to delete documents in Sanity Studio depending on your needs:
The most straightforward method is through the Studio interface:
This is part of the document actions system in Sanity Studio. The delete action is available by default for all documents unless it's been explicitly disabled through custom document actions configuration.
If you need to delete documents programmatically or in bulk, you can use the Sanity CLI:
sanity documents delete <document-id>You'll need to have the Sanity CLI installed (npm install -g @sanity/cli) and be authenticated to your project.
For bulk deletions, you can combine GROQ queries with the delete command:
sanity documents query "*[_type == 'yourType']" | sanity documents deleteYou can also delete documents programmatically using the Sanity client:
import {createClient} from '@sanity/client'
const client = createClient({
projectId: 'your-project-id',
dataset: 'your-dataset',
token: 'your-token',
apiVersion: '2024-01-01'
})
await client.delete('document-id')If you don't see the delete option in the Studio menu, it could be because:
The delete action may be filtered out for certain document types to prevent accidental deletion of critical content like site settings or configuration documents.
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.
Content operations
Content backend


The only platform powering content operations
By Industry


Tecovas strengthens their customer connections
Build and Share

Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag store