Preferences

Privacy is important to us, so you have the option of disabling certain types of storage that may not be necessary for the basic functioning of the website. Blocking categories may impact your experience on the website. More information (Cookie Policy)

Contentful vs Sanity: How to Choose the Right Headless CMS

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

Published on
22/11/2026
Updated on
22/11/2026
Reading time
16 min
Contentful vs Sanity: How to Choose the Right Headless CMS

Tools

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?

Question 1 of 425%
Do people search Google for what you sell?

Contentful vs Sanity: what each one is and who it fits

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.

DimensionContentfulSanity
Content model defined inWeb app, Content Management API or CLISchema files in your project code
Query optionsREST Content Delivery API and GraphQL Content APIGROQ, plus a GraphQL API generated from your schema
Linked contentLink fields, resolved with the include parameterReferences, followed in the query with ->
Editor interfaceReady web app, configured in the UISanity Studio, customized with React components
Limits and pricesCheck the current docs and pricing pageCheck 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: a web app or a schema in code

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

  1. List what the page showsWrite the parts of a page in the words your editors already use.
  2. Make one type per thingKeep author, post and product as separate types, not one large type.
  3. Pick field types on purposeShort text for labels, rich text for body copy, references for shared items.
  4. Add validationMark required fields and limit each reference to the types it should point to.
  5. Test with one real entryCreate one entry per type and read the API response before you build the frontend.

Name fields for what they hold, not how they look

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.

Renames and type changes are the risky part

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.

Isometric illustration of connected blue content nodes linked by glowing lines on a white background
A content model drawn as connected nodes, the core idea of a headless CMS.

Linked content: three ways to fetch an author with a post

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.

Method 1: Contentful's include parameter

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

include=1 (default)
  • Post and author come back in one request
  • The author's company is only a link
include=2
  • Company name arrives in the includes array
  • Still one request, no join code

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.

Method 2: GROQ dereferencing with the arrow operator

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.

Method 3: two requests, joined in your code

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.

MethodWhere the join happensRequestsBest forMain risk
Contentful includeInside the APIOneFixed templates with one or two levelsLarge payloads at depth
GROQ arrowInside the queryOneCustom shapes per pageSlow deep chains
Client-side joinYour codeTwo or morePortable code and simple joinsN+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.

Querying content: GROQ, GraphQL and REST side by side

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

GROQ
  • Native query language of the Content Lake
  • count() and math:: functions inside the query
  • Follows references with the arrow operator
GraphQL layer
  • Familiar to teams that already use GraphQL
  • No aggregation in the query language
  • No cross-dataset references

Source: Sanity documentation, GROQ and GraphQL

Sanity documentation page comparing GROQ with the GraphQL API
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.

Editing: Contentful's web app or Sanity Studio

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.

Day-to-day editing

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.

How far you can customize

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.

Sanity product page describing Sanity Studio as an all-code content workspace
Source: Sanity, Content Studio page

API limits, caching and performance

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

55uncached requests per second, the enforced rate limit
429the status code returned when the limit is hit

Source: Contentful developer docs, Content Delivery API reference

Handling a 429 response

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's limits

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.

Step by step: a two-day test on your own content

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

  • Model the same three types in both tools
  • Load ten real entries into each, with at least two links between them
  • Write the same three queries in each API
  • Time one publish from an editor's point of view

Day one: model and load

  1. Pick three types: a page, an author and a reusable block such as a call to action.
  2. Model them in the Contentful web app, then in a Sanity schema file, using the same field names.
  3. Load ten real entries into each tool, and link each page to an author so the join gets tested.

Day two: query, measure and change

  1. Write the same three queries: a list of pages, one page with its author, and a list filtered by category.
  2. Count the lines of code and the size of each response in kilobytes.
  3. Time an editor's full publish cycle, from a draft to the live API, in each tool.
  4. Rename one field on purpose, deploy the change to a test copy, and note what happens to the old entries.

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.

Common mistakes: how to spot each one and fix it

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.

Mistake 1: modeling a whole page as one type

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.

Mistake 2: setting the include depth too high everywhere

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.

Mistake 3: expecting old content to follow a renamed field

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.

Mistake 4: no handling of 429 responses

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.

Mistake 5: reference fields with no type restriction

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' }] })
MistakeSignFix
One type for the whole pageCopied text, numbered field namesSplit into reusable types
Include depth too highLarge responses, slow first byteSet depth per template
Renamed field without migrationEmpty values on old entriesMigrate and check old entries
No 429 handlingRandom build failuresRead the reset header, retry, cache
Unrestricted referencesWrong content in cardsRestrict allowed types

Where SEO and GEO fit in your CMS choice

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 modelWhy it mattersRequired?
Meta titleShown in search resultsYes, on every page type
Meta descriptionSummary in results and when sharedYes, on every page type
Canonical URLNames the main version of a pageYes, where duplicates exist
Structured dataMachine-readable facts about the pagePer template
Internal linksPaths between related pagesPer 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.

Which one to choose: a decision guide

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 isLean toward
Editors must publish on day one, with no custom editorContentful
Developers already write GraphQL and want a standard APIContentful
The schema should live in Git with code reviewSanity
You need aggregation or deep reshaping inside queriesSanity
The editorial workflow is unusual and needs custom toolsSanity
You are unsure and the budget is tightRun 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.

Frequently asked questions

Is Contentful or Sanity better for a small development team?

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.

Is Contentful cheaper than Sanity?

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.

Can I switch from Contentful to Sanity later?

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.

Get your content plan for 30 days for free

We analyse your competitors, your website and your AI visibility to create a tailored content plan for free.

Our free SEO tools

See all our free tools

Get your content plan for 30 days for free

We analyse your competitors, your website and your AI visibility to create a tailored content plan for free.

Man with dark hair and beard wearing a light brown shirt speaks in front of a microphone on a podcast or recording setup.Portrait of a man with short dark hair wearing a white shirt and dark jacket, looking directly at the camera with a neutral expression.Man with short dark hair, beard, and clear glasses wearing a black t-shirt with a white circular logo, standing in front of a stone wall.Celio fabianoSmiling young woman with long brown hair wearing a red top and necklace, outdoors in a tree-filled background.Profile photo of Xavier Breull, Sorank customer
Google
Solid yellow five-pointed star icon on transparent background.Solid yellow five-pointed star icon on transparent background.Solid yellow five-pointed star icon on transparent background.Solid yellow five-pointed star icon on transparent background.Solid yellow five-pointed star icon on transparent background.
5/5
+5,000
users

Testimonials from ambitious founders

0 to 10000 visitors in 5 months

Celio Fabianomonrobotlavevitre.frGoogleE-commerce

0 to 5000 visits in 8 months

Thibault BMsorank.comGoogleSoftware

0 to 1104 clicks in 4 months

Dominiqueflight-sensations-idf.comGoogleLeisure and aviation

0 to 163 clicks in 6 months

Coworking Pariscoworking-paris.frGoogleOffice broker

x92 clicks in 7 months

Guide Zanzibarguidezanzibar.comGoogleTravel