How to Monitor Your Sanity.io Backend with Vigilmon
Sanity.io is a real-time headless CMS used by editorial teams at large publishers, e-commerce companies, and developer-focused startups. When the GROQ API goes down, your frontend fails to fetch content — and your editors' Studio sessions stop saving. Vigilmon keeps you ahead of Sanity outages with instant multi-region alerts.
What Can Fail in a Sanity Integration?
-
Content Lake API downtime —
api.sanity.iounreachable -
CORS misconfiguration — API returns
403after a dataset change - Token revocation — API key expired or rotated by another team member
- Webhook delivery — Sanity stops notifying your rebuild endpoint
- Sanity CDN (apicdn.sanity.io) — edge cache down but origin is fine
Each of these needs a separate monitor.
Sanity API Endpoints to Monitor
1. Content API Health Check
Sanity's GROQ API uses this URL format:
https://{projectId}.api.sanity.io/v2021-10-21/data/query/{dataset}?query=*[_type=='siteSettings'][0]
This fetches one document of your siteSettings type (or any other stable type in your schema). Replace siteSettings with a type that always has at least one document.
Vigilmon setup:
- URL: above (with your projectId and dataset)
- Header:
Authorization: Bearer {READ_TOKEN}(use a read-only token) - Expected status:
200 - Keyword:
"result"(Sanity wraps all responses in aresultkey) - Interval: 5 minutes
2. Sanity CDN Endpoint
For cached reads, Sanity routes through apicdn.sanity.io:
https://{projectId}.apicdn.sanity.io/v2021-10-21/data/query/{dataset}?query=*[_type=='siteSettings'][0]
Add a second monitor for this URL — a CDN cache problem can leave the direct API working but CDN reads failing, which is what most frontends actually use.
3. Sanity Assets CDN
Images and files are served from:
https://cdn.sanity.io/images/{projectId}/{dataset}/{assetId}-{dimensions}.{format}
Grab a stable asset URL from your media library and monitor it. Expect 200 with a Content-Type: image/* response.
4. Studio Availability (Optional)
If your editorial team accesses a hosted Studio (yourproject.sanity.studio), monitor its URL too:
https://yourproject.sanity.studio
Expect 200. Downtime here means editors can't publish — but your frontend may still work if it's serving cached content.
5. Your Webhook Receiver
Sanity triggers webhooks on document create, update, and delete. Monitor your app's webhook endpoint:
https://yourapp.com/api/revalidate
A down endpoint means ISR or SSG rebuilds stop triggering — your content stays stale.
Example GROQ Query for Health Check
Use a simple, fast query that's unlikely to change:
*[_type == 'siteSettings'][0]{_id, _type}
URL-encode it:
*%5B_type+%3D%3D+%27siteSettings%27%5D%5B0%5D%7B_id%2C+_type%7D
Full URL:
https://{projectId}.api.sanity.io/v2021-10-21/data/query/{dataset}?query=*%5B_type+%3D%3D+%27siteSettings%27%5D%5B0%5D%7B_id%2C+_type%7D
Read-Only API Token
Never use your write token in a monitoring URL — create a separate Viewer token in manage.sanity.io:
- Go to manage.sanity.io → Project → API → Tokens
- Add token → Role: Viewer
- Copy token → use in Vigilmon monitor headers
This token can read content but cannot mutate documents, safe to use in monitoring.
Alert Configuration
-
Content API + CDN: Alert immediately, Slack
#engineering. Any failure means your website is fetching no content. - Assets CDN: 2–3 failures before alerting. Image CDNs sometimes have transient hiccups.
- Studio: Slack only, business hours. Editors not in crisis at 3am.
- Webhook receiver: 1 failure → alert. Stale content is a business impact.
Summary
| Monitor | Catches |
|---|---|
Content API (api.sanity.io) |
API down, bad token, dataset error |
CDN API (apicdn.sanity.io) |
CDN cache layer failure |
Assets CDN (cdn.sanity.io) |
Image serving down |
| Studio URL | Editor access outage |
| Webhook receiver | Missed content updates |
Start monitoring your Sanity backend on Vigilmon — free plan, no credit card required.
Vigilmon — uptime monitoring with multi-region checks and instant alerts.
Top comments (0)