Contentful vs Sanity for developers: compare content modeling, GROQ, linked content, API limits and editing, then pick the right headless CMS.

On this page
In short
Contentful and Sanity are headless CMS products. They store your content in the cloud and deliver it to any website or app through an API. Contentful suits teams that want a visual content model and a standard API. Sanity suits developer teams that want the schema in code, a query language called GROQ and an editor they can reshape. Choose by your team's skills before you compare feature lists.
Want to go further? Ask
Quick quiz
Is SEO right for you, and how should you start?
Sorank matches your answers
Test it for 3 days on your own site and see where you stand on Google, ChatGPT and the other AIs.
Start 3-day free trial3 days free, then stop whenever you want. 90-day results guarantee, conditions apply.
Contentful and Sanity both hold your content and serve it over an API, so your frontend decides how it looks. The real differences are where you define the content model, how you query it and how your editors work. Contentful keeps the model in a web app and offers REST and GraphQL Content APIs. Sanity keeps the model in your project code, queries with GROQ and generates its editor, Sanity Studio, from that code.
We already cover each platform's SEO and GEO side on our Contentful SEO and GEO and Sanity SEO and GEO pages. This article takes a different angle: it compares the two as systems you build on, so you can choose before you write a line of code. If you are not yet sure you need a headless system at all, read what a CMS is and how to choose one first.
| Dimension | Contentful | Sanity |
|---|---|---|
| Content model defined in | Web app, Content Management API or CLI | Schema files in your project code |
| Query options | REST Content Delivery API and GraphQL Content API | GROQ, plus a GraphQL API generated from your schema |
| Linked content | Link fields, resolved with the include parameter | References, followed in the query with -> |
| Editor interface | Ready web app, configured in the UI | Sanity Studio, customized with React components |
| Limits and prices | Check the current docs and pricing page | Check the current docs and pricing page |
Read the table as a map, not a verdict. Each row changes how your week looks: who edits the model, who writes the queries and who gets called when an editor wants a new field on a Friday afternoon.
Content modeling is how you define what a page is made of. An article has a title, a slug, a body, an author and a publish date, and every template and API call depends on those names staying stable. Both tools store the model as data that editors and code rely on. The difference is who changes it and how the change reaches production.
In Contentful, you open the content model in the web app, create a content type called blogPost, and add fields such as a short text title, a rich text body and a link to an author entry. Contentful's guide on creating and deploying content type changes lists three ways to make a change: the web app, a request to the Content Management API, or a script with the Contentful CLI. To move changes between environments, the guide uses migration files and merges, not copies of content types made by hand.
In Sanity, the model is code. A document type is an object in your project, usually kept in a schemaTypes folder. The Sanity docs put it plainly: "You customize Sanity Studio in code, with React components and configuration." Here is a minimal document type, written as one line:
export const post = defineType({ name: 'post', type: 'document', fields: [defineField({ name: 'title', type: 'string' })] })
Code-based models suit teams that already review pull requests for every change. They become a burden when an editor needs one more field on a Tuesday afternoon, unless you have a quick path for schema changes. Web-app models are faster for editors but harder to review in Git. Decide which trade-off your team can live with, and write it down before you start.
Model a content type in five steps
A field called heroText breaks the day the design changes. A field called summary survives a redesign. Use names that describe the content, because the name becomes part of every API response and every template that reads it. Names like section2Title or sidebarText2 are a warning sign that the model follows the layout instead of the content.
Adding a field is safe. Renaming a field or changing its type is where content breaks. Neither tool moves existing values for you when you change the schema, so old entries can come back with empty fields. Plan a migration first, run it on a copy of your data, and check three old entries by hand before you deploy. A two-minute check at this stage saves a broken article archive later.

