The site uses on-demand revalidation via a webhook that Sanity calls when content is published.
POST /api/revalidate
Add to the server:
SANITY_WEBHOOK_SECRET=secret123
- Go to manage.sanity.io
- Select the project
- Go to API > Webhooks
- Click Create webhook
- Configure:
- Name:
Revalidate site - URL:
https://your-domain.com/api/revalidate - Trigger on:
Create,Update,Delete - Filter: Leave it empty to trigger all
- Projection:
{_type}(important!) - HTTP method:
POST - HTTP Headers: Add
x-sanity-webhook-secretwithSANITY_WEBHOOK_SECRETfrom.env.local - API version: Latest (e.g.
2024-01-01) - Draft: Disabled (only trigger on publish)
- Name: