
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeYou're on the right track! The __experimental_actions property you mentioned was from Sanity v2 and is no longer the correct approach in v3. Here's how to properly disable delete and duplicate actions for a document type in the current version of Sanity:
You need to use the document.actions configuration in your sanity.config.ts file. Here's how to filter out the delete and duplicate actions for a specific document type:
import {defineConfig} from 'sanity'
export default defineConfig({
// ... rest of your config
document: {
actions: (prev, context) => {
// For your singleton document type, remove delete and duplicate actions
if (context.schemaType === 'yourDocumentType') {
return prev.filter(
(action) => action.action !== 'delete' && action.action !== 'duplicate'
)
}
return prev
},
},
})Replace 'yourDocumentType' with the actual name of your document type.
If you need to apply this to multiple document types:
document: {
actions: (prev, context) => {
const singletonTypes = ['settings', 'homepage', 'footer']
if (singletonTypes.includes(context.schemaType)) {
return prev.filter(
(action) => !['delete', 'duplicate'].includes(action.action || '')
)
}
return prev
},
}For a singleton pattern, you'd typically combine this with Structure Builder configuration:
import {defineConfig} from 'sanity'
import {structureTool} from 'sanity/structure'
export default defineConfig({
// ... other config
plugins: [
structureTool({
structure: (S) =>
S.list()
.title('Content')
.items([
S.listItem()
.title('Settings')
.child(
S.document()
.schemaType('settings')
.documentId('settings')
),
// ... other items
])
})
],
document: {
actions: (prev, context) => {
if (context.schemaType === 'settings') {
return prev.filter(
(action) => action.action !== 'delete' && action.action !== 'duplicate'
)
}
return prev
},
},
})This approach:
The key difference from v2 is that you're now filtering the prev array of actions rather than setting a property on the schema type itself. You can read more about this in the Document Actions documentation.
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