AI agents need structure. Build the foundation now

Structure powers intelligence

The back-end built for AI content operations. Power web, mobile, and agentic applications at scale.

Mirror how your content operations team works

Page title

Page description goes here

import {defineField, defineType} from 'sanity'

export const heroType = defineType({
  name: 'hero',
  title: 'Hero',
  type: 'document',
  fields: [
    defineField({
      name: 'title',
      title: 'Title',
      type: 'string',
      validation: (Rule) => Rule.required(),
    }),
    defineField({
      name: 'description',
      title: 'Description',
      type: 'text',
      rows: 3,
    }),
    defineField({
      name: 'image',
      title: 'Image',
      type: 'image',
      options: {
        hotspot: true,
      },
      fields: [
        {
          name: 'alt',
          type: 'string',
          title: 'Alternative text',
          description: 'Important for SEO and accessibility.',
        },
      ],
    }),
  ],
  preview: {
    select: {
      title: 'title',
      subtitle: 'description',
      media: 'image',
    },
  },
})

Studio/Homepage/Hero

No changes yet
History
Sanity stores revisions for every document.

New Content Release

DocumentsAction
Locale: US-ESadd
Locale: EU-FRadd
Site nav barchange
Ai Context Promopublish

Content Operations without the busywork

Agent actions, functions, and content agents automate manual work before and after hitting publish.

Look up all products
look up all blog posts
find posts missing translations
focus on content from the last 2 weeks
Smiling Black man in a black and white headshot.
Sanity StudioJust now

@Jason published a new product: ST07 Winter Jacket

Trigger
import {documentEventHandler} from '@sanity/functions'
import {createClient} from '@sanity/client'

const STOREFRONT_WEBHOOK = process.env.STOREFRONT_WEBHOOK_URL

export const handler = documentEventHandler(async ({context, event}) => {
  const {data} = event

  if (!STOREFRONT_WEBHOOK) {
    console.error('❌ STOREFRONT_WEBHOOK_URL not found in environment variables')
    return
  }

  const client = createClient({
    ...context.clientOptions,
    apiVersion: '2025-06-01',
  })

  // Find every document that references the published product
  const referencing = await client.fetch(
    `*[references($id)]{
      _id,
      _type,
      title,
      "slug": slug.current
    }`,
    {id: data._id},
  )

  if (!referencing.length) {
    console.log(`📭 No references found for ${data._id}`)
    return
  }

  console.log(`🔗 Found ${referencing.length} documents referencing ${data._id}`)

  // Notify the storefront so it can rebuild affected pages
  try {
    const response = await fetch(STOREFRONT_WEBHOOK, {
      method: 'POST',
      headers: {'Content-Type': 'application/json'},
      body: JSON.stringify({
        event: 'product.updated',
        productId: data._id,
        affectedPages: referencing.map((doc) => ({
          id: doc._id,
          type: doc._type,
          slug: doc.slug,
        })),
      }),
    })

    if (!response.ok) {
      throw new Error(`Webhook returned ${response.status}`)
    }

    console.log(`✅ Storefront notified about ${referencing.length} affected pages`)
  } catch (error) {
    console.error('❌ Failed to notify storefront:', error)
    throw error
  }
})
import {documentEventHandler} from '@sanity/functions'
import {createClient} from '@sanity/client'

const STOREFRONT_WEBHOOK = process.env.STOREFRONT_WEBHOOK_URL

export const handler = documentEventHandler(async ({context, event}) => {
  const {data} = event

  if (!STOREFRONT_WEBHOOK) {
    console.error('❌ STOREFRONT_WEBHOOK_URL not found in environment variables')
    return
  }

  const client = createClient({
    ...context.clientOptions,
    apiVersion: '2025-06-01',
  })

  // Find every document that references the published product
  const referencing = await client.fetch(
    `*[references($id)]{
      _id,
      _type,
      title,
      "slug": slug.current
    }`,
    {id: data._id},
  )

  if (!referencing.length) {
    console.log(`📭 No references found for ${data._id}`)
    return
  }

  console.log(`🔗 Found ${referencing.length} documents referencing ${data._id}`)

  // Notify the storefront so it can rebuild affected pages
  try {
    const response = await fetch(STOREFRONT_WEBHOOK, {
      method: 'POST',
      headers: {'Content-Type': 'application/json'},
      body: JSON.stringify({
        event: 'product.updated',
        productId: data._id,
        affectedPages: referencing.map((doc) => ({
          id: doc._id,
          type: doc._type,
          slug: doc.slug,
        })),
      }),
    })

    if (!response.ok) {
      throw new Error(`Webhook returned ${response.status}`)
    }

    console.log(`✅ Storefront notified about ${referencing.length} affected pages`)
  } catch (error) {
    console.error('❌ Failed to notify storefront:', error)
    throw error
  }
})
Learn More
Function
Update Products
Update Categories
Update blogs
n032232
n3900-22
n05053
Bags
Shoes
Something else
blog post 1
blog post 2
blog post 3
Output

