Create
AI-generatedSummary
Create a new document in Sanity.io with specified JSON data and optional document ID, generating a random ID if omitted.
Inputs
- Document ID — Optional ID for the new document; if left blank, a random ID is generated.
- Document Data (required) — Full JSON object representing the document to create.
- Options — Additional options including 'Return Documents' (boolean) to specify if the full documents should be returned in the response, and 'API Version' to specify the Sanity API version.
Output shape
a list of document objects returned from Sanity.io mutation response
By default, the full created document(s) are returned if 'Return Documents' is true. Each input item creates one document.
Examples
Example 1: Create a new Sanity document with supplied data and auto-generated ID
Leave 'Document ID' empty, specify JSON data in 'Document Data', ensure 'Return Documents' is enabled to get back the created document.