How to find a document in Sanity by its ID?

9 replies
Last updated: Nov 29, 2025
I see the following warning for 3 documents during `gatsby build`:
[sanity] Document "fbca6239-40f3-4c6b-b197-224106c7fb38" has type position (SanityPosition), which is not declared in the GraphQL schema. Make sure you run "graphql deploy". Skipping document.
How do I find that document within Sanity?
AI Update

You can find that document in Sanity Studio by navigating directly to it using the document ID in the URL. Here are a few ways to locate it:

Method 1: Direct URL (fastest)

Add the document ID to your Studio URL like this:

https://your-studio.sanity.studio/desk/fbca6239-40f3-4c6b-b197-224106c7fb38

Replace your-studio.sanity.studio with your actual Studio URL. This will open the document directly if it exists.

Method 2: Vision Plugin (if installed)

If you have the Vision plugin installed in your Studio, you can run a GROQ query to find the document:

*[_id == "fbca6239-40f3-4c6b-b197-224106c7fb38"]

This will return the document and show you all its fields, including the _type.

Method 3: API Query

You can also query for it using the Sanity CLI or HTTP API:

sanity documents get fbca6239-40f3-4c6b-b197-224106c7fb38

About the warning itself:

The warning indicates that you have a document of type position (with schema name SanityPosition) that exists in your dataset, but it's not included in your GraphQL schema deployment. To fix this, you need to:

  1. Make sure the position schema type is defined in your Studio's schema files
  2. Run sanity graphql deploy to update your GraphQL API with the current schema

If you've removed this document type from your schema but the documents still exist, you may want to delete them or migrate them to a different type. The direct URL method above will let you view and delete the document if needed.

Show original thread
9 replies

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.

Was this answer helpful?