
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeThis is a classic issue that catches people! Yes, this happens, and it's almost always related to API perspectives and a recent default behavior change.
When you see content in Studio/Vision but not in your API responses, you're probably querying with the published perspective (or no perspective specified, which now defaults to published as of API version 2025-02-19), but your documents only exist as drafts.
Here's what's happening:
raw perspective by default (all documents including drafts)published perspective (only published documents)drafts.post-123 and won't appear in the published perspective1. Check if your documents are published:
Look at the document ID in Studio. If it starts with drafts., it hasn't been published yet. Click the "Publish" button in Studio.
2. Use the correct perspective in your API calls:
Add ?perspective=previewDrafts to your API URL:
https://YOUR_PROJECT_ID.api.sanity.io/v2025-02-19/data/query/YOUR_DATASET?query=YOUR_QUERY&perspective=previewDrafts
3. If using a client library:
const client = createClient({
// ... other config
perspective: 'previewDrafts', // or 'raw' to see everything
})Sanity has several perspectives:
published - Only published documents (no drafts. prefix)previewDrafts - Prefers draft versions when they exist, falls back to publishedraw - Everything (both drafts and published versions)If this suddenly started happening after February 2025, note that the default perspective changed from raw to published in API version 2025-02-19. This means if you're using the latest API version without explicitly setting a perspective, you'll only see published content.
If you've verified the perspective and documents are published, check:
?perspective=published&t=${Date.now()} to bust cacheThe UI inspector and Vision both use the raw perspective by default, which is why you see the content there but not in your production API calls. This is actually a feature - it lets you preview unpublished changes!
Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.
Content operations
Content backend


The only platform powering content operations
By Industry


Tecovas strengthens their customer connections
Build and Share

Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag store