Sanity · Arazzo Workflow

Sanity Create and Verify Document

Version 1.0.0

Create a document with a mutation, then confirm it exists with a GROQ query.

1 workflow 2 source APIs 1 provider
View Spec View on GitHub Headless CMSContent ManagementGROQReal-TimeStructured ContentDeveloper PlatformArazzoWorkflows

Provider

sanity

Workflows

create-and-verify-document
Create a single document and verify it via a GROQ lookup by id.
Applies a create mutation to the dataset, then issues a GROQ query that selects the freshly created document by its id so the caller can confirm persistence and read the stored values.
2 steps inputs: apiToken, dataset, document, documentId, projectId outputs: createdId, transactionId, verifiedDocument
1
createDocument
Apply a single create mutation that inserts the supplied document into the dataset and returns the created document id.
2
verifyDocument
Run a GROQ query that fetches the document by its id to confirm the mutation persisted and to read back the stored document.

Source API Descriptions

Arazzo Workflow Specification

Raw ↑
arazzo: 1.0.1
info:
  title: Sanity Create and Verify Document
  summary: Create a document with a mutation, then confirm it exists with a GROQ query.
  description: >-
    The foundational Sanity write-then-read pattern. The workflow submits a
    create mutation to the Content Lake for a new document, captures the
    transaction id and the resulting document id, and then runs a GROQ query
    fetching the document by its id to confirm the write landed and to read
    back the persisted fields. Every step spells out its request inline so the
    flow can be read and executed without opening the underlying OpenAPI
    description.
  version: 1.0.0
sourceDescriptions:
- name: mutationsApi
  url: ../openapi/sanity-mutations-api-openapi.yml
  type: openapi
- name: queryApi
  url: ../openapi/sanity-query-api-openapi.yml
  type: openapi
workflows:
- workflowId: create-and-verify-document
  summary: Create a single document and verify it via a GROQ lookup by id.
  description: >-
    Applies a create mutation to the dataset, then issues a GROQ query that
    selects the freshly created document by its id so the caller can confirm
    persistence and read the stored values.
  inputs:
    type: object
    required:
    - projectId
    - apiToken
    - dataset
    - documentId
    - document
    properties:
      projectId:
        type: string
        description: The Sanity project id that scopes the API endpoint.
      apiToken:
        type: string
        description: Sanity project API token used as a Bearer credential.
      dataset:
        type: string
        description: Dataset name to write into (e.g. production).
      documentId:
        type: string
        description: The _id to assign to the new document.
      document:
        type: object
        description: >-
          The full document body including _type. The _id is set by the
          workflow from documentId.
  steps:
  - stepId: createDocument
    description: >-
      Apply a single create mutation that inserts the supplied document into
      the dataset and returns the created document id.
    operationId: mutateDocuments
    parameters:
    - name: Authorization
      in: header
      value: "Bearer $inputs.apiToken"
    - name: dataset
      in: path
      value: $inputs.dataset
    - name: returnIds
      in: query
      value: true
    requestBody:
      contentType: application/json
      payload:
        mutations:
        - create:
            _id: $inputs.documentId
            _type: $inputs.document._type
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      transactionId: $response.body#/transactionId
      createdId: $response.body#/results/0/id
  - stepId: verifyDocument
    description: >-
      Run a GROQ query that fetches the document by its id to confirm the
      mutation persisted and to read back the stored document.
    operationId: queryDocumentsPost
    parameters:
    - name: Authorization
      in: header
      value: "Bearer $inputs.apiToken"
    - name: dataset
      in: path
      value: $inputs.dataset
    requestBody:
      contentType: application/json
      payload:
        query: "*[_id == $id][0]"
        params:
          id: $steps.createDocument.outputs.createdId
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      verifiedDocument: $response.body#/result
  outputs:
    transactionId: $steps.createDocument.outputs.transactionId
    createdId: $steps.createDocument.outputs.createdId
    verifiedDocument: $steps.verifyDocument.outputs.verifiedDocument

Work with this as data

Every workflow here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for arazzo workflows

4 MCP tools reach this
  • find_arazzoBrowse and filter every workflow in the catalog.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This workflow
curl "https://apis.io/api/v1/arazzo/sanity-create-and-verify-document-workflow"
All arazzo workflows
curl "https://apis.io/api/v1/arazzo?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.