Create and Verify Document
A 2-step recipe with Sanity. We can help you get access.
Recipe · 2 steps
Create and Verify Document
with Sanity
Create a single document and verify it via a GROQ lookup by id.
- Apply a single create mutation that inserts the supplied document into the dataset and returns the created document id.
- Run a GROQ query that fetches the document by its id to confirm the mutation persisted and to read back the stored document.
What you'll need to have ready
- projectId: The Sanity project id that scopes the API endpoint.
- apiToken: Sanity project API token used as a Bearer credential.
- dataset: Dataset name to write into (e.g. production).
- documentId: The _id to assign to the new document.
- document: The full document body including _type. The _id is set by the workflow from documentId.
For your developer
Arazzo workflow sanity:create-and-verify-document, 2 operations: mutateDocuments → queryDocumentsPost. Specs on APIs.io.