Difference between object type and document type in Sanity

3 replies
Last updated: Nov 29, 2025
What's the difference between
object
type and
document
type
AI Update

The main difference between object and document types in Sanity comes down to whether they can exist as standalone content in your Content Lake:

Document types are top-level content entries that:

  • Can exist independently in your Content Lake
  • Automatically receive system fields: _id, _rev, _createdAt, and _updatedAt
  • Appear in the Content sidebar of Sanity Studio for editing
  • Are queryable as individual entities
  • Examples: blog posts, pages, products, authors

Object types are reusable data structures that:

  • Cannot exist as standalone documents in the Content Lake
  • Are used as building blocks within documents or other objects
  • Do NOT receive the system fields that documents get
  • Do NOT appear in the Content sidebar
  • Must be nested inside a document or another object
  • Examples: address blocks, navigation items, SEO metadata, custom structured data

Think of it this way: documents are the "main content" you create and manage, while objects are the "components" or "building blocks" you use to structure that content.

Here's a practical example from the Object Types documentation:

// Document type - appears in Studio sidebar
{
  name: 'blogPost',
  type: 'document',
  fields: [
    {name: 'title', type: 'string'},
    {name: 'author', type: 'authorInfo'} // uses object below
  ]
}

// Object type - reusable component
{
  name: 'authorInfo',
  type: 'object',
  fields: [
    {name: 'name', type: 'string'},
    {name: 'bio', type: 'text'}
  ]
}

One important note: If you're using GraphQL, you should avoid anonymous inline objects and instead define named object types at the top level of your schema, as GraphQL requires all nested structures to be explicitly defined types.

Show original thread
3 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?