Sanity Functions
Product · API / developer platform by Sanity
Trigger business logic on content changes with serverless compute.
Sanity Functions is a serverless compute service that runs business logic in response to content changes, enabling automated workflows and real-time system synchronization without managing infrastructure.
Category: Serverless
- APIs and SDKs
- Sanity Client, Agent API, HTTP API
- Platforms
- API, Cloud
- Deployment
- Fully managed cloud infrastructure
- Integrations
- Shopify, NetSuite, ERP, CRM, eCommerce, AI services
- Monthly Invocations (Free)
- 500,000
- Monthly Compute (Free)
- 20,000 GB-seconds
- 500,000 free invocations per month on all plans
- 20,000 GB-seconds of included compute monthly
- Trigger logic directly from content mutations
- Automate AI workflows via Agent API integration
Overview
Sanity Functions is a serverless compute service designed for developers to run business logic directly where their content lives. It enables the automation of manual content operations, such as enriching data, tagging metadata, and synchronizing with external systems like ERPs or CRMs. By triggering logic in response to content mutations, it eliminates the need for teams to manage separate infrastructure for content-related workflows. The service is a core component of the Sanity AI Content Operating System, supporting "if this, then that" combinations for real-time content delivery and AI-driven automation. It scales from individual projects to enterprise needs with high-frequency execution and scheduled task capabilities.
Automation and Logic
- Serverless Content Compute: Functions are serverless compute units that run business logic tied directly to content mutations in the Sanity platform.
- Content Automation: Automate tasks such as content enrichment, metadata tagging, and data validation without managing external infrastructure.
- Real-time Synchronization: Trigger business logic to invalidate caches or sync systems instantly when content changes occur.
- AI Orchestration: Functions can trigger schema-aware AI processes like content enrichment or workflow routing via the Agent API.
Quotas and Performance
- 500k Monthly Invocations: All plans include 500,000 function invocations per month to support high-frequency content operations.
- 20k GB-seconds Compute: The service provides 20,000 GB-seconds of compute time per month across all organization tiers.
- Scheduled Execution: Free plans support 2 daily scheduled functions, while Enterprise plans allow up to 20 functions running every minute.
- Scalable Overage Pricing: Additional invocations beyond the included quota are priced at $1.00 per 1 million.
Use cases
- Developers run serverless functions to invalidate caches or sync systems the moment content is published.
- Content teams automate metadata tagging and content enrichment triggered by document mutations.
- E-commerce businesses sync product data between Sanity, Shopify, and NetSuite without manual intervention.
- Organizations trigger AI-powered translation workflows through the Agent API using event-driven functions.
Specifications
- APIs and SDKs
- Sanity Client, Agent API, HTTP API
- Platforms
- API, Cloud
- Limits
- 500k invocations/month, 20k GB-seconds compute/month, 2 to 20 scheduled functions
- Deployment
- Fully managed cloud infrastructure
- Integrations
- Shopify, NetSuite, ERP, CRM, eCommerce, AI services
- Monthly Invocations (Free)
- 500,000
- Monthly Compute (Free)
- 20,000 GB-seconds
- Scheduled Functions (Free)
- 2 daily
- Scheduled Functions (Growth)
- 5 hourly
- Scheduled Functions (Enterprise)
- 20 every minute
- Additional Invocation Cost
- $1.00 per 1M
- Additional Compute Cost
- $1.00 per 20k GB-seconds
How it works
- Define Logic: Developers define business logic in code to respond to specific content mutations or scheduled intervals.
- Deploy to Cloud: Functions are deployed to Sanity's managed cloud infrastructure, requiring no separate server management.
- Automatic Execution: The function executes automatically whenever the specified content change or scheduled time occurs.
Pricing
- Included Invocations (All Plans)
- 500k per month included
- Additional Invocations
- $1.00 per 1M
- Included Compute (All Plans)
- 20k GB-seconds per month included
- Additional Compute
- $1.00 per 20k GB-seconds
FAQ
How many invocations are included in the free plan?
Every Sanity plan, including the Free tier, includes 500,000 function invocations and 20,000 GB-seconds of compute per month.
What triggers a Sanity Function?
Functions are triggered by content mutations, allowing you to run serverless logic whenever a document is created, updated, or deleted.
How often can scheduled functions run?
The frequency depends on your plan: Free plans are daily, Growth plans are hourly, and Enterprise plans can run every minute.
What happens if I exceed my monthly function limits?
Additional invocations are available for $1.00 per 1 million, and extra compute is $1.00 per 20,000 GB-seconds.
Added by AntSpace from public sources (sanity.io).