Your article links to an author, and the template needs the author's name and photo. You can resolve that link in the CMS, inside the query, or in your own code. Contentful resolves links with the include parameter, Sanity resolves them inside GROQ with the arrow operator, and the third option is to fetch two sets of data and join them yourself. Each one has a different cost in requests, payload size and maintenance.
The Content Delivery API returns linked entries and assets in an includes array. According to Contentful's developer docs on links, the default depth is one level, the same as include=1, and the maximum is include=10, which the docs describe as usually the depth you want. Use it when a template needs one or two levels of links, such as a post, its author and the author's company. The advantage is one request with no join code. The limit is payload size: every extra level adds data, and a deep include on a long list of posts makes the response heavy.
Here is one request that asks for two levels of links:
GET https://cdn.contentful.com/spaces/SPACE_ID/environments/master/entries?content_type=blogPost&include=2&access_token=TOKEN
Linked author data at include=1 and include=2
Source: Contentful developer docs, links concept page
Two details trip people up. Unpublished linked entries are left out of the includes array and reported in an errors array, so a page can render with a missing author and no visible error. And link resolution covers entries and assets only, not content types or spaces.
GROQ follows any field that holds a reference, and it does not need a schema declaration to do so. Chains compose: a post can follow its author, and the author can follow a company. You choose the depth and the shape of the answer in the same query. Sanity's documentation on GROQ and GraphQL gives this pattern, which returns each post with its author's name and bio:
*[_type == "post"]{title, author->{name, bio}}
Use this method when each page needs a different shape, because every query asks for exactly the fields it needs. The cost is that a deep chain across a big list can be slow, and you write each query yourself. Cross-dataset references are a special case. The same docs say only GROQ can follow them, and that feature sits on Sanity's Enterprise plan.
Fetch the posts, collect the author IDs, fetch the authors in one more call, then merge the results in your frontend or build script. This works with any CMS and any API, so the code survives a future migration. It is also the method most likely to cause the N+1 problem, where one request per post hits the API again and again. Batch the IDs and never loop a request per item:
const authors = await client.fetch('*[_type == "author" && _id in $ids]', { ids })
Use it when the join is simple, when the data is cached anyway, or when you expect to move CMS later. The limits are more code to maintain, more round trips, and quiet bugs when an ID is missing from the second response.
| Method | Where the join happens | Requests | Best for | Main risk |
|---|---|---|---|---|
| Contentful include | Inside the API | One | Fixed templates with one or two levels | Large payloads at depth |
| GROQ arrow | Inside the query | One | Custom shapes per page | Slow deep chains |
| Client-side join | Your code | Two or more | Portable code and simple joins | N+1 requests and missing IDs |
Pick one method per template and write it down. Mixing three methods across one site is how a missing author shows up on one page and not on the next. The model you build here decides how well your pages expose structured content, a term we define in our structured content glossary entry.
Sanity has one native query language, GROQ, and a GraphQL API generated from your schema. Contentful offers a REST Content Delivery API and a GraphQL Content API. If your team already writes GraphQL, Contentful is the shorter path. If you need to count or sum inside the query, GROQ is the stronger tool, because Sanity's GraphQL layer has no aggregation in its query language.
Sanity's documentation calls GROQ the native query language for the Content Lake, and describes GraphQL as a generated, typed layer based on your schema. The same page says GraphQL is not a computation language, so computed values need schema fields with server-side resolvers. The comparison below sums up what that means in practice.
Sanity: GROQ vs the GraphQL layer
Source: Sanity documentation, GROQ and GraphQL

Here is a GROQ query that counts orders and sums their amounts in one response. It comes from the Sanity documentation:
{"orderCount": count(*[_type == "order"]), "totalRevenue": math::sum(*[_type == "order"].amount)}
Neither language has a native group-by, so grouping orders by category still needs your code. Plan for that before you promise a dashboard.
On the Contentful side, the GraphQL Content API asks for a collection and its fields in the same way:
query { blogPostCollection(limit: 5) { items { title slug } } }
We read less of Contentful's GraphQL documentation than Sanity's, so run your own three queries before you decide what aggregation you need. For plain lists and single pages, both APIs do the job well.
Contentful gives your editors a finished web app to write, review and publish entries, so you put your effort into the frontend. Sanity Studio is a React application you configure, and custom inputs, previews and tools can match your editorial workflow closely. Choose the first when editors need to work on day one. Choose the second when your workflow is unusual enough that a standard interface gets in the way.
In Contentful, editors work in entries, with references picked from a search and drafts published on demand. The interface is the same for every space, so a new editor learns it once. In Sanity, the Studio is built from the schema, so a field you deploy appears in the editor on its own. That is convenient, but it also means a careless schema change reaches editors the moment it ships.
Sanity's customization docs say you can replace any input component with your own React component, and theme the Studio's colors, type and icons. Contentful offers apps and a set of UI settings around the editor, but the core interface stays Contentful's. If your editors need a custom approval panel or a field that previews a layout, that favors Sanity. If they need a clean form and nothing else, the standard web app is the faster route.