Power anything. One API, every platform

Turn your content into a governed knowledge layer that powers applications and AI agents.

Marketing Bot
zzz...
[ click to chat ]
status:
Current Context:learn, docs
status:enabled
Pricing Bot
zzz...
[ click to chat ]
status:

Everything your team needs in one place

The database optimized for content operations

Store any valid JSON document, with schemas living in your Sanity Studio configuration, not as database constraints.

  • Schema as code
  • Query anything
  • Update with precision
  • Manage different environments
A code editor and content management interface layered over a woman's face, with a large section of her face pixelated.

Content workflows that mirror how you work

Enable creative freedom with infinitely customizable workflows.

  • A modern content studio
  • Custom content applications with App SDK
  • Preview content in context
  • Content releases with precision
  • Multiplayer-editing for teams
A content management system interface showing a hierarchical list of projects, with the "Ardent Row" brand selected and its description displayed.

An agent to run content operations at scale

The first content agent that knows your content, so you can action with accuracy at scale.

  • Transform source materials into structured content
  • Audit and edit content at scale
  • Edit visuals with natural language
  • Research trends and topics
  • Prepare changes for revision
A user interface for checking and fixing store address formatting issues, showing proposed changes for multiple cities and editable details for Atlanta, GA 30308.

Programmable automation

Automate content operations, from AI enrichment to syncing with any system, triggered by any mutation in your dataset.

  • Event driven automation
  • Full access to your content
  • Any possible “If this, then that” combination
  • Agent Actions for schema-aware AI automations
  • Write once, use everywhere
illustration of someone publishing a document that triggers a function

Power web, mobile, or your own agent

Now, with Sanity you can power not only web and content applications but your own agents. Structured data that powers intelligence.

  • Structured content to agentic reasoning
  • Build your own customer-facing or internal agents
  • Agentic workflows
  • Or power any web surface or content application
Fragmented image of a dark slot canyon with orange light, featuring lists of text including "AI AGENTS" and "INTERNAL TOOLING," against a grid pattern.
A code editor and content management interface layered over a woman's face, with a large section of her face pixelated.
A content management system interface showing a hierarchical list of projects, with the "Ardent Row" brand selected and its description displayed.
A user interface for checking and fixing store address formatting issues, showing proposed changes for multiple cities and editable details for Atlanta, GA 30308.
illustration of someone publishing a document that triggers a function
Fragmented image of a dark slot canyon with orange light, featuring lists of text including "AI AGENTS" and "INTERNAL TOOLING," against a grid pattern.

Loved by 1M+ users and 6k+ teams

0

0 custom APIs

300%

Faster release cycles

90%

of updates owned by the content team

5x

faster dev velocity

144x

faster product launches

10k

products updated in 30 seconds

80

hours saved per month

60

lines of code

Zero

added services

Lady Gaga’s team had never used a CMS before. Now they are logging into Sanity and using Sanity Studio to make updates on their own.

Melody YungCreative Lead & Founder

I want to build tools and systems that, at no point, should I have to say 'no, I can't do that' it's more 'should we do that?' And if the answer is yes, then we have the stack and the ability to go and do it

Kevin HarwoodCTO

We have a marketplace and partner with a lot of brands — commerce is definitely the next big initiative for us. We're essentially becoming multiple companies at once.

Anthony RiveraDirector of Engineering at Complex

All customer stories

Enterprise-grade everything

Model, manage, automate, and scale structured content across all your brands, apps, and touch points.

> 99.95% uptime

24/7 support

Book a demo
  • SOC 2 Type II

  • GDPR

  • CCPA

Less talk, more code

CLI Install

Install Sanity and create a new project directly from your terminal.

MCP Server

Connect Sanity to your favorite tools like Cursor, Claude Code, v0, and more.

Pixelated dark gray 3D cube icon.A dark, blurry asterisk shape.A completely black image.Black heart icon.Dark grey geometric arrow symbol on a black background.Visual Studio Code logo

Agent toolkit

Best-practice Sanity skills for AI agents and popular frameworks.

Black circle with a faint 'R' inside.A very dark, pixelated abstract shape.Delta sigma symbol.Dark stylized capital R on a black background.Dark stylized S-shaped symbol.Dark, stylized letter A emblem.