Documentation

    • Overview
    • Platform introduction
    • AI coding agents
    • AI app builders
    • Next.js quickstart
    • Nuxt.js quickstart
    • Astro quickstart
    • React Router quickstart
    • Studio quickstart
    • Build with AI
    • Content Lake
    • Functions
    • APIs and SDKs
    • Agent Actions
    • Visual Editing
    • Blueprints
    • Platform management
    • Dashboard
    • Studio
    • Canvas
    • Media Library
    • App SDK
    • Content Agent
    • Next.js
    • Astro
    • APIs and SDKs
    • HTTP API
    • CLI
    • Libraries
    • Specifications
    • Changelog
    • User guides
    • Developer guides
    • Courses and certifications
    • Join the community
    • Templates
Functions
Overview

  • Introduction
  • Get started

    Create a Document Function
    Create a Media Library Asset Function
    Create a Sync Tag Invalidate Function
    Create a Scheduled Function
    Official recipes

  • Concepts

    Manage dependencies
    Local testing

  • Guides

    Configure @sanity/client
    Add environment variables
    Assign custom robot tokens
    Common patterns

  • Reference

    Handler reference
    Function CLI commandsCLI reference

FunctionsLast updated April 15, 2026

Deploy custom functions to automate content operations

Sanity Functions enable you to execute custom logic whenever changes occur in your content—all without requiring your own infrastructure.

Create your first function

Create a Document Function

Start building with Functions by deploying a new function to Sanity's infrastructure.

Create a Media Library Asset Function

Start building a function that reacts to changes to a Media Library asset.

Official recipes

Get started with pre-built functions for popular use cases

Core concepts and guides

Introduction

Learn how to take advantage of Functions in your Sanity projects.

Testing functions locally

Simulate Functions locally with real data and an interactive playground.

Configure @sanity/client in Functions

Learn to use the JavaScript client in a Sanity Function.

Add environment variables to functions

Learn to add environment variables to Functions.

Functions cheat sheet

Common patterns and techniques for creating Functions.

sanity.io
© Sanity 2026
Change Site Theme
All Systems Operational