AutomationTasks

Sanity

Fetch schemas, publish documents, or upload images to Sanity.

Task type: Sanity

Use Sanity for combined Sanity operations such as fetching schemas, publishing documents, or uploading images.

Run behavior

  • Side effects: This task can change data or call an external system. Test with safe records and be careful when rerunning.
  • Credit usage: This task is not classified as credit-billed by the workflow task registry.

When to use this task

  • Use one Sanity task mode for a focused CMS operation.
  • Upload an image before publishing a document.
  • Publish a document when the specific helper task does not fit your workflow shape.

Setup tips

  • Choose the narrowest mode that matches the operation.
  • Keep project id, dataset, document type, and document id consistent.
  • Validate JSON before publish modes.

Examples

Upload image then publish

Upload an image, use the returned asset reference in a document object, then publish the document.

Outputs

  • Mode-specific Sanity operation result.

Common pitfalls

  • Using the generic Sanity task when a specific Sanity task would be clearer.
  • Mixing dataset or document type values across steps.
  • Publishing side effects during early tests.

Reference details

These details are generated from the workflow task registry and match the fields available in the builder.

Required fields

  • mode
  • projectId

Variable-aware fields

Fields that accept variable references ({{ inputs.x }}, {{ steps.N.y }}) from the workflow's variable graph:

  • documentType
  • documentId
  • document
  • imageUrl

Liquid template fields

Fields that are rendered through Liquid (variables plus filters and control flow):

  • documentType
  • documentId
  • document
  • imageUrl

Builder guidance

When the Workflow Builder Genie configures this task, it follows this guidance:

Choose the narrowest Sanity operation and validate required project/document fields.

Default configuration

New instances of this task start with the following configuration:

{
  "name": "Sanity: Publish Document",
  "outputKey": "sanity_publish",
  "taskType": "Sanity",
  "description": "",
  "mode": "publish_document",
  "projectId": "",
  "dataset": "production",
  "documentType": "",
  "documentId": "",
  "document": "{}",
  "apiVersion": "2021-06-07",
  "imageUrl": ""
}

On this page