
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeWhen using Sanity's GraphQL API, there's an important distinction to understand about document identifiers:
_id is Sanity's native document identifier field. This is a system field required on all documents stored in the Content Lake. Every document in Sanity has an _id field that uniquely identifies it. You can define your own _id when creating documents, but if you don't provide one, Sanity will auto-generate it. This is the field you'll use when querying Sanity's GraphQL API directly.
id is NOT a field that Sanity's GraphQL API generates. Based on the official GraphQL documentation, Sanity's GraphQL API only exposes _id as the document identifier field.
However, you might encounter an id field if you're using third-party tools or frameworks that add their own abstraction layer over Sanity's data. For example:
id field as part of Gatsby's internal node system for managing data in its GraphQL layer. This id is generated by Gatsby, not by Sanity.id fields for their internal purposes.In practice:
_id - it's the only document identifier field availableid field, you're likely using a framework or plugin that's adding its own layer of abstraction (like Gatsby), and that id is specific to that tool's data management systemSo the key takeaway: _id is Sanity's native identifier, while id (if present) comes from whatever framework or tool you're using to consume Sanity's data, not from Sanity itself.
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