Sanity · Arazzo Workflow

Sanity Upload Asset and Reference

Version 1.0.0

Upload an image asset, then create a document that references it.

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

Provider

sanity

Workflows

upload-asset-and-reference
Upload an image asset and wire it into a new document via a reference.
Uploads an image to the dataset, reads back the asset document id, and creates a document that references the asset through a standard Sanity image field.
2 steps inputs: apiToken, dataset, documentId, documentType, filename, imageBinary, projectId outputs: assetId, assetUrl, documentId
1
uploadAsset
Upload the binary image to the Content Lake and capture the asset document id and public url.
2
referenceAsset
Create a document with an image field whose asset reference points at the uploaded asset id.

Source API Descriptions

Arazzo Workflow Specification

Raw ↑
arazzo: 1.0.1
info:
  title: Sanity Upload Asset and Reference
  summary: Upload an image asset, then create a document that references it.
  description: >-
    The asset ingestion pattern for the Content Lake. The workflow uploads
    binary image data to the assets endpoint, captures the resulting asset
    document id and url, and then applies a create mutation that builds a new
    document holding an image field whose asset reference points at the freshly
    uploaded asset. 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: assetsApi
  url: ../openapi/sanity-assets-api-openapi.yml
  type: openapi
- name: mutationsApi
  url: ../openapi/sanity-mutations-api-openapi.yml
  type: openapi
workflows:
- workflowId: upload-asset-and-reference
  summary: Upload an image asset and wire it into a new document via a reference.
  description: >-
    Uploads an image to the dataset, reads back the asset document id, and
    creates a document that references the asset through a standard Sanity
    image field.
  inputs:
    type: object
    required:
    - projectId
    - apiToken
    - dataset
    - imageBinary
    - documentId
    - documentType
    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 upload into and write into.
      imageBinary:
        type: string
        description: Raw binary image content to upload (JPEG, PNG, WebP, GIF, or SVG).
      filename:
        type: string
        description: Optional original filename to record on the asset.
      documentId:
        type: string
        description: The _id to assign to the new referencing document.
      documentType:
        type: string
        description: The _type of the new document that will hold the image.
  steps:
  - stepId: uploadAsset
    description: >-
      Upload the binary image to the Content Lake and capture the asset
      document id and public url.
    operationId: uploadImageAsset
    parameters:
    - name: Authorization
      in: header
      value: "Bearer $inputs.apiToken"
    - name: dataset
      in: path
      value: $inputs.dataset
    - name: filename
      in: query
      value: $inputs.filename
    requestBody:
      contentType: image/*
      payload: $inputs.imageBinary
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      assetId: $response.body#/document/_id
      assetUrl: $response.body#/document/url
  - stepId: referenceAsset
    description: >-
      Create a document with an image field whose asset reference points at the
      uploaded asset 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.documentType
            image:
              _type: image
              asset:
                _type: reference
                _ref: $steps.uploadAsset.outputs.assetId
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      transactionId: $response.body#/transactionId
      documentId: $response.body#/results/0/id
  outputs:
    assetId: $steps.uploadAsset.outputs.assetId
    assetUrl: $steps.uploadAsset.outputs.assetUrl
    documentId: $steps.referenceAsset.outputs.documentId

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-upload-asset-and-reference-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.