Documentation
HomeAPISign In
  • Getting Started
    • Overview
      • Core Concepts
      • Building your First Workflow
    • API Reference
  • Your Data
    • Brand Kits
    • Knowledge Bases
      • Add Data
        • Upload Files
        • Web Scrape
        • Import from Google Drive
        • Import from SQL Database
        • Import from Shopify
      • Knowledge Base Search
      • Knowledge Base Metadata
      • Knowledge Base API
  • Building Workflows
    • Workflow Concepts
      • Workflow Inputs
        • Input Types
      • Workflow Outputs
      • Variable Referencing
      • Liquid Templating
    • Workflow Steps
      • AI
        • Prompt LLM
          • Model Selection Guide
          • Prompting Guide
        • Transcribe Audio File
      • Web Research
        • Google Search
        • Perplexity Deep Research
        • Web Page Scrape
      • Code
        • Run Code
        • Call API
        • Format JSON
        • Run SQL Query
        • Write Liquid Text
      • Flow
        • Condition
        • Iteration
        • Human Review
        • Content Comparison
        • Error
      • Data
        • Read from Grid
        • Add Rows in Grid
        • Search Knowledge Base
        • Write to Knowledge Base
        • Get Knowledge Base File
      • AirOps
        • Workflow
        • Agent
      • Image & Video
        • Generate Image with API
        • Search Stock Images
        • Fetch Stock Image with ID
        • Resize Image
        • Screenshot from URL
        • Create OpenGraph Image
        • Create Video Avatar
      • SEO Research
        • Semrush
        • Data4SEO
      • Content Quality
        • Detect AI Content
        • Scan Content for Plagiarism
      • Content Processing
        • Convert Markdown to HTML
        • Convert PDF URL to Text
        • Group Keywords into Clusters
      • B2B Enrichment
        • Hunter.io
        • People Data Labs
      • CMS Integrations
        • Webflow
        • WordPress
        • Shopify
        • Contentful
        • Sanity
        • Strapi
      • Analytics Integrations
        • Google Search Console
      • Collaboration Integrations
        • Gmail
        • Google Docs
        • Google Sheets
        • Notion
        • Slack
    • Power Steps
    • Testing and Iteration
    • Publishing and Versioning
    • Logs
    • Studio Toolbar
  • Running Workflows
    • Run Once
    • Run in Bulk (Grid)
    • Run via API
    • Run via Trigger
      • Incoming Webhook Trigger
      • Zapier
    • Run on a Schedule
    • Error Handling
  • Grids
    • Create a Grid
      • Import from Webflow
      • Import from Wordpress
      • Import from Semrush
      • Import from Google Search Console
    • Add Columns in the Grid
    • Run Workflows in the Grid
      • Add Workflow Column
      • Run Workflow Column
      • Schedule Workflow Column
      • Map Workflow Outputs
      • Review Workflow Run Metadata
    • Review Content in the Grid
      • Review Markdown Content
      • Review HTML Content
      • Compare Content Difference
    • Publish to CMS from Grid
    • Pull Analytics in the Grid
    • Searching and Filtering
    • Export as CSV
  • Copilot
    • Chat with Copilot
    • Edit Workflows with Copilot
    • Fix Errors with Copilot
  • Monitoring
    • Task Usage
    • Analytics
    • Alerts
    • Execution History
  • Your Workspace
    • Create a Workspace
    • Folders
    • Settings
    • Billing
    • Use your own LLM API Keys
    • Secrets
    • Team and Permissions
  • Chat Agents (Legacy)
    • Agent Quick Start
    • Chat Agents
    • Integrate Agents
      • Widget
      • Client Web SDK
  • About
    • Ethical AI and IP Production
    • Principles
    • Security and Compliance
Powered by GitBook
On this page
  • Authentication
  • Functions and Their Parameters
  • List Resources
  • Fetch Resource
  • Create Resource
  • Update Resource

Was this helpful?

  1. Building Workflows
  2. Workflow Steps
  3. CMS Integrations

Sanity

The Sanity Integration allows you to list, create and update posts on your Sanity.io site.

Last updated 1 month ago

Was this helpful?

Authentication

  1. Generate an API Key

    1. Go to your project Dashbaord on Sanity.io

    2. Go to the API tab

    3. Click on the "Add API Token" button

    4. Set a name for your token (i.e. "AirOps")

    5. Set the permissions as "Editor"

    6. Click on "Save"

    7. Copy the generated token

  2. Add the API Key to AirOps

    1. Go to AirOps > Settings > Integrations page

    2. Click on the "Add New" and select Sanity

    3. Paste the generated token in the API Key field

    4. Click on "Save"

Security Note: Treat your API Key like a password. It provides REST API access to your Sanity instance, and it should not be shared. Store it securely and only use it in server-side or secure/authenticated environments.

Functions and Their Parameters

Common Configuration Parameters

  1. Project ID: The ID of your Sanity project. (e.g. "w22x3y4z")

  2. Dataset: The dataset you want to use. (e.g. "production")

  3. Params: Extra parameters to use in the request. (Optional)

List Resources

Fetches a list of resources from your Sanity project. This is useful for retrieving existing posts, images, or other content types. Returns 100 records per page.

  1. Resource Type: The type of resource you want to list. (e.g. "post")

  2. Last ID: To use pagination, you can set the last ID of the previous request. (Optional)

Fetch Resource

Fetches a single resource from your Sanity project. This is useful for retrieving detailed information about a specific post or image.

Array of blocks will be returned as is but a companion data structure will be returned with the blocks attributes converted to plain HTML within the __airops.html JSON path.

  1. Resource ID: The ID of the resource you want to fetch. (e.g. "4ddb0459-2734-4611-b1af-4ee13f3d5630")

Create Resource

Creates a new resource in your Sanity project. This is useful for adding new posts, images, or other content types.

  1. Resource JSON: The JSON object representing the resource you want to create.

    • For instance: { "title": "My New Post", "category": "blog" }

    • When used in conjunction with the Resource HTML input, HTML attributes will be ignored from this input.

  2. Resource HTML: A JSON object containing the resource attribute name as the key and the HTML document as value. (Optional)

    • For instance: { "body": "<h1>My New Post</h1><p>This is the content of my new post.</p>" }

    • This is useful for creating posts with rich text content.

    • The HTML will be converted to Sanity's Portable Text structure and used in the payload to create the resource. Send as many HTML attributes as needed.

Update Resource

Updates an existing resource in your Sanity project.

  1. Resource ID: The ID of the resource you want to update. (e.g. "4ddb0459-2734-4611-b1af-4ee13f3d5630")

  2. Resource JSON: The JSON object representing the resource you want to update.

    • For instance: { "title": "My Updated Post", "category": "blog" }

    • When used in conjunction with the Resource HTML input, HTML attributes will be ignored from this input.

  3. Resource HTML: A JSON object containing the resource attribute name as the key and the HTML document as value. (Optional)

    • For instance: { "body": "<h1>My New Post</h1><p>This is the content of my new post.</p>" }

    • This is useful for creating posts with rich text content.

    • The HTML will be converted to Sanity's Portable Text structure and used in the payload to create the resource. Send as many HTML attributes as needed.

See .

See .

https://www.sanity.io/docs/js-client#creating-documents
https://www.sanity.io/docs/js-client#patchupdate-a-document
Example workflow listing resources