How to add multiple documents in Sanity schema structure?

16 replies
Last updated: Nov 29, 2025
hi ,
Is it possible to be able to add more then 1 document ? how do I structure this in the schema?
AI Update

Looking at your question, I believe you're asking about how to reference multiple documents in a schema field. The most common way to do this in Sanity is using an array of references.

Here's how you structure it in your schema:

{
  name: 'relatedArticles',
  title: 'Related Articles',
  type: 'array',
  of: [
    {
      type: 'reference',
      to: [{type: 'article'}]
    }
  ]
}

This allows editors to add multiple document references to a single field. If you want to reference multiple different document types in the same array, you can do:

{
  name: 'resources',
  title: 'Resources',
  type: 'array',
  of: [
    {
      type: 'reference',
      to: [
        {type: 'article'},
        {type: 'video'},
        {type: 'podcast'}
      ]
    }
  ]
}

As explained in the array fields documentation, array fields create orderable collections where editors can:

  • Add as many items as needed
  • Reorder them via drag-and-drop
  • Remove items
  • Each item gets a unique _key automatically

You can also mix different types within the same array if you need more complex structures:

{
  name: 'content',
  title: 'Content Blocks',
  type: 'array',
  of: [
    {
      type: 'reference',
      to: [{type: 'article'}]
    },
    {
      type: 'image'
    },
    {
      type: 'object',
      name: 'textBlock',
      fields: [
        {name: 'text', type: 'text'}
      ]
    }
  ]
}

The array approach is much more flexible than single reference fields and is the standard Sanity pattern for "one-to-many" relationships. Editors can add unlimited documents (though you can add validation rules to set min/max limits if needed).

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