
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeGreat question! This is actually about how Sanity's security model works with datasets and document visibility. Let me break this down for you.
When you query a Sanity project through the Vision Tool or API, you're accessing a dataset, and datasets have visibility settings that determine who can read from them. Here's what's happening:
Sanity datasets can be configured as either:
You can change this setting via the CLI (sanity dataset visibility set <datasetName> <public/private>) or through the management console at manage.sanity.io.
According to the Keeping your data safe documentation, there are some crucial points to understand:
If you need to restrict access to your content:
There's also a special consideration about document visibility: documents whose _id starts with a period (.) are considered "root path" documents and are only accessible to authenticated requests, even in public datasets. Regular documents (without a leading period) in public datasets are accessible to everyone. Drafts (with drafts. prefix) follow the same visibility rules as their published counterparts.
For public-facing websites, it's common and perfectly fine to have a public dataset - just make sure you're only storing content that's meant to be publicly accessible. If you need to keep certain documents private (like drafts or sensitive data), consider using a separate private dataset or implementing custom access control rules.
Does this clarify how the security model works? The key takeaway is that your project ID alone doesn't grant access - it's the dataset visibility setting that determines whether unauthenticated queries can read your data!
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