Skip to content

Imported documents not showing without token, but manually created ones work

13repliesLast updated: Nov 13, 2026

We have about 13,000 documents - most of which we have imported manually using the sanity cli.
For some reason none of these are showing up on our site without using a token. What's odd is that when I manually create a new document, it shows up just fine. I
have checked several imported documents to see they meet the required fields and are published - but to no avail.
I have no idea why imported documents are not showing, but newly created ones are.
AI Update

These documents are hidden because their IDs contain a dot. In Sanity, any _id with a . in it (for example post.some-id or author.some-id) is treated as a path, and path IDs are always private. Only a logged-in user or a token with at least read access can see them, even in a public dataset. Documents created in the Studio get random IDs with no dot, so they're public. That's why those show up and the imported ones only appear when you send a token. Publishing status and validation don't affect this.

Confirm it

Run this query with a token and check which IDs come back:

*[_id in path("*.**") && !(_id in path("drafts.**")) && !(_id in path("versions.**"))]{_id, _type}

* matches up to the next period and ** also matches across periods. Drafts (drafts.) and release versions (versions.) are meant to be private, so the query leaves them out.

Fix it

You can't edit an _id once it's set, so you have to create new documents with IDs that have no dots. The simplest way for a large dataset is to export, rewrite the file and import again:

Note: exports and imports count against your API quota. Exporting once and importing once is much cheaper than changing documents one at a time.

Going forward

Don't put dots in your own document IDs. If you want a readable or source-system identifier, store it in a field such as customId, or use dashes (post-123). To generate compatible IDs, use uuid() from @sanity/uuid (IDs and paths).

Show original thread
13 replies

Was this answer helpful?

Sanity – Build the way you think, not the way your CMS thinks

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.

Related contributions