See how we built our intranet. Live + Q&A, June 30

Which ID is the actual Sanity ID: "id" or "_id"?

4 repliesLast updated: Nov 29, 2025

when running sanity graphql quries, we end up with two ID's one is "id" and the other one "_id" . Does anyone know which one is actual sanity ID? I need the ID that will never change.
AI Update

The _id field is the actual Sanity document ID and is the one that will never change. This is the stable, permanent identifier for your document in Sanity's Content Lake.

When using Sanity's GraphQL API, you'll see both fields:

So if you need the ID that will never change and represents the actual Sanity document, always use _id. This is what you'll use for:

The _id field is also what you'll see in the Sanity Studio URL and what's used throughout Sanity's APIs (GROQ, HTTP API, etc.). You can even set custom IDs when creating documents if needed, but once set, the _id remains constant for the life of that document.

Show original thread
4 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