
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeThis is likely a perspective issue - specifically related to a recent breaking change in Sanity's API. Let me explain what's probably happening:
As of the 2025-02-19 API version, Sanity changed the default perspective from raw to published. This is a breaking change that catches a lot of people off guard.
Here's what's probably happening:
published perspectiveperspective=rawThe published perspective only returns documents without the drafts. prefix - meaning if your content is still in draft state and hasn't been published, it won't show up.
Add the perspective parameter to your Google Script API calls:
// Add ?perspective=previewDrafts to your query URL
const url = `https://${projectId}.api.sanity.io/v2021-10-21/data/query/${dataset}?query=${encodeURIComponent(query)}&perspective=previewDrafts`;Or if you want to see everything (drafts + published):
// Use perspective=raw to see all documents
const url = `...&perspective=raw`;While perspective is the most likely cause, here are other things to check:
Authentication: Make sure your Google Script has the right token with read permissions for your dataset
API Version: Check if you're specifying an API version in your URL (like v2021-10-21 or v2025-02-19)
CORS/Network: Though less likely with Google Scripts, ensure the request is actually reaching Sanity (check response status codes)
Query syntax: Test your exact query in Sanity's Vision plugin in your Studio to verify it returns results there
The perspectives documentation has more details about how these different views work and when to use each one.
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