Sanity Mutation icon

Sanity Mutation

Create, Read, Update, and Delete documents in Sanity.io

Delete

AI-generated

Summary

Delete a specified document from Sanity.io by its document ID.

Inputs

  • Document ID (required) — The ID of the document to delete.
  • Options — Optional settings including whether to return the full deleted document in the response and the Sanity API version to use.

Output shape

a list of mutation result objects, typically containing the deleted document data if returnDocuments option is true

The response includes details of the deleted document(s) based on the mutation results. If the 'Return Documents' option is set to false, the returned data may exclude full document details.

Examples

Example 1: Delete a document with ID 'doc-ID-12345' returning deleted document data

Set 'Document ID' to 'doc-ID-12345' and keep 'Return Documents' enabled (default).

Links

Discussion