Do different document types with same field name count as separate attributes?
https://www.sanity.io/docs/attribute-limit
I understand that it's based on unique paths that hold content.
But do different document types duplicate this?
i.e. say I have two document types
pageand
post
They both have a
bodyfield which are both a string.
Would that field count as 2 attributes? or 1 attribute?
Thanks
๐
Great question! The attribute limit is based on unique paths across your entire dataset, not per document type. So to answer your question directly:
The body field would count as 2 attributes because they exist at different paths in your content structure:
page.body(a string)post.body(a string)
Even though both fields have the same name and are the same type (string), they're at different locations in your content hierarchy, so Sanity counts them as separate unique paths.
How attributes are counted
According to the attribute limit documentation, an attribute is defined as a unique combination of path and datatype. Think of it as all the different routes through your content structure.
For example, if you have:
page {
body: string
title: string
}
post {
body: string
author: string
}This creates 4 attributes:
page.bodyโ stringpage.titleโ stringpost.bodyโ stringpost.authorโ string
Important things to know
Paths only count when they hold actual content. Just defining fields in your schema doesn't increase the count - you need to actually create documents with content in those fields.
Each unique path counts once, no matter how many documents use it. So if you have 100
pagedocuments,page.bodystill only counts as 1 attribute.The limits vary by plan:
- Free: 2,000 attributes
- Growth: 10,000 attributes
- Enterprise: Custom limit
You can check your current attribute count by visiting: https://<projectId>.api.sanity.io/v1/data/stats/<datasetName> - look for fields.count.value.
If you're concerned about hitting the limit, the docs recommend focusing on semantic content structure rather than presentation, avoiding excessive nesting, and being mindful of localization approaches that can multiply your attribute count.
Show original thread3 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.