Contentful's Content Delivery API enforces a rate limit of 55 requests per second on uncached requests, and requests served from the CDN cache are not counted against that limit. When you go over, the API returns 429 Too Many Requests and sets the X-Contentful-RateLimit-Reset header to the number of seconds until the next request is accepted, which is usually 1 because the limit is per second. Contentful's Content Delivery API reference documents both rules. Build your site so the limit rarely matters: cache responses and build static pages where you can.
Contentful Delivery API limits
Source: Contentful developer docs, Content Delivery API reference
Wait for the header, retry once or twice, and log the failure. A build that retries quietly and then fails loudly after three tries is far easier to debug than one that silently skips pages. Here is the core of the wait, in one line:
if (res.status === 429) { await new Promise((r) => setTimeout(r, Number(res.headers.get('X-Contentful-RateLimit-Reset')) * 1000)) }
Sanity also sets API and bandwidth limits by plan. When we checked, the figures on its pricing page and in third-party write-ups did not agree, so this article quotes none of them. Read the current limits on the pricing page and in the API docs on the day you sign up, and size your cache against those numbers rather than against a blog post, this one included.
The fastest way to choose is a two-day test. Model the same three content types in both tools, load ten real entries into each and write the same three queries. Measure the code you wrote, the size of the responses and the time an editor needs to publish one change. Follow the steps below and keep notes as you go.
Two-day test checklist
Score each tool from 1 to 5 on editing, queries, limits and migration effort, then add the scores. Do not let the feature list outweigh the afternoon your editor spends publishing.
Most CMS problems are not bugs in the vendor's product. They come from a model that was built quickly and never checked against real pages. These five mistakes show up on almost every project. Each one has a clear sign and a clear fix.
What it is: one content type called page with 40 fields, from the hero heading to the footer note. How to spot it: editors copy text from one entry to another, and the field names carry numbers or positions. How to fix it: split the page into reusable types, such as hero, feature and author, and link them from the page. Each type then gets its own validation and can be reused across templates.
What it is: every template asks for include=10 because it seems safer. How to spot it: responses grow in size, the time to first byte rises, and the includes array holds entries no template reads. How to fix it: set the depth per template, check the payload in your browser's network panel, and lower it to the depth the template really uses.
What it is: a developer renames a field in code or in the web app and deploys without a migration. How to spot it: old entries show empty values in one template and nowhere else, so the bug hides on older pages. How to fix it: write a migration that copies values into the new field, run it on a copy of the data, and check three old entries by hand before the deploy.
What it is: the build requests every page at once and gets rate limited. How to spot it: the build fails on some pages and passes on the next run, so the error looks random. How to fix it: read X-Contentful-RateLimit-Reset, retry after a short wait, and cache responses between builds.
What it is: an author field accepts any entry, so an editor links a product or a landing page by mistake. How to spot it: a template renders a broken card, or a link points to a content type the code never expects. How to fix it: restrict the link to the right type. In Contentful, set the link validation to specific content types. In Sanity, set the allowed types on the reference:
defineField({ name: 'author', type: 'reference', to: [{ type: 'author' }] })
| Mistake | Sign | Fix |
|---|---|---|
| One type for the whole page | Copied text, numbered field names | Split into reusable types |
| Include depth too high | Large responses, slow first byte | Set depth per template |
| Renamed field without migration | Empty values on old entries | Migrate and check old entries |
| No 429 handling | Random build failures | Read the reset header, retry, cache |
| Unrestricted references | Wrong content in cards | Restrict allowed types |
Both CMS can serve fast, crawlable pages with clean titles, canonical URLs and structured data. Neither one ranks a page by itself. What the model decides is how easily your templates output what search engines and AI systems read: titles, headings, meta descriptions, structured data and internal links. Make those fields required in the model from day one, and both tools will carry them to every page.
| Field in the model | Why it matters | Required? |
|---|---|---|
| Meta title | Shown in search results | Yes, on every page type |
| Meta description | Summary in results and when shared | Yes, on every page type |
| Canonical URL | Names the main version of a page | Yes, where duplicates exist |
| Structured data | Machine-readable facts about the page | Per template |
| Internal links | Paths between related pages | Per template |
Structured data is the part your model can hold most directly. A template can read a field and print the JSON-LD block it needs. A minimal article block looks like this:
<script type="application/ld+json">{"@context": "https://schema.org", "@type": "Article", "headline": "Contentful vs Sanity"}</script>
Read our guide to schema markup before you write the template, and our overview of structured data for AI search to see what helps and what does not. Schema helps machines read a page. It does not make an AI system cite the page, which depends on the content, its clarity and whether it answers the question directly.
Sorank tracks whether ChatGPT, Gemini, Claude and Perplexity mention your brand and cite your pages, which is the check that shows whether a CMS change made a difference. The details are on our GEO optimization page, and the template-level steps are in the technical GEO checklist.
Tip
Once your first template is live, run one of its public pages through the LLM Readability Checker. It shows whether the page is easy for an AI system to extract, and you can then fix the model fields the template reads.
Choose Contentful if your editors need a finished web app on day one and your developers want a standard API with a familiar query style. Choose Sanity if your developers want the schema in code, GROQ for flexible queries and an editor they can reshape. Whatever you pick, test with your real content, write down the limits you accepted, and check the current prices and API limits on the vendor's site the day you buy.
| If your situation is | Lean toward |
|---|---|
| Editors must publish on day one, with no custom editor | Contentful |
| Developers already write GraphQL and want a standard API | Contentful |
| The schema should live in Git with code review | Sanity |
| You need aggregation or deep reshaping inside queries | Sanity |
| The editorial workflow is unusual and needs custom tools | Sanity |
| You are unsure and the budget is tight | Run the two-day test on both |
If you are still choosing a platform for the whole site, compare the wider field in our guide to the best CMS for SEO. The right tool is the one your team can change on a Tuesday without breaking a Friday deploy.
Sanity usually suits a developer team that wants the schema in code and a flexible query language. Contentful suits a team that wants a ready web app for editors and a standard REST or GraphQL API. Test both with your real content before you commit.
Neither is cheap by default, and both change their plans often. Compare the seats, API requests, bandwidth and asset storage you will really use, not the headline of the free tier. Read the current pricing page on the day you decide.
Yes, but the move is a project, not a copy and paste. You must map each content type to a schema, export the entries, rebuild the references and update every API call in your frontend. Plan time for the mapping and the frontend, not only for the export.
