---
title: "Headless build patterns"
url: "https://developers.contentstack.com/paths/headless-build-patterns"
type: "path_full"
level: "intermediate"
outcome: "You can model a site in Contentstack, query it by reference and taxonomy, preview drafts in Next.js and publish without stale pages."
steps:
  - "https://developers.contentstack.com/guides/modular-blocks-references-or-global-fields"
  - "https://developers.contentstack.com/guides/modeling-navigation-in-contentstack"
  - "https://developers.contentstack.com/guides/contentstack-limits-on-one-page"
  - "https://developers.contentstack.com/guides/nested-references-empty-or-error-141"
  - "https://developers.contentstack.com/blog/taxonomies-are-your-query-layer"
  - "https://developers.contentstack.com/guides/querying-content-by-taxonomy"
  - "https://developers.contentstack.com/guides/live-preview-for-a-nextjs-rebuild"
  - "https://developers.contentstack.com/blog/revalidate-prime-or-redeploy-picking-the-right-cache-lever-on-launch"
  - "https://developers.contentstack.com/guides/webhooks-allowlisting-signatures-and-disabled-endpoints"
  - "https://developers.contentstack.com/blog/releases-bulk-publish-and-nested-reference-publishing-explained"
  - "https://developers.contentstack.com/guides/audit-your-content-model-before-a-migration"
updated: "2026-12-03T16:47:17.396Z"
---

# Headless build patterns

- **Level:** Intermediate
- **Steps:** 11
- **Overview:** https://developers.contentstack.com/paths/headless-build-patterns.md

---

Model content, query it, preview it and keep it fresh. The patterns that decide whether a headless build stays easy to change a year in.

**You'll end up with:** You can model a site in Contentstack, query it by reference and taxonomy, preview drafts in Next.js and publish without stale pages.

## Table of Contents

1. Modular blocks, references or global fields?
2. Modeling navigation in Contentstack
3. Contentstack limits on one page
4. Nested references come back empty, or fail with error 141
5. Taxonomies are your query layer
6. Querying content by taxonomy
7. Live preview for a Next.js rebuild: what to check
8. Revalidate, prime or redeploy? Cache levers on Launch
9. Webhooks: allowlisting, signatures and disabled endpoints
10. Releases, bulk publish and nested publishing explained
11. Audit your content model before a migration


---

## Step 1: Modular blocks, references or global fields?

- **Source:** https://developers.contentstack.com/guides/modular-blocks-references-or-global-fields
- **Checkpoint:** You can say when a field should be a modular block, a reference or a global field.

- **Authors:** Tim Benniks
- **Published:** 2026-11-20T09:00:00.000Z
- **Updated:** 2026-11-15T10:56:09.205Z
- **Level:** Beginner
- **Intent:** Learn
- **Tags:** content_modeling, headless

---

Every Contentstack content model comes down to a few choices repeated many times. Should this be a set of blocks inside the entry, a link to another entry, a reusable group of fields, or a label from a taxonomy? Each option changes how editors work, how many requests your front end makes, and what happens when someone publishes or translates.

This guide explains each option, compares them on the things that matter in production, and walks through three examples you will run into on almost every project.

## What you'll learn

- What modular blocks, references, global fields and taxonomies are


- Who owns the content in each case, and what gets reused


- How each option affects querying, localization and publishing


- How to model a landing page, a blog post with an author, and a product with shared SEO fields


- A decision table and flow you can use in modeling sessions



## The four options

### Modular blocks

Contentstack concept: A modular blocks field holds an ordered list of blocks. Each block follows one of the block types you define on the field.

A sections field on a landing page might allow hero, feature_grid, quote and cta blocks. Editors add the blocks they need, in the order they want. The content of every block is stored inside the entry.

If you are coming from page builders, modular blocks are the sections list. The developer defines which sections exist and how they render. The editor decides which ones to use.

### References

Contentstack concept: A reference field links an entry to one or more other entries, of the content types you allow.

A blog post with an author reference points at an entry of the person content type. The author is written once and reused by every post that references it. Change the author's bio and every post shows the new bio.

### Global fields

Contentstack concept: A global field is a reusable group of fields, defined once at the stack level and added to any content type.

An seo global field with meta_title, meta_description and canonical_url can be added to pages, blog posts and products. Change the global field's schema and every content type that uses it gets the change.

### Taxonomies

Contentstack concept: A taxonomy is a stack-level tree of terms that you attach to content types. Entries store the terms editors select.

Taxonomies are the fourth option, for classification. Levels, regions, product categories and topics are labels you filter by, not content you render. The [taxonomy querying guide](/guides/querying-content-by-taxonomy) covers how to query them.

## Ownership and reuse

The most useful question in a modeling session is: who owns this content, and where else does it appear?

- Modular blocks belong to one entry. A hero block on the homepage is the homepage's hero. If you copy it to another page, you have two heroes that drift apart.


- References point at content owned by another entry. The referenced entry is reused, and edits show up everywhere.


- Global fields reuse a structure, not values. Two products with the same seo global field each have their own meta title.


- Taxonomies reuse a vocabulary. The term beginner is defined once and every entry that selects it means the same thing.



A simple rule covers most cases: if the same content should appear in several places and stay in sync, it needs to be its own entry, which means a reference.

## Editorial experience

Modular blocks and global fields are edited in place. The editor stays in one entry and sees everything that belongs to it. This makes them the best fit for content that only makes sense in context, like the sections of one page.

References send the editor to another entry. That is the point when the content is shared, but it adds friction for content that is not. A landing page where every section is a separate referenced entry means opening ten entries to change one page, and ten entries to publish.

Taxonomies show up as a term picker. Editors choose from a controlled list and cannot invent new values, which is what you want for anything used in filters.

## Query cost

Modular blocks, global fields and taxonomy terms come back with the entry. One request, no extra parameters.

References come back as a UID and content type UID unless you ask for them to be resolved. With the TypeScript Delivery SDK, you resolve them with includeReference():

```typescript
import contentstack, { QueryOperation } from "@contentstack/delivery-sdk";

const stack = contentstack.stack({
  apiKey: process.env.CONTENTSTACK_API_KEY!,
  deliveryToken: process.env.CONTENTSTACK_DELIVERY_TOKEN!,
  environment: process.env.CONTENTSTACK_ENVIRONMENT!,
});

const post = await stack
  .contentType("blogpost")
  .entry("blt0123456789abcdef")
  .includeReference("author")
  .fetch();
```

References inside blocks use dot notation:

```typescript
const page = await stack
  .contentType("landing_page")
  .entry()
  .includeReference("sections.testimonial.person")
  .query()
  .where("url", QueryOperation.EQUALS, "/pricing")
  .find();
```

Every resolved reference adds entries to the response. A multiple reference field with ten items, where each item references three more entries, turns one entry into forty. Payloads grow, and so does the number of entries whose changes affect the page. Resolve only the paths a page renders, and use only() to keep the fields small.

## Localization and publishing

Modular blocks and global fields are part of the entry. They are localized with the entry, field by field, and published with the entry. One publish, one locale at a time, everything consistent.

A referenced entry has its own localized versions and its own publish state per environment and locale. That has two consequences:

- Publishing a blog post does not publish its author. If the author is not published to that environment, the resolved reference is missing from the response.


- Translating a page does not translate the entries it references. Each referenced entry is translated on its own.



Nested reference publishing helps with the first one. In the publish dialog, editors can send the entry together with its references, up to five levels deep. The [publishing explainer](/blog/releases-bulk-publish-and-nested-reference-publishing-explained) goes deeper into releases and bulk publishing.

Taxonomy terms are stored on the entry, so selecting a term publishes with the entry. The taxonomy itself is managed at the stack level.

## Worked example 1: a landing page

A marketing landing page has a hero, a few feature sections, a testimonial and a CTA. Editors want to reorder sections and add new ones without a deploy.

- Model the page as a landing_page content type with a sections modular blocks field.


- Give each block type its own fields: hero (title, image, CTA), feature_grid (group of items), cta (label, link).


- Make the testimonial block a reference to a testimonial content type, because the same quote appears on several pages.


- Add an seo global field to the content type.



The page stays one entry. Only the testimonial is shared, so only the testimonial needs includeReference().

## Worked example 2: a blog post with an author

A blog post has a title, a body, an author and a few topics.

- The author is a reference to a person entry. The same person writes many posts and has a profile page.


- Topics are taxonomy terms. You filter by them, but they have no content of their own.


- The SEO fields are a global field, shared in structure with every other page type.



The query resolves one reference (author). Topics and SEO come back with the entry.

## Worked example 3: a product with shared SEO and a category

A product has a name, price, images, SEO fields, and belongs to a category like "Rings" or "Necklaces".

- The SEO fields are a global field. Products, pages and blog posts all need the same SEO structure, but each product has its own values.


- If the category is a label used for filtering and breadcrumbs, make it a taxonomy. A category taxonomy can nest "Rings" under "Jewelry", and $eq_below returns everything below a category.


- If the category has its own landing page with a description, hero image and featured products, make it a category content type and reference it from the product.



Many projects end up with both: a taxonomy for filtering, and a category entry for the landing page content.

## Decision table

Question

Modular blocks

Reference

Global field

Taxonomy

Content shared and kept in sync across entries?

No

Yes

No

Terms only

Schema reused across content types?

No

No

Yes

Yes

Editor stays in one entry?

Yes

No

Yes

Yes

Extra query parameter needed?

No

includeReference()

No

No

Publishes with the parent entry?

Yes

No, separately

Yes

Yes

Localized with the parent entry?

Yes

No, per referenced entry

Yes

Yes

Good for filtering?

No

Possible, more work

No

Yes

## Decision flow

Use this flow when you are not sure which option fits:

flowchart TD  A[New piece of content] --> B{Is it a label you filter or group by?}  B -- Yes --> T[Taxonomy]  B -- No --> C{Does the same content appear in several entries and need to stay in sync?}  C -- Yes --> R[Reference to its own entry]  C -- No --> D{Do editors compose a variable list of sections?}  D -- Yes --> M[Modular blocks]  D -- No --> E{Is the same set of fields needed on several content types?}  E -- Yes --> G[Global field]  E -- No --> F[Plain fields or a group on the content type]## Where people get confused

### Global fields do not share content

A global field is a shared schema. If you add an seo global field to products, every product gets its own SEO values. Teams expecting "edit once, update everywhere" need a reference.

### Not everything shared needs a reference

Shared structure is a global field. Shared vocabulary is a taxonomy. Only shared content is a reference.

### Deep reference chains

A page that references sections, which reference cards, which reference authors, is three levels deep before you render anything. Every level adds query cost and publishing steps. Multi-content-type reference fields resolve up to three levels with include, and the GraphQL Content Delivery API stops at three levels too. If your model goes deeper, flatten it.

### Using modular blocks for one fixed layout

If a content type always has exactly one hero and one body, plain fields are simpler. Use modular blocks when the list of sections varies per entry.

## Limits to remember

- A content type can have up to 400 fields, counting the fields inside modular blocks, groups and global fields. See [Contentstack limits on one page](/guides/contentstack-limits-on-one-page).


- A reference field can allow up to 50 content types.


- A multiple content type reference field can hold up to 200 entries, and its references resolve up to three levels deep.


- Nested reference publishing sends references up to five levels deep.


- An entry can hold up to 25 taxonomy terms.



## Key takeaways

- Use modular blocks for content that belongs to one entry and varies in structure, like page sections.


- Use a reference when the same content must appear in several places and stay in sync. Resolve it with includeReference(), and remember it publishes and localizes separately.


- Use a global field to reuse a set of fields across content types. It shares the schema, not the values.


- Use a taxonomy for labels you filter by. Query it with taxonomies.<taxonomy_uid>.


- Keep reference chains shallow. Every level costs payload, cache surface and publishing steps.



## Next steps

- See these patterns applied to menus in [Modeling navigation in Contentstack](/guides/modeling-navigation-in-contentstack).


- Refresh the vocabulary in [Core Contentstack concepts](/guides/contentstack-0-to-100-for-developers/core-contentstack-concepts).


- Learn why this site classifies its content with taxonomies in [Taxonomies are your query layer](/blog/taxonomies-are-your-query-layer).





---

## Do this with AI

Install the cms-data-modeling-best-practices skill from [Contentstack agent skills](https://github.com/contentstack/contentstack-agent-skills) and connect the Content Modeler profile in MCP Profile Hub. Then ask your agent:

> Review the content types in my stack and point out modular blocks that should be global fields and reference chains deeper than three levels, with a short reason for each.

New to this? [Set up your AI workbench](/guides/set-up-your-ai-workbench-for-contentstack) first.




---

## Frequently asked questions

### Does a global field share content between entries?

No. A global field shares a schema. Every entry that uses it stores its own values. To share values, use a reference.

### Do referenced entries publish with the parent entry?

Not automatically. A referenced entry is its own entry with its own publish state. Nested reference publishing can send references along with the parent, up to five levels deep.

### Do I need includeReference for modular blocks?

No. Modular block content is stored inside the entry and comes back with it. You only need includeReference for reference fields, including reference fields inside blocks.

### When should I use a taxonomy instead of a reference?

When the value is a label you filter by, like a level or a region. Use a reference when the thing you point at has its own content to render.


---

## Step 2: Modeling navigation in Contentstack

- **Source:** https://developers.contentstack.com/guides/modeling-navigation-in-contentstack
- **Checkpoint:** Your navigation is modeled once and reused by every page.

- **Authors:** Lo Etheridge
- **Published:** 2026-03-17T12:14:29.698Z
- **Updated:** 2026-11-10T16:27:24.930Z
- **Level:** Intermediate
- **Intent:** Learn
- **Tags:** content_modeling, api, visual_editing

---

This guide shows how to model navigation in Contentstack using content types, references, Global Fields, and Modular Blocks. You will build three navigation models that build on each other:

- Simple navigation: internal and external links


- Drop-down navigation: internal and external links under a parent item


- Mega menu: internal and external links, nested drop-down items, plus optional CTAs and images per item (not per column)



## When to use it

Use these patterns when:

- Marketing and product teams need to manage navigation without deploys


- Navigation must link to multiple internal page types (for example Page, Landing Page)


- You need predictable front-end rendering while keeping authoring simple



## Prerequisites

- A Contentstack stack with access to Content Types, Global Fields, and Modular Blocks


- At least two internal page content types (examples used below): Page and Landing Page


- A front end that can resolve referenced entries to URLs (via a url/slug field, or your routing layer)



## How it works

The core problem is modeling a “link” that can point to either:

- An internal entry (one of your page-like content types)


- An external URL



In Contentstack, you typically solve this by creating a reusable Link Global Field using a Modular Block with two mutually exclusive options: Internal and External. Navigation items then compose these links and add structure (drop-downs, mega menu content) around them.

### Assumptions used in this guide

- Internal destinations are references to specific page content types (for example Page and Landing Page).


- Each page type exposes a URL field (for example url or slug) that the front end can use.


- Navigation is modeled as a dedicated content type so it can be versioned, localized, and referenced by pages/layouts.



## Step by step

### Step 1 — Create a reusable Link Global Field

Create a Global Field named link. This will be reused across all navigation use cases.

#### Global Field: link

- label (Single line text, required)


- link (Modular Blocks, required) with blocks:



- internal

- entry (Reference, required; limit to: Page, Landing Page)


- open_in_new_tab (Boolean, default false)




- external

- url (Single line text, required)


- open_in_new_tab (Boolean, default true)





Authoring rule: allow exactly one block instance in link. This makes it explicit that a link is either internal or external.

#### Common pitfalls

- Allowing multiple blocks in the Link field. If authors can add both internal and external, your rendering logic becomes ambiguous.


- Not restricting reference content types. Keep internal links constrained to your page-like types to avoid “linking to anything”.



### Use case 1 — Simple navigation (internal + external links)

## What this does

Models a flat list of navigation items, where each item is a link (internal or external).

## When to use it

- Top bars and footers with one level of links


- Early project phase where you want a stable, minimal model



### Content Type: navigation_simple

- title (Single line text, required)


- items (Group, multiple, required)



#### Group: items[]

- item (Global Field: link, required)



### How it works

items[] is an ordered list. The front end renders each item as a single anchor based on whether the link is internal or external.

### Example entry shape (simplified)

```json
{
  "title": "Header nav",
  "items": [
    {
      "item": {
        "label": "Home",
        "link": [{ "internal": { "entry": { "uid": "home" }, "open_in_new_tab": false } }]
      }
    },
    {
      "item": {
        "label": "Docs",
        "link": [{ "external": { "url": "https://docs.example.com", "open_in_new_tab": true } }]
      }
    }
  ]
}
```

### Common pitfalls

- Missing ordering requirements. Confirm the field preserves order (Groups do) and render in that order.


- Assuming referenced entries include URL by default. Your delivery query needs to include the referenced fields required to build URLs.



### Next steps

Once flat navigation is stable, add drop-down behavior by allowing a parent item to optionally contain child links.

### Use case 2 — Drop-down navigation (internal + external links)

## What this does

Models top-level navigation items that can either be a direct link or a parent item containing a drop-down list of links.

## When to use it

- Header navigation with one drop-down level


- Information architecture where top-level categories expand into child links



### Approach

Use a single nav item structure where each top-level item can be one of:

- A direct link


- A drop-down with child links



### Global Field: nav_item_dropdown

Create a Global Field named nav_item_dropdown using a Modular Block. This keeps the entry shape explicit and avoids optional-field ambiguity.

- item (Modular Blocks, required; allow exactly one block) with blocks:



- link_item

- link (Global Field: link, required)




- dropdown_item

- label (Single line text, required)


- children (Group, multiple, required)





#### Group: dropdown_item.children[]

- link (Global Field: link, required)



### Content Type: navigation_dropdown

- title (Single line text, required)


- items (Group, multiple, required)



#### Group: items[]

- item (Global Field: nav_item_dropdown, required)



### How it works

- link_item renders as a standard navigation link.


- dropdown_item renders as a label (or button) that expands into children[].



### Example entry shape (simplified)

```json
{
  "title": "Header nav",
  "items": [
    {
      "item": {
        "item": [
          { "link_item": { "link": { "label": "Pricing", "link": [{ "internal": { "entry": { "uid": "pricing" } } }] } } }
        ]
      }
    },
    {
      "item": {
        "item": [
          {
            "dropdown_item": {
              "label": "Products",
              "children": [
                { "link": { "label": "Product A", "link": [{ "internal": { "entry": { "uid": "product-a" } } }] } },
                { "link": { "label": "API", "link": [{ "external": { "url": "https://api.example.com" } }] } }
              ]
            }
          }
        ]
      }
    }
  ]
}
```

### Common pitfalls

- Making both a link and children optional in the same object. That produces “sometimes link, sometimes group” logic that breaks validation and authoring.


- Not defining click behavior for drop-down labels. Decide whether the parent label is clickable or only toggles the menu. If clickable, model it as a link too (see next use case).



### Next steps

If you need richer navigation content (promos, CTAs, images) and deeper nesting, introduce a mega menu model that supports multiple item types and optional media per item.

### Use case 3 — Mega menu / complex navigation

## What this does

Models a navigation system that supports:

- Internal and external links


- Drop-downs with nested items


- Optional CTA and images per item (not per column)



## When to use it

- Large sites where navigation contains promoted items, editorial content, or visual tiles


- Multiple navigation “item types” in the same menu (link, group, promo)


- When you need explicit structure to keep rendering deterministic



### Approach

Use a single Navigation content type with a list of top-level items. Each item is a nav node with a specific type. Nodes can contain children, enabling nested structures. Promo content (CTA, image) is attached to nodes, not to columns.

### Global Field: nav_promo

Create a Global Field named nav_promo:

- eyebrow (Single line text, optional)


- description (Single line text or JSON RTE, optional)


- image (Asset, optional; restrict to images if your governance requires it)


- cta (Global Field: link, optional)



### Global Field: nav_node

Create a Global Field named nav_node using Modular Blocks (required; allow exactly one block). This enforces a single node type per item.

- node (Modular Blocks) with blocks:



- link_node

- link (Global Field: link, required)


- promo (Global Field: nav_promo, optional)




- dropdown_node

- label (Single line text, required)


- link (Global Field: link, optional; use if the parent label is clickable)


- items (Group, multiple, required)


- promo (Global Field: nav_promo, optional)





#### Group: dropdown_node.items[]

- item (Global Field: nav_node, required)



This recursion (a node containing a list of nodes) supports deeper nesting while keeping each level typed and predictable.

### Content Type: navigation

- title (Single line text, required)


- location (Dropdown, required; example values: header, footer)


- items (Group, multiple, required)



#### Group: items[]

- item (Global Field: nav_node, required)



### How it works

- Top-level items[] are rendered in order.


- Each item is either a link_node or dropdown_node.


- dropdown_node contains nested items[] of the same nav_node type, allowing multi-level menus.


- Any node can optionally carry promo (image + CTA + copy). This is per item, not per column.



### Example entry shape (simplified)

```json
{
  "title": "Header nav",
  "location": "header",
  "items": [
    {
      "item": {
        "node": [
          {
            "dropdown_node": {
              "label": "Solutions",
              "link": { "label": "All solutions", "link": [{ "internal": { "entry": { "uid": "solutions" } } }] },
              "promo": {
                "eyebrow": "New",
                "description": "See what’s new this quarter",
                "image": { "uid": "asset_uid" },
                "cta": { "label": "Explore", "link": [{ "internal": { "entry": { "uid": "whats-new" } } }] }
              },
              "items": [
                {
                  "item": {
                    "node": [
                      {
                        "link_node": {
                          "link": { "label": "E-commerce", "link": [{ "internal": { "entry": { "uid": "ecommerce" } } }] }
                        }
                      }
                    ]
                  }
                },
                {
                  "item": {
                    "node": [
                      {
                        "dropdown_node": {
                          "label": "Developers",
                          "items": [
                            {
                              "item": {
                                "node": [
                                  {
                                    "link_node": {
                                      "link": { "label": "API Docs", "link": [{ "external": { "url": "https://docs.example.com" } }] }
                                    }
                                  }
                                ]
                              }
                            }
                          ]
                        }
                      }
                    ]
                  }
                }
              ]
            }
          }
        ]
      }
    }
  ]
}
```

### Common pitfalls

- Unbounded depth. Recursive models are powerful, but teams often need a maximum depth (for example 2 or 3 levels) to keep UX and accessibility manageable. If you need a hard limit, enforce it in editorial guidelines and front-end validation.


- Promo content without rendering rules. Define where promos appear (for example right rail, inline tile) and what happens when both an image and CTA are missing.


- Overusing references for navigation nodes. Keep nodes embedded in the navigation entry unless you truly need node reuse across multiple navigations. Reference-heavy navigation increases query complexity and makes preview/debugging harder.


- Inconsistent internal URL resolution. Ensure all referenced page types expose the fields your router needs, and your query includes them.



## Next steps

- Define a routing contract for internal pages (for example each page type must have url).


- Add validation in your front end (or webhook) to enforce maximum depth and required fields per node type.


- Decide how navigation is selected per locale/site (for example one navigation entry per locale and location).





---

## Step 3: Contentstack limits on one page

- **Source:** https://developers.contentstack.com/guides/contentstack-limits-on-one-page
- **Checkpoint:** You know the reference depth, entry size and rate limits your model has to fit.

- **Authors:** Tim Benniks
- **Published:** 2026-12-02T09:00:00.000Z
- **Updated:** 2026-11-15T10:55:45.531Z
- **Level:** Beginner
- **Intent:** Learn
- **Tags:** api, headless, content_modeling

---

Contentstack limits are spread over dozens of documentation pages, and you usually find the right one after you hit the limit. This page collects the public limits in one place, grouped by area, so you can check a content model or a job before it fails.

Every value here comes from the public documentation and was checked in December 2026. Limits change, and many depend on your plan, so follow the docs link in each section for the current value.

## What you'll learn

- The API rate limits and why they are per organization


- How deep you can include references in REST and GraphQL


- The schema limits for content types, fields, Modular Blocks and Global fields


- The limits for taxonomy, entry variants, assets, publishing, webhooks, Launch and the CLI


- Which limits depend on your plan, and which guide helps when you hit one



## How to read this page

Plan-dependent means the documentation says the value depends on your plan, or that Contentstack support can raise it. Default values apply when nothing else is set for your organization. Where two documentation pages disagree, the table gives the value from the most recently updated page and says so.

Two things to keep in mind before the tables:

- Rate limits are per organization. Your builds, imports, scripts, Automate workflows and integrations all share them.


- Cached Delivery API responses are not rate limited. Only requests that reach the origin count. They all still count toward your overall API usage.



## API rate limits

Limit

Value

Plan-dependent

When you hit it

Docs

Content Delivery API, uncached requests

100 per second per organization

Yes

HTTP 429

[CDA](https://www.contentstack.com/docs/developers/apis/content-delivery-api)

Image Delivery API, uncached requests

Counts toward the CDA limit

Yes

HTTP 429

[CDA](https://www.contentstack.com/docs/developers/apis/content-delivery-api)

GraphQL Content Delivery API, uncached requests

80 per second per organization

Yes

HTTP 429

[GraphQL](https://www.contentstack.com/docs/developers/apis/graphql-content-delivery-api)

Content Management API, reads

10 per second per organization

Yes

HTTP 429

[CMA](https://www.contentstack.com/docs/developers/apis/content-management-api)

Content Management API, writes

10 per second per organization

Yes

HTTP 429

[CMA](https://www.contentstack.com/docs/developers/apis/content-management-api)

CMA bulk actions

1 request per second

Yes

HTTP 429

[CMA](https://www.contentstack.com/docs/developers/apis/content-management-api)

Stack creation

1 stack per minute per organization

No

Request rejected

[Stack limitations](https://www.contentstack.com/docs/headless-cms/stack-limitations)

The X-RateLimit-Limit and X-RateLimit-Remaining response headers show your actual limit and what's left in the current second. When you hit a rate limit, read [Fix 429 rate limit errors in builds, imports and bulk publish](/guides/fix-429-rate-limit-errors-in-builds-imports-and-bulk-publish). For timeouts and 5xx errors, read [ETIMEDOUT, 5xx and timeouts from the Delivery API](/guides/etimedout-5xx-and-timeouts-from-the-delivery-api).

## Content Delivery API (REST)

Limit

Value

Plan-dependent

When you hit it

Docs

Request URL size on the CDN

8 KB

No

HTTP 414 URI Too Long

[CDA](https://www.contentstack.com/docs/developers/apis/content-delivery-api)

Entries or assets per response

100 by default; set more with limit and page with skip

No

You get the first page only

[CDA](https://www.contentstack.com/docs/developers/apis/content-delivery-api)

Content types per "get all content types" response

100

No

Page with skip

[CDA](https://www.contentstack.com/docs/developers/apis/content-delivery-api)

include_all_depth

5 levels (include_all alone resolves 1)

No

Error

[CDA](https://www.contentstack.com/docs/developers/apis/content-delivery-api)

Reference paths per request (include[] or include_all)

100

No

Error; reduce depth or includes

[CDA](https://www.contentstack.com/docs/developers/apis/content-delivery-api)

Depth of a multiple content type Reference field

3 levels

No

Not documented

[CDA](https://www.contentstack.com/docs/developers/apis/content-delivery-api)

Recursive embedded items (embedded_items_depth)

5 levels

No

Values above 5 are clamped to 5

[CDA](https://www.contentstack.com/docs/developers/apis/content-delivery-api)

Sync API page size

100 items

No

You get a pagination_token for the next page

[CDA](https://www.contentstack.com/docs/developers/apis/content-delivery-api)

Long $in lists and many includes push a URL past 8 KB. [Nested references empty or error 141](/guides/nested-references-empty-or-error-141) covers both.

## GraphQL Content Delivery API

Limit

Value

Plan-dependent

When you hit it

Docs

Nested reference depth

3 levels

No

Query rejected

[GraphQL limitations](https://www.contentstack.com/docs/developers/apis/graphql-content-delivery-api/limitations)

Reference depth in a where filter

3 levels

No

Query rejected

[GraphQL limitations](https://www.contentstack.com/docs/developers/apis/graphql-content-delivery-api/limitations)

Objects fetched in one query

7,500

No

Query rejected

[GraphQL limitations](https://www.contentstack.com/docs/developers/apis/graphql-content-delivery-api/limitations)

Referenced items per Reference field

100

No

Page with skip and limit on the connection

[GraphQL limitations](https://www.contentstack.com/docs/developers/apis/graphql-content-delivery-api/limitations)

Embedded items per JSON RTE field

100

No

Page the embedded items

[GraphQL limitations](https://www.contentstack.com/docs/developers/apis/graphql-content-delivery-api/limitations)

Content types queried in one request

3

No

Query rejected

[GraphQL limitations](https://www.contentstack.com/docs/developers/apis/graphql-content-delivery-api/limitations)

Response size

7 MB

No

Query rejected

[GraphQL limitations](https://www.contentstack.com/docs/developers/apis/graphql-content-delivery-api/limitations)

limit on a collection

25 by default, 100 maximum

No

Page with skip

[GraphQL](https://www.contentstack.com/docs/developers/apis/graphql-content-delivery-api)

Content type schemas generated per request

100

No

Page the introspection schema

[GraphQL limitations](https://www.contentstack.com/docs/developers/apis/graphql-content-delivery-api/limitations)

GraphQL errors don't always come back as a non-200 status. [GraphQL errors decoded](/guides/graphql-errors-decoded) lists the error codes and what each one means.

## Content types, fields and Global fields

Limit

Value

Plan-dependent

When you hit it

Docs

Fields per content type, including nested fields

400

Default

Schema save rejected

[Field limitations](https://www.contentstack.com/docs/headless-cms/field-limitations)

Content type UID

200 characters; letters, numbers and underscores

No

Schema save rejected

[Content type limitations](https://www.contentstack.com/docs/developers/create-content-types/limitations-of-content-types)

Content type description

255 characters

No

Schema save rejected

[Content type limitations](https://www.contentstack.com/docs/developers/create-content-types/limitations-of-content-types)

Title field and Display Name

200 characters

Default

Save rejected

[Field limitations](https://www.contentstack.com/docs/headless-cms/field-limitations)

Modular Blocks fields per content type

5

Default

Schema save rejected

[Field limitations](https://www.contentstack.com/docs/headless-cms/field-limitations)

Block definitions per Modular Blocks field

100

Default

Schema save rejected

[Field limitations](https://www.contentstack.com/docs/headless-cms/field-limitations)

Block instances per Modular Blocks field in an entry

100

Default

Entry save rejected

[Field limitations](https://www.contentstack.com/docs/headless-cms/field-limitations)

Nested block levels

2

Default

Schema save rejected

[Field limitations](https://www.contentstack.com/docs/headless-cms/field-limitations)

Group nesting

5 levels

Default

Schema save rejected

[Field limitations](https://www.contentstack.com/docs/headless-cms/field-limitations)

Fields in a Group, including nested fields

100

Default

Schema save rejected

[Field limitations](https://www.contentstack.com/docs/headless-cms/field-limitations)

Global fields per content type

25

Default

Schema save rejected

[Field limitations](https://www.contentstack.com/docs/headless-cms/field-limitations)

Global fields per organization

1,000

Default

Creation rejected

[Field limitations](https://www.contentstack.com/docs/headless-cms/field-limitations)

Fields within a Global field

100

Default

Schema save rejected

[Field limitations](https://www.contentstack.com/docs/headless-cms/field-limitations)

Global field nesting

5 levels, including the parent

Default

Schema save rejected

[Global field limitations](https://www.contentstack.com/docs/developers/global-field/limitations-of-global-field)

Instances of a Global field marked Multiple

100

No

Entry save rejected

[Global field limitations](https://www.contentstack.com/docs/developers/global-field/limitations-of-global-field)

Custom fields per content type

10

Default

Schema save rejected

[Field limitations](https://www.contentstack.com/docs/headless-cms/field-limitations)

Select field options

100, each up to 100 characters

Default

Schema save rejected

[Field limitations](https://www.contentstack.com/docs/headless-cms/field-limitations)

Field visibility rules per content type

10 rules, 5 conditions and 5 target fields each

Default

Schema save rejected

[Field limitations](https://www.contentstack.com/docs/headless-cms/field-limitations)

Reference field query limit

100

No

Not documented

[Entries limitations](https://www.contentstack.com/docs/headless-cms/entries-limitations)

Tags per entry

50, each up to 50 characters

No

Entry save rejected

[Entries limitations](https://www.contentstack.com/docs/headless-cms/entries-limitations)

> Watch for: The Field Limitations page (updated November 2026) gives 400 fields per content type and 100 fields within a Global field. The older content type and Global field pages say 500 for both. Plan against the lower number.

Fields inside Modular Blocks, Groups and Global fields all count toward the content type total. [Modular Blocks, references or Global fields](/guides/modular-blocks-references-or-global-fields) helps you pick the structure that keeps the count down.

## Taxonomy

Limit

Value

Plan-dependent

When you hit it

Docs

Taxonomies per stack

Depends on your plan

Yes

Creation rejected

[Taxonomy limitations](https://www.contentstack.com/docs/headless-cms/limitations-for-taxonomy)

Terms per taxonomy

10,000

No

Term creation rejected

[Taxonomy limitations](https://www.contentstack.com/docs/headless-cms/limitations-for-taxonomy)

Terms per entry

25

No

Entry save rejected

[Taxonomy limitations](https://www.contentstack.com/docs/headless-cms/limitations-for-taxonomy)

Term depth

10 levels

No

Term creation rejected

[Taxonomy limitations](https://www.contentstack.com/docs/headless-cms/limitations-for-taxonomy)

Taxonomy and term name or UID

50 characters

No

Save rejected

[Taxonomy limitations](https://www.contentstack.com/docs/headless-cms/limitations-for-taxonomy)

Taxonomy fields per content type

1, which can hold several taxonomies

No

Not possible to add a second

[Taxonomy limitations](https://www.contentstack.com/docs/headless-cms/limitations-for-taxonomy)

The Taxonomy field can't go inside Modular Blocks or Groups, and only published taxonomies are available through the Delivery API. [Querying content by taxonomy](/guides/querying-content-by-taxonomy) shows how the limits shape queries.

## Entry variants

Limit

Value

Plan-dependent

When you hit it

Docs

Variants merged with the base entry per CDN request

3

No

Only 3 variants are merged

[Entry variant limitations](https://www.contentstack.com/docs/headless-cms/limitations-for-entry-variants)

Timeout for entry variant requests

10 seconds

No

Request fails

[CDA](https://www.contentstack.com/docs/developers/apis/content-delivery-api)

Response size, all variants of an entry

10 MB

No

Request fails

[CDA](https://www.contentstack.com/docs/developers/apis/content-delivery-api)

Response size, a single entry variant

3 MB

No

Request fails

[CDA](https://www.contentstack.com/docs/developers/apis/content-delivery-api)

Entry variants need to be enabled for your organization, and custom queries only match base entry data. [Personalize variant returns base entry or null](/guides/personalize-variant-returns-base-entry-or-null) covers the most common problems.

## Stacks, branches, environments and locales

Limit

Value

Plan-dependent

When you hit it

Docs

Branches per stack

5

Yes

Creation rejected

[Stack limitations](https://www.contentstack.com/docs/headless-cms/stack-limitations)

Branch ID

15 characters, lowercase, _ as separator

No

Creation rejected

[Branch limitations](https://www.contentstack.com/docs/headless-cms/limitations-of-branches)

Environments per stack

5

Default

Creation rejected

[Stack limitations](https://www.contentstack.com/docs/headless-cms/stack-limitations)

Fallback language levels

1

No

You can't chain fallbacks

[Localization limitations](https://www.contentstack.com/docs/headless-cms/limitations-of-localization)

Management tokens per stack

10 valid at a time

No

Creation rejected

[CMA](https://www.contentstack.com/docs/developers/apis/content-management-api)

Authtokens per user

20 valid at a time

No

Not documented

[CMA](https://www.contentstack.com/docs/developers/apis/content-management-api)

The one-level fallback rule explains most "why am I getting en-us content" questions. [Locale fallback explained](/guides/why-am-i-getting-en-us-content-locale-fallback-explained) walks through it.

## Assets and images

Limit

Value

Plan-dependent

When you hit it

Docs

Asset file size

700 MB in the UI, 100 MB through the API

Can be raised

Upload rejected

[Asset limitations](https://www.contentstack.com/docs/headless-cms/asset-limitations)

Assets per upload batch

10

Can be raised

Upload rejected

[Asset limitations](https://www.contentstack.com/docs/headless-cms/asset-limitations)

Assets per stack

10,000

Can be raised

Upload rejected

[Asset limitations](https://www.contentstack.com/docs/headless-cms/asset-limitations)

Image optimization input size

50 MB

Can be raised

Not documented

[Asset limitations](https://www.contentstack.com/docs/headless-cms/asset-limitations)

Image optimization input dimensions

12,000 × 12,000 pixels

Can be raised

Not documented

[Asset limitations](https://www.contentstack.com/docs/headless-cms/asset-limitations)

Image optimization output dimensions

8,192 × 8,192 pixels

Can be raised

Not documented

[Asset limitations](https://www.contentstack.com/docs/headless-cms/asset-limitations)

Animated GIF frames

1,000

Can be raised

Not documented

[Asset limitations](https://www.contentstack.com/docs/headless-cms/asset-limitations)

These apply to assets stored in a stack. The newer Assets product raises several of them. [Image transforms that surprise you](/guides/image-transforms-that-surprise-you) covers transform behavior.

## Publishing, bulk operations and releases

Limit

Value

Plan-dependent

When you hit it

Docs

Bulk publish or unpublish in the UI

100 entries, 10 languages, 10 environments at a time

Can be raised

Selection capped

[Bulk operation limitations](https://www.contentstack.com/docs/headless-cms/limitations-of-bulk-operations-on-entries)

Items per bulk publish API request

10

Plan feature

Split into more requests

[CMA bulk operations](https://www.contentstack.com/docs/developers/apis/content-management-api/bulk-operations)

Select all records

10,000 entries

No

Only the first 10,000 are acted on

[Bulk operation limitations](https://www.contentstack.com/docs/headless-cms/limitations-of-bulk-operations-on-entries)

Bulk delete in the UI

100 entries

Can be raised

Selection capped

[Bulk operation limitations](https://www.contentstack.com/docs/headless-cms/limitations-of-bulk-operations-on-entries)

Scheduled bulk action

Up to 12 months ahead

No

Date rejected

[Bulk operation limitations](https://www.contentstack.com/docs/headless-cms/limitations-of-bulk-operations-on-entries)

Nested reference publishing depth

5 levels

Yes

Deeper references aren't published

[Nested reference publishing](https://www.contentstack.com/docs/headless-cms/limitations-for-nested-reference-publishing)

Parent entries in a nested bulk publish

100

No

Selection capped

[Nested reference publishing](https://www.contentstack.com/docs/headless-cms/limitations-for-nested-reference-publishing)

Active bulk publish jobs per organization

2

No

Extra jobs wait

[Nested reference publishing](https://www.contentstack.com/docs/headless-cms/limitations-for-nested-reference-publishing)

Items in a release

500

No

Item not added

[Release limitations](https://www.contentstack.com/docs/headless-cms/releases-limitations)

Items added to a release per API request

25

No

Split into more requests

[Release limitations](https://www.contentstack.com/docs/headless-cms/releases-limitations)

Nested reference publishing doesn't apply when you publish through a release. [Releases, bulk publish and nested reference publishing explained](/blog/releases-bulk-publish-and-nested-reference-publishing-explained) compares the options, and [Publishing stuck or references not published](/guides/publishing-stuck-or-references-not-published) helps when a job doesn't finish.

## Webhooks

Limit

Value

Plan-dependent

When you hit it

Docs

Webhooks per stack

100

Can be raised

Creation rejected

[Webhook limitations](https://www.contentstack.com/docs/headless-cms/limitations-of-webhooks)

Conditions per webhook

200

No

Save rejected

[Webhook limitations](https://www.contentstack.com/docs/headless-cms/limitations-of-webhooks)

Emails notified when the circuit breaker disables a webhook

10

No

Save rejected

[Webhook limitations](https://www.contentstack.com/docs/headless-cms/limitations-of-webhooks)

[Webhooks: allowlisting, signatures and disabled endpoints](/guides/webhooks-allowlisting-signatures-and-disabled-endpoints) covers the circuit breaker and how to get a disabled webhook running again.

## Launch

Limit

Value

Plan-dependent

When you hit it

Docs

Request headers

About 10 KB

No

Request rejected

[Launch platform limits](https://www.contentstack.com/docs/launch/platform-limits-on-launch)

Request body

128 KB on the platform limits page; the CF1001 error reference says 5 MB

No

Request rejected with 413 (CF1001)

[Launch platform limits](https://www.contentstack.com/docs/launch/platform-limits-on-launch)

Response headers

32 KB

No

Response fails

[Launch platform limits](https://www.contentstack.com/docs/launch/platform-limits-on-launch)

Response body

5 MB

No

Response fails

[Launch platform limits](https://www.contentstack.com/docs/launch/platform-limits-on-launch)

Cloud Function and SSR request timeout

30 seconds by default, up to 780 seconds

Yes

Request times out

[Launch platform limits](https://www.contentstack.com/docs/launch/platform-limits-on-launch)

Time to first response byte

98 seconds

No

Connection closes

[Launch platform limits](https://www.contentstack.com/docs/launch/platform-limits-on-launch)

Cache revalidations per day

500 (Enterprise: 2,000)

Yes

Revalidation rejected until 00:00 UTC

[Launch platform limits](https://www.contentstack.com/docs/launch/platform-limits-on-launch)

Origin delivery rate

200 requests per second (Enterprise: 1,200)

Yes

Origin requests throttled

[Launch platform limits](https://www.contentstack.com/docs/launch/platform-limits-on-launch)

The origin delivery limit counts cache misses to your site's origin, separate from the API rate limits your code calls. Edge function limits, environment variable limits and log retention are in [Logs, debugging and limits](/guides/launch-edge-functions-redirects-and-caching/logs-debugging-and-limits). The error codes you see when a Launch limit is hit are in [Launch error codes decoded](/guides/launch-error-codes-decoded).

## CLI

Limit

Value

Plan-dependent

When you hit it

Docs

Request and response size (maxContentLength, maxBodyLength)

100 MB by default

Configurable in the config file

Export or import fails

[CLI import](https://www.contentstack.com/docs/headless-cms/import-content-using-the-cli)

Share of the rate limit the CLI uses

50% by default

Configurable with csdx config:set:rate-limit

Slower jobs, fewer 429s

[CLI rate limits](https://www.contentstack.com/docs/headless-cms/configure-rate-limits-in-the-cli)

[csdx import and export failures](/guides/csdx-import-and-export-failures) covers memory errors and other ways large CLI jobs fail.

## Key takeaways

- API rate limits are per organization: 100 uncached CDA requests per second, 80 for GraphQL, 10 reads and 10 writes for the CMA, 1 per second for bulk actions. Your plan can change all of them.


- Cached Delivery API responses don't count against the rate limit, so caching is the cheapest way to stay under it.


- REST includes go 5 levels deep with at most 100 reference paths. GraphQL goes 3 levels deep and returns at most 7 MB.


- A content type holds 400 fields in total, counting everything inside Modular Blocks, Groups and Global fields.


- Taxonomies allow 25 terms per entry and 10 levels of depth. Releases hold 500 items.


- On Launch, server functions time out after 30 seconds by default, and responses are capped at 5 MB.


- Values were checked in December 2026. Follow the docs link in each section for the current number.





---

## Do this with AI

Install the cms-data-modeling-best-practices skill from [Contentstack agent skills](https://github.com/contentstack/contentstack-agent-skills) and connect the Content Modeler profile in MCP Profile Hub. Then ask your agent:

> Go through every content type in my stack and report which ones are close to a limit: more than 300 fields in total, more than 20 Global fields, Modular Blocks nested 2 levels deep, or more than 80 block definitions in one Modular Blocks field. Suggest how to simplify the worst three, but don't change any schema.

New to this? [Set up your AI workbench](/guides/set-up-your-ai-workbench-for-contentstack) first.




---

## Frequently asked questions

### Are Contentstack rate limits per stack or per organization?

Per organization. Every stack, build, script and integration in the organization shares the same API rate limits.

### Can Contentstack limits be raised?

Many can. Rate limits, nested reference publishing depth, the number of taxonomies and branches, and several asset and webhook limits depend on your plan or can be raised by Contentstack support.

### How many fields can a content type have?

The Field Limitations page lists a maximum of 400 fields per content type, counting fields inside Modular Blocks, groups and Global fields.

### How deep can I include references in one Delivery API request?

Up to 5 levels with include_all_depth on the REST Delivery API, and up to 100 reference paths per request. GraphQL fetches nested references up to 3 levels deep.

### When were these values checked?

In December 2026, against the public Contentstack documentation. Each section links to the page it comes from, so check there for the current value.


---

## Step 4: Nested references come back empty, or fail with error 141

- **Source:** https://developers.contentstack.com/guides/nested-references-empty-or-error-141
- **Checkpoint:** Your nested references resolve, and you know what error 141 means.

- **Authors:** Tim Benniks
- **Published:** 2026-12-09T09:00:00.000Z
- **Updated:** 2026-11-15T10:56:10.772Z
- **Level:** Intermediate
- **Intent:** Fix
- **Tags:** api, sdk, content_modeling

---

A page renders without its author, a card list is empty, or the whole request fails with 422 and error_code: 141. The entry is there in the CMS, the references are filled in, and the response still does not contain them.

This usually happens on pages built from modular blocks, global fields and references, fetched with the TypeScript Delivery SDK or the Content Delivery API (CDA) from a server, a static build or a Live Preview session. The causes are few, and each leaves a different trace in the response.

## What you'll learn

- How to recognize each cause from what the response looks like


- How to write include[] paths that match your schema, including blocks and global fields


- Where the depth and include limits are, and what happens when you cross them


- How publish state and locale affect resolved references


- How to model content so pages do not need deep reference chains



## Symptoms

What you see

Likely cause

The reference field holds [{ "uid": "blt...", "_content_type_uid": "author" }]

The path was not included

The field is resolved at level one, but nested references are still bare UIDs

include_all without a depth, or a nested path missing from include[]

A multiple reference field returns fewer items than the editor selected

Some referenced entries are not published to that environment or locale

A reference inside a modular block or global field is never resolved

The include path skips a block UID or uses the wrong global field UID

422 with "error_code": 141 and "Failed to fetch entries. Please try again with valid parameters."

The API rejected a parameter, for example a depth or include count over the limit

422 with "error_code": 141 and "The requested object doesn't exist."

The entry you fetched by UID is not published in that environment and locale

414 URI Too Long

Too many or too long include paths in the URL

## Why it happens

Contentstack concept: A Reference field stores pairs of uid and _content_type_uid. The referenced entry is a separate entry with its own versions, its own localized copies and its own publish state per environment and locale.

Three things follow from that.

First, references are lazy. The CDA returns the stored pairs unless you ask it to resolve a path with include[]. Nothing is resolved by default, and a nested reference is only resolved when its full path is included too.

Second, the CDA resolves a reference from what is published. If the referenced entry is not published to the environment and locale you query, there is nothing to inline, and it drops out of the result.

Third, resolution is bounded. Each included level multiplies the entries the CDA has to fetch, so the API caps the number of paths and the depth. Requests that go past those caps fail instead of returning partial data.

If you come from SQL, think of include[] as an explicit join list. There is no lazy loading on access, and the joins you do not name are not made.

## Fix it

### The path is not included

Include every path the page renders. With the TypeScript Delivery SDK, call includeReference() before you build the query. Nested references use dot notation, and each level needs its own path:

```typescript
import contentstack, { QueryOperation } from "@contentstack/delivery-sdk";

const stack = contentstack.stack({
  apiKey: process.env.CONTENTSTACK_API_KEY!,
  deliveryToken: process.env.CONTENTSTACK_DELIVERY_TOKEN!,
  environment: process.env.CONTENTSTACK_ENVIRONMENT!,
});

const result = await stack
  .contentType("blogpost")
  .entry()
  .includeReference("author", "author.company", "related_posts")
  .query()
  .where("url", QueryOperation.EQUALS, "/blog/hello-world")
  .find();
```

author.company resolves the company referenced from the author. Without it, author is resolved and author.company stays a bare UID.

The same request with curl:

```bash
curl -G "https://cdn.contentstack.io/v3/content_types/blogpost/entries" \
  -H "api_key: $CONTENTSTACK_API_KEY" \
  -H "access_token: $CONTENTSTACK_DELIVERY_TOKEN" \
  --data-urlencode "environment=production" \
  --data-urlencode "include[]=author" \
  --data-urlencode "include[]=author.company" \
  --data-urlencode "include[]=related_posts"
```

Use your region's CDA host if your stack is not in AWS North America.

If a reference field allows more than one content type, also call includeReferenceContentTypeUID(). Each resolved entry then carries its _content_type_uid, so your renderer knows which component to use.

### References inside modular blocks, groups and global fields

Paths follow the schema, not the rendered shape. For a reference inside a block, the path is the modular blocks field UID, then the block UID, then the reference field UID:

```typescript
const page = await stack
  .contentType("landing_page")
  .entry()
  .includeReference(
    "sections.testimonial.person",
    "sections.card_grid.cards",
    "sections.card_grid.cards.author"
  )
  .query()
  .where("url", QueryOperation.EQUALS, "/pricing")
  .find();
```

Groups work the same way: group_uid.reference_uid.

Global fields are where most paths go wrong. A global field behaves like a group, and the path uses the UID the global field has on this content type, not the UID of the global field itself. If the seo global field is added to landing_page as page_seo, and it contains a reference og_author, the path is page_seo.og_author. Inside a block, it becomes sections.hero.page_seo.og_author.

Fetch the content type's schema from GET /v3/content_types/landing_page on the CDA and read the uid values from the top down. That is your path. A path that does not match resolves nothing, or fails the request.

### The referenced entry is not published

Publishing a blog post does not publish its author. If the author is unpublished, or published to staging but not production, or published in en-us but not de-de, it is missing from the resolved response.

Fix it at the source:

- Publish the referenced entries to the same environment and locale. In the publish dialog, editors can include references, and nested reference publishing sends them up to five levels deep.


- For locales, check whether the referenced entry is published in the locale you request. If you rely on fallback, pass include_fallback=true (see [Why am I getting en-us content?](/guides/why-am-i-getting-en-us-content-locale-fallback-explained)).



In code, treat a resolved reference as optional. A field that is required in the CMS can still be missing in the delivered JSON:

```typescript
type Author = { uid: string; title: string; url?: string };

function authorsOf(entry: { author?: Author[] }) {
  return (entry.author ?? []).filter((a): a is Author => Boolean(a?.title));
}
```

The filter drops stubs that only have a uid, so one missing author does not break the page. The [publishing explainer](/blog/releases-bulk-publish-and-nested-reference-publishing-explained) covers releases, bulk publish and nested reference publishing, and [Publishing stuck or references not published](/guides/publishing-stuck-or-references-not-published) covers the publish side of this problem.

### include_all without a depth

include_all=true resolves every reference field on the entry, but only one level deep. Nested references stay as UIDs. Add include_all_depth to go further:

```typescript
const page = await stack
  .contentType("landing_page")
  .entry()
  .addParams({ include_all: true, include_all_depth: 2 })
  .query()
  .where("url", QueryOperation.EQUALS, "/pricing")
  .find();
```

The maximum depth is 5. A higher value returns an error. Use include_all for prototypes and preview tooling. For production pages, list the paths. It is easier to reason about and fetches less.

### Too deep or too many includes: 422 with error_code 141

The CDA rejects a request it will not resolve, with 422, error_code: 141 and the message Failed to fetch entries. Please try again with valid parameters. The errors object in the body usually names the parameter. The limits to check:

Limit

Value

Reference paths per request (include[] or include_all)

100

include_all_depth

1 by default, 5 at most

Multiple content type Reference fields

resolve up to 3 levels deep

Request URL size on the CDN

8 KB, above that 414 URI Too Long

Paths count per path, not per entry. sections.card_grid.cards and sections.card_grid.cards.author are two paths. A page with ten block types and three levels each reaches 100 quickly.

When you hit one of these, split the request. Fetch the page with the first levels, collect the UIDs of the deep references, and fetch those in a second query:

```typescript
const [page] = (await stack
  .contentType("landing_page")
  .entry()
  .includeReference("sections.card_grid.cards")
  .query()
  .where("url", QueryOperation.EQUALS, "/pricing")
  .find()).entries ?? [];

const authorUids = (page?.sections ?? [])
  .flatMap((s: any) => s.card_grid?.cards ?? [])
  .flatMap((card: any) => card.author ?? [])
  .map((ref: { uid: string }) => ref.uid);

const authors = authorUids.length
  ? (await stack
      .contentType("author")
      .entry()
      .query()
      .containedIn("uid", [...new Set(authorUids)])
      .find()).entries ?? []
  : [];
```

Two small requests are cheaper and easier to cache than one request at the edge of every limit.

### Error 141 that has nothing to do with references

141 is a generic code. Before you rewrite include paths, rule out the other causes:

- The requested object doesn't exist. on a single-entry fetch means that entry is not published in that environment and locale, or the UID belongs to another content type.


- An environment or locale the delivery token cannot read also returns 422 with 141. Check that the token is scoped to the environment, and that the locale code exists in the stack in lowercase.


- A malformed query parameter returns the same Failed to fetch entries message.



Strip the request down to environment only. If that works, add parameters back one by one until it fails.

## Check that it worked

Run the request with curl and inspect the reference field:

```bash
curl -sG "https://cdn.contentstack.io/v3/content_types/landing_page/entries" \
  -H "api_key: $CONTENTSTACK_API_KEY" \
  -H "access_token: $CONTENTSTACK_DELIVERY_TOKEN" \
  --data-urlencode "environment=production" \
  --data-urlencode 'query={"url":"/pricing"}' \
  --data-urlencode "include[]=sections.card_grid.cards" \
  | jq '.entries[0].sections[] | .card_grid.cards[]? | {uid, title}'
```

Every card should have a title. A card with only uid is either a path you did not include or an entry that is not published. Compare the count with the editor's selection to spot unpublished entries.

## Prevent it

- Keep include paths next to the component that renders them, and build the list for a page from the components it uses. A new block then brings its own paths.


- Type resolved references as optional in your code. The CMS can require a reference that the delivery response leaves out.


- Teach editors to publish with references, or bundle pages and their references in a release.


- Keep reference chains short. A page that references sections, which reference cards, which reference authors, is three levels deep before it renders. Most of those levels can be modular blocks or global fields, which come back with the entry for free. [Modular blocks, references or global fields?](/guides/modular-blocks-references-or-global-fields) walks through that decision with examples.


- Watch the URL length when you build paths programmatically. A long list of includes is the most common source of 414.



## Key takeaways

- References are not resolved unless you include the full dot-notation path, one path per level.


- Paths follow the schema: blocks field UID, block UID, the global field's UID on this content type, then the reference field UID.


- A referenced entry that is not published in that environment and locale drops out of the response.


- include_all stops at depth 1 unless you set include_all_depth, which goes up to 5. A request resolves at most 100 paths.


- 422 with error_code: 141 is generic. Read the message and the errors object before you change anything.


- Split deep pages into two queries, and model shared content as blocks or global fields when it does not need its own lifecycle.



## Next steps

- Read [Modular blocks, references or global fields?](/guides/modular-blocks-references-or-global-fields) before you add another reference level.


- If you query with GraphQL, see [GraphQL errors decoded](/guides/graphql-errors-decoded) for the depth and cost limits there.


- Keep [Contentstack limits on one page](/guides/contentstack-limits-on-one-page) open while you design queries.





---

## Do this with AI

Install the cms-data-modeling-best-practices and dx-delivery-sdk skills from [Contentstack agent skills](https://github.com/contentstack/contentstack-agent-skills) and connect the Broken Reference Checker profile in MCP Profile Hub. Then ask your agent:

> Check the published landing_page entries in production for references that point to unpublished or deleted entries, list the include paths my page query needs for every reference field in that content type, and flag any path deeper than three levels.

New to this? [Set up your AI workbench](/guides/set-up-your-ai-workbench-for-contentstack) first.




---

## Frequently asked questions

### Why does my reference field only contain uid and _content_type_uid?

References are not resolved unless you ask for them. Add the field path to include[] or call includeReference() with the full dot-notation path.

### Why is a referenced entry missing from the array even though it exists?

The referenced entry is not published to that environment and locale. The parent's publish does not publish its references.

### How deep can include_all go?

include_all resolves one level by default. include_all_depth raises that up to 5, and a request resolves at most 100 reference paths whatever the depth.

### What does error_code 141 mean on the Content Delivery API?

It is a generic 422 code. It covers missing entries, an environment or locale the token cannot read, and request parameters the API rejects, so read the error message and errors object, not just the code.

### How do I include a reference that sits in a global field inside a modular block?

Use the full path from the content type, starting with the modular blocks field UID, block UID, the global field's UID on that content type, then the reference field UID.


---

## Step 5: Taxonomies are your query layer

- **Source:** https://developers.contentstack.com/blog/taxonomies-are-your-query-layer
- **Checkpoint:** You know when a taxonomy beats a reference field.

- **Authors:** Tim Benniks
- **Published:** 2026-11-17T09:00:00.000Z
- **Updated:** 2026-11-15T10:56:51.426Z
- **Level:** Intermediate
- **Intent:** Learn
- **Tags:** taxonomy, content_modeling

---

Taxonomies are usually treated as a tagging feature for editors. On developers.contentstack.com they became the thing every listing, filter, card, markdown file and agent index reads from. If I had to name the one modeling decision that made the learning restructure possible, it is this one.

## The short version

- We tag every blog post, guide, kickstart and live stream with four taxonomies: subjects, technology, intent and level.


- level and intent are tiny closed sets. Every entry gets exactly one term from each, and those two facets do more work than all the subjects combined.


- On top of the taxonomies we added two fields (prerequisites and outcome) and one content type (path). That was enough to build /paths, level and intent filters, and markdown that agents can reason about.


- Taxonomies beat tags, select fields and reference fields for classification because they live at the stack level and you query them the same way everywhere.



## What was wrong before

The site had plenty of content: multi-chapter guides, kickstarts, live streams, blog posts. What it did not have was order. A developer landing on a guide from search had no idea whether it assumed a week of Contentstack experience or none. There was no "start here" and no "what next".

The site already had two taxonomies. subjects covered topics like ai, headless and personalization. technology covered frameworks like next and nuxt. Both answer "what is this about?" Neither answers the question a developer actually has: "is this page for me, right now?"

We also noticed that a big share of readers are agents, or developers working through one in Cursor, Claude Code or Codex. They read the .md routes and llms.txt. An agent has the same problem as a person, only worse: it cannot skim a page and guess the level from the tone.

## Four taxonomies, two of them small

I added two taxonomies to the stack:

- level: beginner, intermediate, advanced


- intent: learn, build, fix, ship



Because taxonomies are stack-level, I defined them once and attached them to the Taxonomy field on blog posts, guides, kickstarts and live streams. Every entry gets exactly one term from each.

The code that reads them is boring, which is what you want:

```typescript
type Taxonomy = { taxonomy_uid: string; term_uid: string };

const LEVELS = new Set(["beginner", "intermediate", "advanced"]);
const INTENTS = new Set(["learn", "build", "fix", "ship"]);

export function extractLearningMeta(taxonomies: Taxonomy[] = []) {
  const term = (uid: string) => taxonomies.find((t) => t.taxonomy_uid === uid)?.term_uid;
  const level = term("level");
  const intent = term("intent");
  return {
    level: level && LEVELS.has(level) ? level : undefined,
    intent: intent && INTENTS.has(intent) ? intent : undefined,
  };
}
```

One detail that took a few commits to get right: level and intent are not topic tags. The first version rendered "beginner" and "build" next to "ai" and "graphql" in the tag row on every card, and it looked like noise. Now the card shows the content type and level above the title, the detail page shows level and intent in the meta row, and the topic tags only show subjects and technology.

## Prerequisites, outcome and paths

Taxonomies tell you what kind of page something is. They do not tell you what you need before you start or what you have when you finish. For that, guides and blog posts got two plain fields:

- prerequisites: a list of short noun phrases, like "A Contentstack stack with a delivery token"


- outcome: one sentence about what the reader has or can do afterwards



The original plan made prerequisites a reference field pointing at other entries. I went with text. Most real prerequisites are not pages on this site ("Node.js 20", "a Launch project"), and a reference field would have forced editors to create entries for things that are not content.

Then the path content type. A path has a title, URL, description, outcome, the same taxonomies, and an ordered group of steps. Each step references one guide, blog post, kickstart or live stream, plus a checkpoint: what you should have working after that step. The [Your first Contentstack site](/paths/your-first-contentstack-site) path is the beginner route, from first fetch to Live Preview running locally.

The /paths index is a regular CMS page. Its List block queries the path content type and renders the cards, sorted beginner to advanced.

## The same metadata, rendered for agents

None of this needed separate agent copy. Every blog, guide, kickstart, live stream and path has a .md version, and each one starts with frontmatter built from the taxonomies and the two fields:

```yaml
---
title: "Querying content by taxonomy"
url: "https://developers.contentstack.com/guides/querying-content-by-taxonomy"
type: "guide"
level: "intermediate"
intent: "build"
outcome: "You can filter entries by taxonomy terms through the Delivery API..."
prerequisites:
  - "A Contentstack stack with at least one taxonomy applied to a content type"
next:
  - "https://developers.contentstack.com/blog/taxonomies-are-your-query-layer"
tags:
  - "taxonomy"
  - "api"
  - "sdk"
---
```

Paths go one step further. /paths/{slug}.md lists the steps in order with their checkpoints, and /paths/{slug}/full.md concatenates the markdown of every step into one document. An agent can load everything a beginner needs in one fetch.

llms.txt is now organized the same way. It opens with the learning paths, then lists content by task: learn, build, fix, ship. Each line carries the level. An agent asked to "help me fix a broken preview" can go straight to the fix section and pick a beginner or advanced page based on the conversation.

## Taxonomies, tags, select fields or references

Contentstack gives you four ways to classify an entry. For a label like level or intent, I think three of them are the wrong default.

Tags are free text on the entry. They are fast to add and impossible to govern. One editor writes "Next.js", another "nextjs", a third "next". Nothing stops it, and nothing groups them. Fine for internal notes, bad as a query layer.

Select fields are controlled, which is better, but they belong to one content type. If guides, blog posts and kickstarts all need a level, you define the same three options three times. Add "expert" and you change three schemas. And there is no hierarchy.

Reference fields to a "category" content type are the classic headless answer. They make sense when the category has real content: a description, an image, its own landing page. For a label like "beginner" they are overhead. Each category is an entry that needs publishing, you need includeReference() to read its name, and filtering by a referenced value is more work than filtering by a field on the entry.

Taxonomies are defined once at the stack level, attached to any content type, hierarchical when you need it, and managed by editors without a schema change. Every content type uses the same query syntax, and /v3/taxonomies/entries queries all of them at once. The [taxonomy querying guide](/guides/querying-content-by-taxonomy) covers the operators. For the wider modeling question, see [modular blocks, references or global fields](/guides/modular-blocks-references-or-global-fields).

## Why intent and level beat subjects

subjects keeps growing. Every new feature adds a term, and the list on /search gets longer. That is fine for browsing, but a long list of topics is not how developers decide what to read.

Developers arrive in a mode. They want to understand something, build something, fix something that broke, or get something into production. That is intent. And they want to know if the page matches what they already know. That is level. Two questions, seven terms, one term per entry.

Small closed sets make reliable facets. Editors cannot get them wrong in creative ways. Counts stay meaningful. An agent can rely on level: beginner meaning the same thing on every page. And the combination is where it gets useful: "intermediate fix" is a short list, and probably the page you need.

## What I would do differently

I would add level and intent before writing the content, not after. Tagging every existing entry after the fact is slow, and some older multi-chapter guides honestly span two levels, so you end up making judgment calls per entry.

I would also keep the filter logic close to the data shape from day one. Our /search page counts terms in memory because a taxonomy query returns entries, not facet counts. That works for a site of this size. On a large catalog I would put a search index in front.

## Conclusion

Taxonomies are cheap to add, shared across content types, and queryable everywhere. Pick the few facets that answer "is this for me, and does it help with what I am doing?" and make them required. Everything else on the site (cards, filters, paths, frontmatter, llms.txt) can read from that one layer.



---

## Do this with AI

Install the cms-taxonomy skill from [Contentstack agent skills](https://github.com/contentstack/contentstack-agent-skills) and connect the Taxonomy Librarian profile in MCP Profile Hub. Then ask your agent:

> Audit the taxonomies in my stack and list terms with no entries, duplicate term names, and content types that still classify content with tags instead.

New to this? [Set up your AI workbench](/guides/set-up-your-ai-workbench-for-contentstack) first.




---

## Frequently asked questions

### Which four taxonomies does developers.contentstack.com use?

subjects, technology, intent (learn, build, fix, ship) and level (beginner, intermediate, advanced). They are applied to blog posts, guides, kickstarts and live streams.

### Why not use a select field for level?

A select field belongs to one content type, so the same list would be duplicated in every schema. A taxonomy is defined once at the stack level and queried the same way everywhere.

### When is a reference field the better choice?

When the category carries its own content, like a description, an image or its own landing page. A taxonomy term is a label, not an entry.

### How do agents use the taxonomies?

Every markdown version of a page starts with YAML frontmatter that includes level and intent, and llms.txt groups content by intent and by learning path.


---

## Step 6: Querying content by taxonomy

- **Source:** https://developers.contentstack.com/guides/querying-content-by-taxonomy
- **Checkpoint:** You can list entries by taxonomy term with the Delivery SDK.

- **Authors:** Tim Benniks
- **Published:** 2026-11-18T09:00:00.000Z
- **Updated:** 2026-11-15T10:56:21.262Z
- **Level:** Intermediate
- **Intent:** Build
- **Tags:** taxonomy, api, sdk

---

Most listing pages are a filter in disguise. "All beginner guides." "Everything about Next.js." "Blog posts in Europe, including the ones tagged Germany." Taxonomies let you express those filters once, in the stack, and query them from any content type with the same syntax.

This guide covers how taxonomy terms end up on entries, the query operators the Content Delivery API (CDA) supports, how to write them with the TypeScript Delivery SDK, and how developers.contentstack.com uses taxonomies to build its own filtered listings.

## What you'll learn

- How taxonomies, terms and entries relate


- How to filter entries by one term, several terms, or a combination of taxonomies


- How to query a term hierarchy with $eq_below, $below, $eq_above and $above


- How to query across content types with /taxonomies/entries


- How to write those queries with @contentstack/delivery-sdk


- When to filter in the query and when to filter in memory



## How taxonomies attach to entries

Contentstack concept: A taxonomy is a stack-level tree of terms. You create it once and attach it to any content type that needs it.

The taxonomy is not owned by a content type. If your stack has a level taxonomy with the terms beginner, intermediate and advanced, your guide, blogpost and kickstart content types can all use it. A term means the same thing everywhere, and a query for beginner works the same way on all three.

To use a taxonomy, add the Taxonomy field to a content type and pick which taxonomies editors can choose from. Editors then select terms in the entry editor. The entry stores its selection as a list of pairs:

```json
{
  "title": "Querying content by taxonomy",
  "taxonomies": [
    { "taxonomy_uid": "subjects", "term_uid": "taxonomy" },
    { "taxonomy_uid": "subjects", "term_uid": "api" },
    { "taxonomy_uid": "level", "term_uid": "intermediate" },
    { "taxonomy_uid": "intent", "term_uid": "build" }
  ]
}
```

The entry only stores UIDs. It does not store the term's position in the tree. That is why you can move a term to a different parent without rewriting every entry that uses it, and why hierarchical queries resolve the tree at query time.

If you are coming from WordPress, a taxonomy is close to a custom taxonomy with hierarchical terms. The difference is that in Contentstack you query it through the same API and query language you use for every other field.

## Filter on a single term

Every taxonomy query uses the field path taxonomies.<taxonomy_uid>. The simplest form matches entries that carry one term:

```bash
curl -G "https://cdn.contentstack.io/v3/content_types/guide/entries" \
  -H "api_key: $CONTENTSTACK_API_KEY" \
  -H "access_token: $CONTENTSTACK_DELIVERY_TOKEN" \
  --data-urlencode "environment=production" \
  --data-urlencode 'query={"taxonomies.level": "beginner"}'
```

This returns every published guide entry tagged beginner in the level taxonomy. Use your region's CDA host if your stack is not in AWS North America.

## Match any of several terms with $in

$in matches entries that carry at least one of the listed terms in a taxonomy:

```json
{ "taxonomies.subjects": { "$in": ["taxonomy", "content_modeling"] } }
```

This is the operator behind a multi-select filter where checking two subjects should widen the results, not narrow them.

## Combine taxonomies with $and and $or

$and and $or take a list of conditions. Use them to combine terms from different taxonomies:

```json
{
  "$and": [
    { "taxonomies.level": "beginner" },
    { "taxonomies.intent": "build" }
  ]
}
```

That query returns entries that are both beginner level and build intent. Swap $and for $or to get entries that match either condition.

Watch for: $in on one taxonomy is an OR between terms. $and across taxonomies is an AND between facets. A typical filter UI needs both: OR inside a facet, AND between facets.

## Find entries that use a taxonomy at all

$exists matches entries that have any term from a taxonomy:

```json
{ "taxonomies.level": { "$exists": true } }
```

Use it for listings like "everything that has a level", or to check how many entries of a content type are tagged at all.

## Query a term hierarchy

Taxonomies are trees, and four operators let you query along the tree. Take a region taxonomy where europe has the children germany and france, and germany has the child berlin.

Operator

Matches entries tagged with

Example with europe or berlin

$eq_below

The term or any term below it

europe, germany, france, berlin

$below

Only the terms below it

germany, france, berlin

$eq_above

The term or any term above it

berlin, germany, europe

$above

Only the terms above it

germany, europe

All four accept an optional levels value that limits how far the query walks:

```json
{ "taxonomies.region": { "$eq_below": "europe", "levels": 1 } }
```

With levels: 1, the query matches europe, germany and france, but not berlin. If you leave levels out, the API walks up to 10 levels, which is also the maximum depth of a taxonomy.

$eq_below is the operator you want for landing pages. A page for "Europe" should show content tagged with any European country without you listing every country in the query.

## Query across content types

The examples above query one content type. To query every content type that uses a taxonomy, call the taxonomies entries endpoint with the same query syntax:

```bash
curl -G "https://cdn.contentstack.io/v3/taxonomies/entries" \
  -H "api_key: $CONTENTSTACK_API_KEY" \
  -H "access_token: $CONTENTSTACK_DELIVERY_TOKEN" \
  --data-urlencode "environment=production" \
  --data-urlencode 'query={"taxonomies.level": {"$in": ["beginner"]}}'
```

This returns guides, blog posts and any other content type tagged beginner in one response. It is the cheapest way to build a "start here" page that mixes formats.

## Write the queries with the TypeScript Delivery SDK

The TypeScript Delivery SDK writes taxonomy filters with the same methods you use for other fields. Field paths with dots are valid, so taxonomies.level works like any field UID.

```typescript
import contentstack, {
  QueryOperation,
  TaxonomyQueryOperation,
} from "@contentstack/delivery-sdk";

const stack = contentstack.stack({
  apiKey: process.env.CONTENTSTACK_API_KEY!,
  deliveryToken: process.env.CONTENTSTACK_DELIVERY_TOKEN!,
  environment: process.env.CONTENTSTACK_ENVIRONMENT!,
});

// Single term
const beginnerGuides = await stack
  .contentType("guide")
  .entry()
  .query()
  .where("taxonomies.level", QueryOperation.EQUALS, "beginner")
  .find();

// Any of several terms ($in)
const modelingPosts = await stack
  .contentType("blogpost")
  .entry()
  .query()
  .containedIn("taxonomies.subjects", ["taxonomy", "content_modeling"])
  .find();

// Term and everything below it, two levels deep
const europe = await stack
  .contentType("article")
  .entry()
  .query()
  .where("taxonomies.region", TaxonomyQueryOperation.EQ_BELOW, "europe", { levels: 2 })
  .find();
```

The fourth argument of where() merges extra keys into the condition, which is how levels ends up next to $eq_below. exists("taxonomies.level") gives you $exists: true.

For $and and $or, build sub-queries and pass them to and() or or():

```typescript
const guides = stack.contentType("guide").entry();

const result = await guides
  .query()
  .and(
    guides.query().where("taxonomies.level", QueryOperation.EQUALS, "beginner"),
    guides.query().where("taxonomies.intent", QueryOperation.EQUALS, "build")
  )
  .find();
```

### Cross-type queries from TypeScript

stack.taxonomy() without a UID returns a TaxonomyQuery. In recent 5.x versions of the SDK, calling find() on it lists the stack's published taxonomies. It does not return entries, and it ignores conditions you added with where(). Check the behavior of the version you run. When you need entries from several content types in one call, a plain fetch against /v3/taxonomies/entries is short and predictable:

```typescript
const CDA_HOST = process.env.CONTENTSTACK_CDA_HOST ?? "https://cdn.contentstack.io";

export async function findEntriesByTaxonomy(query: Record<string, unknown>) {
  const params = new URLSearchParams({
    environment: process.env.CONTENTSTACK_ENVIRONMENT!,
    query: JSON.stringify(query),
  });

  const response = await fetch(`${CDA_HOST}/v3/taxonomies/entries?${params}`, {
    headers: {
      api_key: process.env.CONTENTSTACK_API_KEY!,
      access_token: process.env.CONTENTSTACK_DELIVERY_TOKEN!,
    },
  });

  if (!response.ok) {
    throw new Error(`Taxonomy query failed: ${response.status}`);
  }

  return (await response.json()) as { entries: Record<string, unknown>[] };
}

const { entries } = await findEntriesByTaxonomy({
  "taxonomies.level": { "$in": ["beginner"] },
});
```

## Worked example: filtered listings on this site

developers.contentstack.com tags blog posts, guides, kickstarts and live streams with four taxonomies: subjects, technology, intent and level. Those terms drive the cards on listing pages, the level and intent filters on /search, and the level and intent lines in each page's markdown frontmatter.

Listing pages are built from a List block in the CMS. Its custom_card_query group holds the content type, a set of term UIDs, a limit, a sort order and a show_filters toggle. Editors build "All beginner guides" without a deploy.

Here is a simplified version of the server-side query for one List block. It fetches only the fields a card needs and filters by terms in the query:

```typescript
import { stack } from "./config";

const CARD_FIELDS = ["title", "url", "date", "taxonomies"];

interface CardQuery {
  contentType: "guide" | "blogpost";
  taxonomyUid: string;
  terms: string[];
  limit: number;
}

export async function getCards({ contentType, taxonomyUid, terms, limit }: CardQuery) {
  const query = stack
    .contentType(contentType)
    .entry()
    .only(CARD_FIELDS)
    .query()
    .orderByDescending("date")
    .limit(limit);

  if (terms.length > 0) {
    query.containedIn(`taxonomies.${taxonomyUid}`, terms);
  }

  const result = await query.find();
  return result.entries ?? [];
}
```

Because the filter runs in the query, limit() returns the right slice. Filter after the query instead and a limit of 10 can leave you with three cards.

The /search page takes a different route on purpose. It shows a count next to every level, intent, subject and technology term, and it updates those counts as you combine filters. A taxonomy query returns matching entries, not counts per term. So the site fetches one small dataset per content type (title, URL, taxonomies and a few card fields) and filters and counts in memory:

```typescript
type Entry = { taxonomies?: { taxonomy_uid: string; term_uid: string }[] };

function termsOf(entry: Entry, taxonomyUid: string) {
  return (entry.taxonomies ?? [])
    .filter((t) => t.taxonomy_uid === taxonomyUid)
    .map((t) => t.term_uid);
}

function countTerms(entries: Entry[], taxonomyUid: string) {
  const counts = new Map<string, number>();
  for (const entry of entries) {
    for (const term of termsOf(entry, taxonomyUid)) {
      counts.set(term, (counts.get(term) ?? 0) + 1);
    }
  }
  return counts;
}
```

That trade-off works because the content set is small: a few lean requests return every entry, and the server filters and counts in memory for each search. On a large catalog, filter in the query and get counts from a search index instead.

flowchart TD  A[Need a filtered list] --> B{Need counts per term?}  B -- No --> C{One content type?}  C -- Yes --> D[content_types/uid/entries with a taxonomy query]  C -- No --> E[taxonomies/entries with a taxonomy query]  B -- Yes --> F{Small dataset?}  F -- Yes --> G[Fetch minimal fields once, filter and count in memory]  F -- No --> H[Use a search index for facets]## Where people get confused

### Term UIDs versus term names

Queries use term UIDs, not the labels editors see. If an editor renames "Beginner" to "Getting started", the UID stays beginner and your queries keep working. Hardcode UIDs, never labels.

### Filtering after the query

Filtering in application code after a limit() drops results silently. Either filter in the query or fetch enough entries to cover the filter.

### Taxonomies and references

A taxonomy term is a label, not an entry. It has no fields of its own to render, so you do not need includeReference() to read taxonomy_uid and term_uid from an entry. If you need rich content per category (a description, an image, a landing page), model that as a content type and reference it. The [modeling decision guide](/guides/modular-blocks-references-or-global-fields) covers when to pick which.

## Limits to remember

- An entry can hold up to 25 terms. A Taxonomy field can set a lower maximum per taxonomy.


- A taxonomy can hold up to 10,000 terms, nested up to 10 levels deep.


- The number of taxonomies per stack depends on your plan.


- Queries go in the URL, and the CDA has an 8 KB URL limit. A long $in list or many $or branches can hit it.



## Key takeaways

- Taxonomies live at the stack level. One query syntax works across every content type that uses them.


- Filter with taxonomies.<taxonomy_uid>: a plain value for one term, $in for any of several, $and/$or to combine taxonomies, $exists for audits.


- Use $eq_below with levels for landing pages that cover a branch of the tree.


- Use /v3/taxonomies/entries to query across content types. In recent SDK versions, call it with fetch rather than stack.taxonomy().find().


- Filter in the query when you use limit(). Count in memory or in a search index when the UI needs facet counts.



## Next steps

- Read [Taxonomies are your query layer](/blog/taxonomies-are-your-query-layer) for why this site models its learning content with four taxonomies.


- Follow the [Personalize your site](/paths/personalize-your-site) path to combine taxonomy queries with personalized listings.


- Revisit [rewriting queries for the TypeScript Delivery SDK](/guides/migrating-from-the-javascript-delivery-sdk-to-the-typescript-delivery-sdk/rewrite-queries-pagination-sorting-and-field-selection) for the rest of the query API.





---

## Do this with AI

Install the cms-taxonomy and dx-delivery-sdk skills from [Contentstack agent skills](https://github.com/contentstack/contentstack-agent-skills) and connect the Content Explorer profile in MCP Profile Hub. Then ask your agent:

> Find all blog_post entries classified under any term in the frameworks taxonomy, child terms included, and write the Delivery SDK query that returns the same list.

New to this? [Set up your AI workbench](/guides/set-up-your-ai-workbench-for-contentstack) first.




---

## Frequently asked questions

### Are taxonomies defined per content type?

No. A taxonomy lives at the stack level. You attach it to as many content types as you want, and every one of them shares the same terms.

### Which endpoint queries entries across content types by taxonomy?

GET /v3/taxonomies/entries with a query parameter. Per content type, use the normal /v3/content_types/{uid}/entries endpoint with the same query syntax.

### What does levels do in $eq_below and $below?

It limits how many levels of the hierarchy the operator walks. If you leave it out, the API walks up to 10 levels.

### Can a taxonomy query return facet counts?

No. A taxonomy query returns matching entries. If you need counts per term for a filter UI, count them yourself from the entries you fetched.


---

## Step 7: Live preview for a Next.js rebuild: what to check

- **Source:** https://developers.contentstack.com/guides/live-preview-for-a-nextjs-rebuild
- **Checkpoint:** You know which preview setup fits your Next.js rendering mode.

- **Authors:** Tim Benniks
- **Published:** 2026-12-03T09:00:00.000Z
- **Updated:** 2026-12-03T16:43:05.881Z
- **Level:** Intermediate
- **Intent:** Learn
- **Tags:** headless, visual_editing, next

---

If you're rebuilding a Next.js site and picking a headless CMS, judge its preview on how it fits the way your site renders, not on the demo. Check how draft content reaches your pages (a preview token, a preview host, Next.js Draft Mode), whether it works with App Router server components, what happens under SSR, SSG, ISR and edge middleware, whether caches are bypassed in preview, how click-to-edit tags get onto your markup, how locales and branches are handled, how much code it adds, and how it tells you when it breaks.

Below, each check is explained neutrally, then mapped to how Contentstack handles it with Live Preview, Visual Editor and @contentstack/live-preview-utils. It ends with a checklist you can run against any CMS in an afternoon.

## What you'll learn

- The questions to ask about any CMS's preview before you commit to it for a Next.js rebuild


- How Contentstack Live Preview gets drafts into App Router pages under CSR, SSR and SSG


- What click-to-edit needs in Contentstack Visual Editor, and what it costs in code


- Where preview usually breaks, and how to test for it before launch



## Check 1: How does the preview get the draft?

Every headless CMS has to answer one question: how does a request from your site get unpublished content instead of published content? Usually it's a separate token, a separate API host, or both. Find out what decides the switch. If preview and production calls are mixed in one render, you get a page that's part draft and part published, which matches neither what the editor sees nor the live site.

### How it works in Contentstack

Contentstack splits this into two APIs with the same routes and response shape. The Delivery API serves published content with a delivery token and is cacheable. The Preview API serves drafts, including unsaved changes, and needs a preview token plus a live_preview hash.

When an editor opens an entry, the CMS creates a session and loads your site in an iframe (or a new tab) with live_preview, content_type_uid, entry_uid and locale in the query string. The hash is short-lived, scoped to that session, and can rotate during long sessions. Don't store it in a database, a long-lived cookie or a module-level client.

With the Delivery SDK, you configure both sides on one stack:

```typescript
import contentstack from "@contentstack/delivery-sdk";

export const stack = contentstack.stack({
  apiKey: process.env.NEXT_PUBLIC_CONTENTSTACK_API_KEY as string,
  deliveryToken: process.env.NEXT_PUBLIC_CONTENTSTACK_DELIVERY_TOKEN as string,
  environment: process.env.NEXT_PUBLIC_CONTENTSTACK_ENVIRONMENT as string,
  live_preview: {
    enable: true,
    preview_token: process.env.NEXT_PUBLIC_CONTENTSTACK_PREVIEW_TOKEN,
    host: "rest-preview.contentstack.com",
  },
});
```

When the hash is present, requests go to the preview host. When it isn't, they go to delivery. rest-preview.contentstack.com is the North America host; other regions have their own. [How Live Preview works](/guides/the-ultimate-guide-to-contentstack-visual-building/how-live-preview-works) covers the session lifecycle in full.

## Check 2: Does it push content or ask you to refetch?

Some preview systems push changed values into the page. Others send a signal and let your code refetch. Pushing takes a different path than production, so bugs in your real data layer can stay hidden until launch.

### How it works in Contentstack

Contentstack sends a change event with no content in it. The SDK calls your callback, and your site refetches from the Preview API through its normal data layer. You write a bit more code, and in return preview runs the same fetch and render path as production.

## Check 3: Does it fit your rendering mode?

A Next.js rebuild rarely uses one rendering mode: static marketing pages, server-rendered product pages, a client-rendered account area. Ask how preview works for each, and look for code rather than a yes.

### Client-side rendering

In CSR mode you initialize the SDK with ssr: false and pass it your stack config, and it calls onEntryChange when content changes. Your callback refetches and sets state, and the page re-renders in place. The [Next.js kickstart](/kickstarts/kickstart-next) does this in a small client component, components/Preview.tsx.

onEntryChange fires on edit, save and publish. If you want updates while the editor types, onLiveEdit fires more often. See [Client-side rendering](/guides/the-ultimate-guide-to-contentstack-visual-building/client-side-rendering).

### Server-side rendering and server components

With ssr: true, the SDK still runs in the browser, but on each change it asks the CMS to reload the iframe. Your server component then reads live_preview from the request and fetches the draft. The update is a full round trip, so it's slower: the [SSR chapter](/guides/the-ultimate-guide-to-contentstack-visual-building/server-side-rendering) puts CSR preview at roughly 100 to 300 ms from change to visible and SSR at roughly 500 to 2000 ms. If speed matters more, you can run preview in CSR mode while production uses SSR.

The rule that matters most under SSR: create the client per request. A shared stack that gets the hash set on it per request can leak one editor's draft into another editor's preview, or into production traffic, under load.

```typescript
function createContentstackClient(livePreviewHash) {
  const config = {
    apiKey: process.env.API_KEY,
    deliveryToken: process.env.DELIVERY_TOKEN,
    environment: process.env.ENVIRONMENT,
  };
  if (livePreviewHash) {
    config.live_preview = {
      enable: true,
      preview_token: process.env.PREVIEW_TOKEN,
      host: "rest-preview.contentstack.com",
    };
  }
  const stack = contentstack.stack(config);
  if (livePreviewHash) {
    stack.livePreviewQuery({ live_preview: livePreviewHash });
  }
  return stack;
}
```

### Static generation, ISR and Draft Mode

Static files can't show drafts, whatever the CMS. The question is whether the CMS works with your framework's escape hatch. In the App Router that's Draft Mode: an API route checks a secret, calls draftMode().enable() and redirects, and the page branches on draftMode().isEnabled to fetch from the Preview API instead of the built data. Under ISR in the Pages Router, the same idea applies: turn revalidate off while previewing so drafts aren't frozen in a cache.

With any CMS, avoid patching static HTML with drafts after hydration: it causes hydration mismatches and flicker. [Static site generation](/guides/the-ultimate-guide-to-contentstack-visual-building/static-site-generation) shows the Next.js setup for both routers.

### Middleware and edge

If requests pass through middleware, redirects or a BFF, check that they keep query parameters. A common bug is a first page that shows the draft and a second that shows published content because a redirect dropped live_preview. Carry live_preview, content_type_uid, entry_uid and locale through navigation. [Middleware and complex architectures](/guides/the-ultimate-guide-to-contentstack-visual-building/middleware-and-database-backed-architectures) covers proxies and BFFs.

## Check 4: Are caches bypassed in preview?

Next.js caches at several layers, and so does your CDN. Ask how preview requests avoid all of them.

### How it works in Contentstack

Preview responses are session-scoped and change as the editor types, so they must never be cached. Send Cache-Control: no-store on any request that carries live_preview, and bypass framework and CDN caches for it. Never cache preview responses keyed by URL: two requests to the same URL with different hashes return different content.

## Check 5: How does click-to-edit get onto your markup?

Visual editing lets an editor click a heading on the page and land in the right field. Ask whether you write those paths by hand or a helper generates them, how they handle nested blocks and references, and whether they survive GraphQL.

### How it works in Contentstack

Contentstack uses data-cslp attributes in the form content_type_uid.entry_uid.locale.field_path. You don't write them by hand. Call addEditableTags once in your data layer after fetching, and every component spreads from entry.$:

```typescript
const entry = result.entries?.[0];
if (entry) contentstack.Utils.addEditableTags(entry, "page", true, locale);
```

```typescript
<h1 {...page.$?.title}>{page?.title}</h1>
```

It generates indexed keys for modular blocks (blocks__0) and tags on nested arrays. Referenced entries need their own call with their own content type. GraphQL responses need system { uid content_type_uid } and a reshape to the REST shape before tagging.

Visual Editor sits on top of Live Preview and these tags. Set mode: "builder" in ContentstackLivePreview.init() (it needs Live Preview Utils v3.0+ and Delivery SDK v3.20.3+). Tag the wrapper of each block to let editors add, delete and reorder blocks in place, use data-add-direction to control the add button, and add VB_EmptyBlockParentClass to an empty modular blocks container so editors can drop the first block in. The kickstart calls it Visual Builder. [Edit tags and Visual Editor](/guides/the-ultimate-guide-to-contentstack-visual-building/edit-tags-and-visual-editor) covers field paths and granularity.

## Check 6: Locales and branches

With several locales or content branches, preview has to know which one it's showing.

### How it works in Contentstack

The CMS passes locale in the preview URL, and each environment needs a base URL for every locale you preview. addEditableTags defaults the locale to en-us, so pass the locale of the entry you render, every time. For branches, pass branch in stackDetails when you preview anything other than main. The hash is tied to one stack and branch, so a hash that reaches a request for another branch is rejected.

## Check 7: How much code, and does it leak into production?

Count the files you'd add, and check what ships to production.

### How it works in Contentstack

The Next.js kickstart wires everything through four files: lib/contentstack.ts for the SDK and Live Preview setup, components/Preview.tsx for the refetch loop, components/Page.tsx for rendering with edit tags, and app/page.tsx to choose between preview and production. SSR and Draft Mode add a per-request client and a draft route.

Importing @contentstack/live-preview-utils is enough to put the edit button element in the page. To keep preview out of production, build with PURGE_PREVIEW_SDK=true (SDK 4.4.0 or later) or import the SDK dynamically, set editButton.exclude: ["outsideLivePreviewPortal"], and set cleanCslpOnProduction: true to strip data-cslp outside preview.

## Check 8: How does it break, and how do you find out?

Every preview setup breaks at some point: a new route, a CDN rule, an SSO gate on staging. Ask what diagnostics exist and whether failure modes are documented.

### How it works in Contentstack

Turn on Settings > Live Preview > Display Setup Status. It reports "SDK not initialized", "outdated SDK", "Preview Service not enabled" and connection problems in real time. Common failures are a site that refuses to be framed (X-Frame-Options or CSP frame-ancestors), an SSO gate that won't render in an iframe (use Always Open in New Tab, SDK v4.0.0 or later), a dropped hash, a cache, or a wrong locale in edit tags. error_code 382 on public traffic means a preview hash leaked out of its session.

Preview also resolves draft references as well as published ones, so a deep include_all can hit the reference limit (error_code 141) in preview before it does on delivery. [Live Preview not working? A symptom index](/guides/live-preview-not-working-a-symptom-index) maps each symptom to its fix, and [Contentstack limits on one page](/guides/contentstack-limits-on-one-page) lists the reference depth limits.

## Evaluate it in an afternoon

Run this against every CMS on your shortlist, using a page that looks like your real site, not the vendor's demo:

- Get a test account and seed one page type with a modular blocks field, a reference and two locales.


- Render it in a server component and confirm the first request in preview shows the draft without a flash of published content.


- Edit a field and time how long the change takes to appear. Do it for SSR and for a client-rendered route.


- Put the page behind Draft Mode as a static route and confirm drafts still show.


- Click a link inside the preview and confirm the second page still shows draft content.


- Deploy behind your real CDN and auth, then repeat steps 2 to 5.


- Open two editors on two entries at once and confirm neither sees the other's draft.


- Click a heading, a block inside a list and a referenced entry. Each should open the right field in the right locale.


- Build for production and check that no preview script, edit button or editing attributes reach the HTML.


- Break something on purpose, such as a missing token or a cached route, and see how quickly the tooling tells you.



## Next steps

- Start from working code with the [Next.js kickstart](/kickstarts/kickstart-next).


- Read [The Ultimate Guide to Contentstack Visual Editor](/guides/the-ultimate-guide-to-contentstack-visual-building) for the full model, starting with [How Live Preview works](/guides/the-ultimate-guide-to-contentstack-visual-building/how-live-preview-works).


- Pick your rendering chapter: [Server-side rendering](/guides/the-ultimate-guide-to-contentstack-visual-building/server-side-rendering) or [Static site generation](/guides/the-ultimate-guide-to-contentstack-visual-building/static-site-generation).


- Keep the [symptom index](/guides/live-preview-not-working-a-symptom-index) open while you test.





---

## Do this with AI

Install the cms-live-preview-visual-editor-support-assistant skill from [Contentstack agent skills](https://github.com/contentstack/contentstack-agent-skills). Then ask your agent:

> We're rebuilding on the Next.js App Router with SSR for most routes and static pages for marketing. Review our data layer and layout, tell us where Live Preview should initialize, where the per-request client goes and which routes need Draft Mode.

New to this? [Set up your AI workbench](/guides/set-up-your-ai-workbench-for-contentstack) first.




---

## Frequently asked questions

### What should I check in a headless CMS's live preview before a Next.js rebuild?

Check how drafts reach your pages (preview token, preview host, Draft Mode), whether preview works with App Router server components and your rendering mode, whether caches are bypassed in preview, how click-to-edit tags are generated, how locales and branches are handled, how much code it adds and how it fails.

### Does Contentstack Live Preview work with server-side rendering in Next.js?

Yes. With ssr: true the Live Preview SDK asks the CMS to reload the iframe on each change, and your server fetches draft content from the Preview API using the live_preview hash on that request. Create the Contentstack client per request so hashes never leak between editors.

### How does Contentstack preview work on a statically generated Next.js site?

Static files can't show drafts. Use Next.js Draft Mode so preview requests bypass the static output and render dynamically, fetching from the Preview API. Don't patch static HTML with drafts on the client, which causes hydration mismatches and flicker.

### What do I need for click-to-edit in Contentstack Visual Editor?

Initialize the Live Preview SDK with mode set to builder, call addEditableTags on entries in your data layer, and spread the generated data-cslp attributes from entry.$ onto your elements. Visual Editor needs Live Preview Utils v3.0+ and Delivery SDK v3.20.3+.

### Should preview responses be cached?

No. Preview data is scoped to one editing session and changes as the editor types. Send Cache-Control: no-store on any request that carries the live_preview hash and bypass CDN, framework and application caches for it.


---

## Step 8: Revalidate, prime or redeploy? Cache levers on Launch

- **Source:** https://developers.contentstack.com/blog/revalidate-prime-or-redeploy-picking-the-right-cache-lever-on-launch
- **Checkpoint:** You can pick revalidate, prime or redeploy for a content change.

- **Authors:** Tim Benniks
- **Published:** 2026-12-01T09:00:00.000Z
- **Updated:** 2026-12-03T16:42:32.318Z
- **Level:** Intermediate
- **Intent:** Learn
- **Tags:** headless, api

---

When content on a Launch site looks stale, most teams redeploy. It always works, so it becomes the habit. But a redeploy is the most expensive of the three cache levers Launch gives you, and for most content changes it's the wrong one.

The three levers are revalidating the CDN, priming the cache, and redeploying. They solve different problems. Once you see which problem each one solves, the choice is usually obvious.

## The short version

Lever

What it does

What it costs

Use it when

Redeploy

Builds the site and purges the whole environment's CDN cache

A full build, every time

Code changed, or your pages are pre-rendered at build time

Revalidate

Purges cached responses by path, cache tag or hostname

One API call against a daily quota

Content changed on a server-rendered site

Prime

Requests a list of paths as part of a deployment so they're cached before visitors arrive

Origin load for those paths on each deployment

Your most visited pages are slow on a cold cache

Priming is not an alternative to the other two. It is the step that makes a redeploy less painful.

## What a redeploy really does

A deployment on Launch builds your project and, when it goes live, purges the CDN cache for that environment. Every page is a cache miss until someone requests it again.

That is why a redeploy fixes every staleness problem. It also means you pay for a full build and a cold cache for a one-word typo fix in a blog post. On a small site with a fast build that's fine. On a site with thousands of pages and a ten-minute build, an editor who publishes twenty times a day turns your build pipeline into a queue. Launch helps a bit here: when several deployments are triggered for one environment, it skips the queued ones in between. You still wait for the latest.

You can trigger a redeploy from a deploy hook, from the CLI with csdx launch --redeploy-latest, or from the Launch API. If you drive this from a pipeline, [Deploy from CI with the Launch CLI, REST API and deploy hooks](/guides/deploy-from-ci-with-the-launch-cli-and-api) shows the whole setup.

## What revalidation really does

Revalidation drops cached entries without building anything. You call the Revalidate CDN Cache endpoint on the Launch API with exactly one of three inputs:

```json
{ "cachePath": { "path": "/blog/my-post", "isPrefix": false } }
```

```json
{ "cacheTags": ["prod-blog"] }
```

```json
{ "hostnames": ["www.example.com"] }
```

The next request for a purged page goes to your origin and gets cached again. Nothing else on the site is touched.

This only makes sense when your origin can render fresh content on request. For a server-rendered page with Cache-Control: public, max-age=0, s-maxage=86400, revalidation is ideal: the CDN holds the page for a day, and you purge it the moment an editor publishes. For a page that was pre-rendered at build time, purging the CDN just fetches the same stale HTML again. That page needs a build.

Two practical notes. Revalidation has a daily quota per organization, which you can check with GET /usage-analytics/revalidate-cdn-cache. And cache tags are the way to stay well under it, because one tag purge can clear hundreds of URLs. I prefix every tag with the environment, like prod-blog and staging-blog, so a purge meant for staging can't touch production pages that share a tag name.

You can wire revalidation to publishing with the Launch connector in Automations, or with a small webhook route in your app. Both are covered step by step in [Caching, revalidation and cache priming](/guides/launch-edge-functions-redirects-and-caching/caching-revalidation-and-cache-priming).

## What priming really does

Cache priming takes a list of paths from launch.json and requests them as part of each deployment:

```json
{
  "cache": {
    "cachePriming": {
      "urls": ["/", "/pricing", "/docs", "/blog"]
    }
  }
}
```

You also switch on Enable Cache Priming in the environment's cache settings. After that, your homepage and top landing pages are already in the CDN when the first visitor arrives after a release.

The limits are what make it a supporting act. Paths must be relative and listed one by one; wildcards and regex aren't supported. Routes that send no-store or no-cache are requested but never cached, so priming them does nothing. And it only runs on a deployment, so it doesn't help after a revalidation. If your list comes from content, generate launch.json at build time instead of maintaining it by hand.

## A decision flow

This is the order I go through when something on a Launch site needs to change:

flowchart TD  A[Something changed] --> B{Code or config?}  B -->|Yes| R[Redeploy]  B -->|No, content| C{Is the page pre-rendered at build time?}  C -->|Yes| R  C -->|No, server-rendered with s-maxage| D{How many pages are affected?}  D -->|One or a few known URLs| P[Revalidate by path]  D -->|A section or everything using a component| T[Revalidate by cache tag]  D -->|One of several domains| H[Revalidate by hostname]  R --> E{Are top pages slow on a cold cache?}  E -->|Yes| F[Add them to cache priming]  E -->|No| G[Done]Code changes always need a deployment. Content changes need a deployment only if the content is baked into the build. Everything else is a question of how wide the purge should be.

## How we do it on this site

developers.contentstack.com runs on Launch, and it takes the redeploy route on purpose. Content pages are pre-rendered at build time with generateStaticParams, and a publish triggers a rebuild. Pages are served from the CDN as static HTML, and the origin almost never does any rendering work during a visit.

That choice works because the build is fast enough to run on every publish. A news site or a large commerce catalog would make the opposite choice: render on the server with a long s-maxage, tag responses by content type, and revalidate on publish. Pick the lever whose cost matches how often the change happens. Rare publishes can afford a build. Frequent publishes can't.

## Mistakes I keep seeing

Redeploying on every publish for a large site. The webhook goes straight to a deploy hook, editors publish in bursts, and the queue never empties. Switch those pages to server rendering with s-maxage and revalidate instead.

Revalidating pre-rendered pages. The purge works, the CDN fetches the page again, and it's the same old HTML. If the content is in the build output, only a build updates it.

Priming routes that can't be cached. Check the Cache-Control of every path on your priming list. A no-store page on that list costs origin requests and gives nothing back.

Cacheable pages that read cookies. The Launch CDN caches by URL, not by cookie. If a page renders differently per visitor, send no-store or move the personal part to a client-side call. For A/B tests, rewrite each variant to its own URL in an edge function, as shown in [Edge functions in practice](/guides/launch-edge-functions-redirects-and-caching/edge-functions-in-practice).

A broken automation eating the quota. A flow that fires the same purge in a loop, or sends a tag that never resolves, still counts every call. Check your revalidation usage after you set up a new automation.

## Concluding

Redeploy when code changes or when content lives in the build. Revalidate when content changes on a server-rendered page, and prefer tags over long lists of paths. Prime the handful of pages that matter most, so a deploy doesn't hand your first visitors a cold cache.

Start by checking two things on your own site: whether your content pages are pre-rendered or server-rendered, and what Cache-Control they send. Those two answers decide which lever you need.



---

## Do this with AI

Install the launch-platform skill from [Contentstack agent skills](https://github.com/contentstack/contentstack-agent-skills) and connect the Launch Deploy Helper profile in MCP Profile Hub. Then ask your agent:

> Look at last week's deployments on my Launch project and tell me which redeploys only shipped content changes and could have been a cache revalidation instead.

New to this? [Set up your AI workbench](/guides/set-up-your-ai-workbench-for-contentstack) first.




---

## Frequently asked questions

### Does redeploying on Launch clear the CDN cache?

Yes. Every deployment purges the CDN cache for that environment, which is why a redeploy always shows fresh content.

### Is cache priming a replacement for revalidation?

No. Priming warms a fixed list of paths as part of a deployment. It doesn't react to content changes, so you still need revalidation or a redeploy for those.

### When should I revalidate instead of redeploying?

When the change is content, not code, and your pages are server-rendered with an s-maxage. Revalidation purges only what changed, without a build.

### Can I prime the cache without deploying?

Not with the built-in feature. Cache priming runs as part of a deployment, for the paths you list in launch.json.


---

## Step 9: Webhooks: allowlisting, signatures and disabled endpoints

- **Source:** https://developers.contentstack.com/guides/webhooks-allowlisting-signatures-and-disabled-endpoints
- **Checkpoint:** Your webhook endpoint checks signatures and stays enabled.

- **Authors:** Tim Benniks
- **Published:** 2026-12-14T09:00:00.000Z
- **Updated:** 2026-11-15T10:56:28.756Z
- **Level:** Intermediate
- **Intent:** Fix
- **Tags:** api, security, automation

---

Webhooks are the part of a Contentstack setup you forget about until they stop. A search index stops updating, a static site stops rebuilding, and then an email arrives with the subject "webhook disabled due to unhealthy notification endpoint". Most of the time the cause is on the receiving side: a firewall that drops the request, a handler that takes longer than 30 seconds, or a signature check that compares the wrong bytes.

This guide covers getting webhooks through a firewall, verifying the signature in TypeScript, recovering a webhook the circuit breaker disabled, and the payload and timing details that surprise people. It applies to any receiver: a serverless function, a CI trigger, a Launch edge function or your own service.

## What you'll learn

- How to allow Contentstack webhooks through a firewall


- How the retry policy and the circuit breaker decide a webhook is unhealthy


- How to re-enable a disabled webhook and replay the events it missed


- How to verify the default RSA signature and the HMAC signature in TypeScript


- Which payload details trip receivers, and why events can arrive late or twice



## Symptoms

What you see

Usually means

Email: "[stack_name] - [webhook_title] webhook disabled due to unhealthy notification endpoint"

10 failed deliveries in a row. The webhook is off

Webhook status Unhealthy in Settings > Webhooks

Same. Nothing is delivered until you re-enable it

Call status HTTP null in the webhook log

The request never connected: DNS, firewall or TLS

401 in the webhook log

Your receiver rejected the credentials Contentstack sent

Requests time out in the log, but your handler finishes eventually

Your endpoint took more than 30 seconds to respond

crypto.verify() returns false for every request

The bytes or the parameters you verify with don't match what was signed

The same event arrives more than once

A retry after a timeout or non-2xx response

An event arrives minutes after the publish

It's in the retry schedule, or it's one of many items in a bulk job or release

data.entry has fewer fields than expected

Send Concise Payload is on

environment is a UID where you expected production

publish_details stores environment UIDs

## Why it happens

Contentstack concept: A webhook delivery is a POST with a JSON body. Any 2xx response is a success. A 4xx or 5xx, or no response within 30 seconds, is a failure. A failed delivery is retried four more times, after about 5, 25, 125 and 625 seconds, and then marked as failed.

Separately, Contentstack counts consecutive failed deliveries for the webhook as a whole. Failures caused by a 5xx, a 401, a timeout, an aborted connection or a domain that doesn't resolve all count. After 10 in a row with no success in between, the circuit breaker trips: the webhook is marked Unhealthy, disabled, and one email goes to the addresses under Email Addresses to Notify.

So an endpoint that is down for a deploy, a firewall rule that drops traffic, or a handler that rebuilds a site before it responds can each switch a webhook off. And while it's off, events are not queued for later.

## Fix it

### Allow Contentstack through your firewall

Contentstack doesn't publish the webhook source IP addresses. Ask [Contentstack support](mailto:support@contentstack.com) for the addresses that apply to your region and allow them on the receiving endpoint.

Treat the IP list as a network filter, not as authentication. Verify the signature too (next section), and add an authentication method on the webhook: Basic Auth is available by default, and Bearer Token and OAuth 2.0 Client Credential can be enabled for your organization through support. Custom headers are a useful extra signal, but the docs are clear that they don't replace signature verification.

For local development, don't open your firewall. Expose your dev server through a tunnel such as ngrok or smee and point a test webhook at it.

### Respond within 30 seconds

The most common cause of an unhealthy webhook I see is a receiver that does the work before it answers: rebuild the site, reindex the entry, call three other APIs, then return 200. That works until one run takes 31 seconds.

Verify the request, put the job on a queue, and respond:

```typescript
import express from "express";
import { isFromContentstack } from "./verify-contentstack"; // see the next section

const app = express();
const rawJson = express.raw({ type: "application/json" }); // keep the exact bytes for verification

app.post("/webhooks/contentstack", rawJson, async (req, res) => {
  if (!(await isFromContentstack(req))) return res.status(401).send("invalid signature");

  const event = JSON.parse(req.body.toString("utf8"));
  await queue.add("contentstack-event", event); // do the slow work elsewhere
  res.sendStatus(202);
});
```

Return 401 only for requests that fail verification, never because a downstream service is unavailable. Every 401 and 5xx counts toward the circuit breaker.

### Verify the signature

Contentstack signs every webhook. The method is set per webhook in Request Signing Method.

Default (Contentstack Certificate). The signature is in the X-Contentstack-Request-Signature header, prefixed with v1=. It's an RSA-PSS signature over the payload with SHA-256 and a salt length of 32. The public key is served from your region's app host, for example https://app.contentstack.com/.well-known/public-keys.json for AWS North America. Use the host you log in to.

```typescript
// verify-contentstack.ts
import crypto from "node:crypto";
import type { Request } from "express";

const KEY_URL =
  process.env.CONTENTSTACK_PUBLIC_KEY_URL ??
  "https://app.contentstack.com/.well-known/public-keys.json";

let publicKey: crypto.KeyObject | undefined;

async function getPublicKey(): Promise<crypto.KeyObject> {
  if (publicKey) return publicKey;
  const res = await fetch(KEY_URL);
  const json = (await res.json()) as { "signing-key": string };
  // PEM in PKCS#1 format: -----BEGIN RSA PUBLIC KEY-----
  publicKey = crypto.createPublicKey({ key: json["signing-key"], format: "pem", type: "pkcs1" });
  return publicKey;
}

export async function isFromContentstack(req: Request): Promise<boolean> {
  const header = req.get("X-Contentstack-Request-Signature");
  if (!header || !Buffer.isBuffer(req.body)) return false;

  const signatures = header
    .split(",")
    .map((part) => part.trim())
    .filter((part) => part.startsWith("v1="))
    .map((part) => Buffer.from(part.slice(3), "base64"));

  const key = await getPublicKey();
  return signatures.some((signature) =>
    crypto.verify(
      "sha256",
      req.body, // the raw bytes, exactly as received
      { key, padding: crypto.constants.RSA_PKCS1_PSS_PADDING, saltLength: 32 },
      signature,
    ),
  );
}
```

The route above mounts express.raw() for exactly this reason: nothing reformats the JSON before you check it.

When verification fails for every request, it's almost always one of these:

- The body was re-serialized. A JSON body parser followed by JSON.stringify(req.body) can produce different bytes from what was signed, depending on your framework. Verify the raw body.


- Wrong padding or salt length. It's RSA-PSS, not PKCS#1 v1.5 (SHA256withRSA). Leave the salt length at 32. Older samples with other salt values fail.


- Wrong key format. The key is PKCS#1 (BEGIN RSA PUBLIC KEY). Load it with type: "pkcs1".


- Wrong region. Fetch the key from the app host of the region your stack lives in.



HMAC signature. If your organization enabled HMAC signing under Administration > Security Configuration > HMAC Signing and the webhook uses it, the signature is in x-contentstack-hmac-signature as t=<timestamp>,v1=<signature>. It's an HMAC-SHA256 over ${t}.${rawBody} with your organization's secret. During a key rotation the header carries two v1 values, and a match on either one is valid. In the same verify-contentstack.ts:

```typescript
export function isValidHmac(header: string | undefined, rawBody: string, secret: string): boolean {
  if (!header) return false;
  let timestamp = "";
  const signatures: string[] = [];
  for (const part of header.split(",")) {
    const [key, value] = part.trim().split("=");
    if (key === "t") timestamp = value;
    if (key === "v1") signatures.push(value);
  }
  if (!timestamp || signatures.length === 0) return false;

  const expected = crypto.createHmac("sha256", secret).update(`${timestamp}.${rawBody}`).digest("hex");
  return signatures.some(
    (sig) => sig.length === expected.length &&
      crypto.timingSafeEqual(Buffer.from(sig, "hex"), Buffer.from(expected, "hex")),
  );
}
```

Replay protection. Reject requests that are too old. For the default signature, compare triggered_at in the body with your clock. For HMAC, use t. Keep the tolerance generous enough for the retry schedule if you want retried events to be accepted, or accept them through idempotency instead.

### Re-enable a disabled webhook

Fix the cause first. If the endpoint still fails, it collects 10 more failures and gets disabled again.

- Open Settings > Webhooks, select the webhook and go to the Log tab. Read the status codes and response bodies of the failed executions. Logs go back 30 days.


- Fix what the log shows: a 5xx or timeout in your service, expired credentials behind a 401, or a URL that doesn't resolve.


- In the webhook list, open the actions menu and select Enable, or turn on Enable Webhook on the webhook page, and save. That resets the failure count.


- Replay the events that failed. Re-enabling doesn't deliver them, and retry doesn't work while the webhook is disabled, so do this after step 3.



To replay from a script, list the failed executions and retry each one:

```bash
curl -G "https://api.contentstack.io/v3/webhooks/$WEBHOOK_UID/executions" \
  -H "api_key: $CS_API_KEY" \
  -H "authorization: $CS_MANAGEMENT_TOKEN" \
  --data-urlencode "from=2026-12-01T00:00:00.000Z" \
  --data-urlencode 'query={"status":{"$gte":"400","$lte":"599"}}'

curl -X POST "https://api.contentstack.io/v3/webhooks/$EXECUTION_UID/retry" \
  -H "api_key: $CS_API_KEY" \
  -H "authorization: $CS_MANAGEMENT_TOKEN"
```

The executions call returns up to 100 records per request, and each record's uid is the execution UID you retry. Use your region's API host if your stack isn't in AWS North America. A successful retry returns { "notice": "Webhook retry scheduled" }.

If the outage was long, retrying events one by one may be the wrong tool. For a search index or a static site, a full reindex or rebuild after you re-enable the webhook is often faster and more reliable.

### Handle the payload you actually get

The body always has module, event, api_key, data and triggered_at. The rest depends on the event and the webhook settings.

- Concise payload. With Send Concise Payload on, data carries identifiers and key metadata instead of the full entry. If your receiver needs field values, fetch the entry from the Delivery API, or turn concise payloads off.


- Publish events. A publish payload includes data.environment (with name and uid), data.locale, data.action and data.status. The entry's publish_details is an array, and its environment is a UID. Use data.environment.name when you need the name.


- Releases. Items published through a release carry a source object with type: "release" and the release title and uid. One release deploy produces one event per item, environment and locale.


- Staged events. publish.start, publish.success and publish.fail (and their unpublish equivalents) are separate events. Subscribe to publish.success if you only want to act on content that went live.


- Payload in the log. See Details in the webhook log shows the exact request that was sent, which is the fastest way to answer "is this field in the payload or not".



### Expect delays and duplicates

Webhooks fire when the publish job processes an item, not when the editor clicks publish. A bulk publish or a release deploy sends its events as the items complete, so a large job spreads its events over time. A failed delivery can arrive up to about 13 minutes late after the four retries. And a delivery that timed out on your side may have been processed by your code anyway, then retried.

Make the receiver idempotent. A key built from api_key, module, event, the entry or asset uid, its _version, the locale and the environment UID identifies a delivery well enough to drop repeats. For site rebuilds, debounce: collect events for a few seconds and trigger one build, so a 200-item release doesn't start 200 builds.

## Check that it worked

- The webhook status is back to active in Settings > Webhooks, and the next publish shows 200 in the Log tab.


- Your receiver logs one verified request per event. Temporarily flip one byte of a stored payload and run it through isFromContentstack to confirm the check really rejects tampered data.


- The executions endpoint with the failure query returns no new records after your fix.


- Response times in the log are well under 30 seconds, ideally under one.



## Prevent it

- Respond with 2xx as soon as the request is verified, and process asynchronously.


- Fill in Email Addresses to Notify with a shared inbox or an alerting address, not one person.


- Don't let deploys of the receiver take it offline for minutes. Ten failures in a row is not many during a release that publishes a lot of content.


- Verify signatures on the raw body, cache the public key, and refetch it if verification starts failing for every request.


- Scope webhooks with the narrowest channels and environments you need. Fewer events mean fewer chances to trip the breaker.


- If missing an event is unacceptable, reconcile on a schedule with the [Sync API](https://www.contentstack.com/docs/developers/apis/content-delivery-api#synchronization) or a periodic reindex instead of trusting delivery alone.



## Key takeaways

- A delivery succeeds on 2xx within 30 seconds. Anything else is retried four times, after about 5, 25, 125 and 625 seconds.


- Ten consecutive failures from 5xx, 401, timeouts or unreachable URLs disable the webhook and mark it Unhealthy.


- Re-enable first, then retry the failed executions. Missed events are not delivered automatically.


- Webhook IP addresses come from Contentstack support. Verify X-Contentstack-Request-Signature with RSA-PSS, SHA-256 and salt length 32, on the raw body.


- Expect duplicates and bursts. Make receivers idempotent and debounce rebuilds.



## Next steps

- If a webhook triggers a rebuild and the site still shows old content, read [Published, but my site still shows old content](/guides/published-but-my-site-still-shows-old-content).


- To understand why a release produces a burst of events, read [Releases, bulk publish and nested reference publishing, explained](/blog/releases-bulk-publish-and-nested-reference-publishing-explained).


- For the delivery and webhook limits in one place, see [Contentstack limits on one page](/guides/contentstack-limits-on-one-page).





---

## Do this with AI

Install the cms-webhooks skill from [Contentstack agent skills](https://github.com/contentstack/contentstack-agent-skills). Then ask your agent:

> Our production webhook was disabled as unhealthy. Read its execution log for the last 7 days, group the failures by status code and error, tell me what our receiver did wrong, and list the execution UIDs I should retry once it's fixed. Don't re-enable or retry anything yet.

New to this? [Set up your AI workbench](/guides/set-up-your-ai-workbench-for-contentstack) first.




---

## Frequently asked questions

### Does Contentstack publish the IP addresses webhooks come from?

No. Ask Contentstack support for the addresses for your region, and verify the request signature as well, because an IP list alone doesn't prove the payload is intact.

### When does Contentstack disable a webhook?

After 10 consecutive failed deliveries caused by 5xx responses, 401 responses, timeouts, aborted connections or a domain that doesn't resolve. A single 2xx resets the count.

### Which signature algorithm does the default webhook signature use?

RSA-PSS with SHA-256 and a salt length of 32. The public key comes from /.well-known/public-keys.json on your region's app host.

### Do events that fired while a webhook was disabled get delivered after I re-enable it?

No. Re-enable the webhook first, then retry the failed executions from the webhook log or with the retry API.

### How long does Contentstack wait for my endpoint to respond?

30 seconds. After that the delivery counts as a failure and goes into the retry schedule.


---

## Step 10: Releases, bulk publish and nested publishing explained

- **Source:** https://developers.contentstack.com/blog/releases-bulk-publish-and-nested-reference-publishing-explained
- **Checkpoint:** You can publish an entry and its references together with a release.

- **Authors:** Tim Benniks
- **Published:** 2026-11-29T09:00:00.000Z
- **Updated:** 2026-12-03T16:42:34.090Z
- **Level:** Intermediate
- **Intent:** Learn
- **Tags:** api, automation

---

Contentstack has three ways to get a lot of content live at once, and they solve different problems. A release controls when a reviewed set of versions goes live, bulk publish pushes a large number of entries out right now, and nested reference publishing makes sure a page goes live together with the content it points to. Pick the wrong one and you get a launch page with a missing hero, or a script that hits rate limits halfway through.

## The short version

If you only read one section, read this one.

- Use a release when a fixed set of entry and asset versions has to go live together, usually at a scheduled moment.


- Use bulk publish when you need to push many entries to environments now, from a script, the CLI, or the UI.


- Use nested reference publishing when you publish a page and want everything it references to go with it, up to five levels deep.



The rest of this post is the detail behind those three lines, with the calls to make each one happen.

## Releases are about timing

A release is a named bundle of entries and assets. Each item in a release carries an entry or asset UID, a locale, a version, and an action (publish or unpublish). You deploy the release to one or more environments, immediately or at a scheduled time.

The version is the important part. When you add an entry to a release, you add a specific version of it. If an editor saves a newer version afterwards, the release still deploys the version you added until someone updates the item. That is exactly what you want for a launch: the content that was reviewed is the content that ships.

Releases are branch-specific. A release on main deploys items from main, and you cannot mix branches in one release.

Here is the full flow with the JavaScript Management SDK: create a release, add items, deploy it.

```javascript
import * as contentstack from '@contentstack/management';

const stack = contentstack
  .client()
  .stack({
    api_key: process.env.CS_API_KEY,
    management_token: process.env.CS_MANAGEMENT_TOKEN,
  });

const release = await stack.release().create({
  release: { name: 'Spring launch', description: 'Product page and hero' },
});

await stack.release(release.uid).item().create({
  items: [
    { uid: 'blt_product', version: 4, locale: 'en-us', content_type_uid: 'product', action: 'publish' },
    { uid: 'blt_hero', version: 2, locale: 'en-us', content_type_uid: 'hero', action: 'publish' },
  ],
});

await stack.release(release.uid).deploy({
  environments: ['production'],
  locales: ['en-us'],
  action: 'publish',
  scheduledAt: '2026-12-01T09:00:00.000Z',
});
```

Leave out scheduledAt to deploy right away. When you add items in bulk, the API accepts at most 25 items per request, so chunk the array for bigger launches.

## Bulk publish is about volume

Bulk publish takes a list of entries and assets and publishes them to environments and locales in one request. There is no bundle to manage and no version pinning beyond what you put in the request. It is the right tool for "publish everything in this content type to staging" or "republish these 400 entries after a model change."

The endpoint is POST /v3/bulk/publish:

```bash
curl -X POST "https://api.contentstack.io/v3/bulk/publish" \
  -H "api_key: $CS_API_KEY" \
  -H "authorization: $CS_MANAGEMENT_TOKEN" \
  -H "api_version: 3.2" \
  -H "Content-Type: application/json" \
  -d '{
    "entries": [
      { "uid": "blt_post_1", "content_type": "blog_post", "version": 3, "locale": "en-us" },
      { "uid": "blt_post_2", "content_type": "blog_post", "version": 7, "locale": "en-us" }
    ],
    "locales": ["en-us"],
    "environments": ["production"]
  }'
```

The response returns a job_id. Bulk publish is asynchronous, so a successful response means the job was accepted, not that the content is live. Check the job with GET /v3/bulk/jobs/{job_id} and its items with GET /v3/bulk/jobs/{job_id}/items, both with the api_version: 3.2 header.

Two query parameters matter if you use workflows. skip_workflow_stage_check=true publishes the entries that are at a stage that satisfies your publish rules. approvals=true publishes the entries that don't need an approval.

The limits are tight on purpose. The API reference lists 10 entries in 10 locales and 10 environments per request, and bulk actions are limited to one request per second instead of the usual ten. For anything bigger, you need a loop with batching and backoff, which is where the CLI comes in.

### The CLI does the batching for you

In CLI 2.x, bulk publishing lives in the bulk operations plugin and ships with the CLI. The old cm:entries:publish command is gone. Its replacement is cm:stacks:bulk-entries:

```bash
csdx cm:stacks:bulk-entries \
  --operation publish \
  --content-types blog_post \
  --environments production \
  --locales en-us \
  --filter modified \
  --branch main \
  -a my-token-alias
```

A few flags do most of the work:

- --filter picks entries by status: draft, modified, unpublished, or non-localized.


- --publish-mode bulk (the default) uses the Bulk Publish API. single makes one call per entry.


- --source-env with --source-alias cross-publishes whatever is live in one environment to another.


- --include-variants adds entry variants to the run.



Every run writes success and failure logs to a bulk-operation folder. --retry-failed ./bulk-operation republishes only the failures, and --revert ./bulk-operation undoes a run from its success log. That revert alone is a good reason to use the CLI over a hand-rolled script. Assets have their own command, cm:stacks:bulk-assets, with similar publish flags.

## Nested reference publishing is about dependencies

Publishing a page entry does not publish the entries it references. If your page references a new hero, which references a new CTA, publishing the page gives you a page that points at content the environment doesn't have yet. Nested reference publishing fixes that: you publish a parent and its referenced entries and assets go with it.

The rules are worth knowing before you rely on it:

- References are followed up to five levels deep by default. The depth can vary by plan.


- Publishing follows unpublished changes and stops at the last published version of a reference. If A references B and B references C, and only C changed since B was last published, publishing A does not include C. Publish B with its references, or C directly.


- Entries and taxonomies already published to the target environment and locale are skipped.


- If a nested entry fails, the entries below it are not sent.


- Only two bulk publish jobs can be active across your organization at once.


- It is a plan-based feature that your organization admin has to have enabled.



Through the API, nested reference publishing needs the api_version: 3.2 header. With the JavaScript Management SDK, pass is_nested: true and the version:

```javascript
await stack.bulkOperation().publish({
  details: {
    entries: [{ _content_type_uid: 'page', uid: 'blt_landing_page' }],
    locales: ['en-us'],
    environments: ['production'],
  },
  is_nested: true,
  api_version: '3.2',
});
```

You list the parents. Contentstack walks their references.

## Side by side

This is the table I'd pin above my desk:


Release

Bulk publish

Nested reference publishing

Solves

Many items live at one moment

Many items live now

A parent and its references live together

Picks versions

Yes, per item

Per request

Latest unpublished changes

Scheduling

Yes

No (use a release)

Yes, as a scheduled bulk job

Follows references

No

No

Yes, up to five levels

API

/v3/releases/{uid}/deploy

/v3/bulk/publish

/v3/bulk/publish with api_version: 3.2

CLI 2.x

None

cm:stacks:bulk-entries

None

Undo

Deploy an unpublish

--revert in the CLI

Unpublish the items

## Where it goes wrong

The biggest trap is combining releases and nested references. Nested reference publishing is not supported when you publish through releases. If your launch release contains a landing page, it does not pull in the page's new hero. Add every referenced entry to the release yourself, and check the release before you schedule it.

The second trap is reading a 200 as "published." Both bulk publish and release deploys hand you a job. Your CI should poll the job status before it tells anyone the content is live, and before it triggers a frontend rebuild that expects the new content.

The third is workflows. If an entry fails a publish rule, a nested bulk publish does not proceed. That's correct behavior, but it surprises people who expected the rest of the tree to go through.

## Concluding

Pick by the question you are answering. "When does this go live?" is a release. "How do I get all of this out?" is bulk publish, and in practice that means cm:stacks:bulk-entries. "Will this page work when it lands?" is nested reference publishing.

If you are wiring any of this into a pipeline, read [Safe content model changes with branches and aliases](/guides/safe-content-model-changes-with-branches-and-aliases) for the model side, and [Revalidate, prime or redeploy](/blog/revalidate-prime-or-redeploy-picking-the-right-cache-lever-on-launch) for what happens on the frontend after the content is live.



---

## Do this with AI

Install the cms-releases and cms-environments-publishing skills from [Contentstack agent skills](https://github.com/contentstack/contentstack-agent-skills) and connect the Release Manager profile in MCP Profile Hub. Then ask your agent:

> List the items in my spring campaign release with their versions, and flag any referenced entry or asset that is not in the release and not yet published.

New to this? [Set up your AI workbench](/guides/set-up-your-ai-workbench-for-contentstack) first.




---

## Frequently asked questions

### Can I publish nested references through a release?

No. Nested reference publishing is not supported when you publish entries through releases. Add the referenced entries to the release yourself.

### How many items can one bulk publish API request handle?

The API reference lists 10 entries in 10 locales and 10 environments per request, and bulk actions are limited to one request per second.

### What does the api_version 3.2 header do?

It is the API version that supports nested reference publishing. The bulk publish and job status endpoints list it as a required header.

### Which CLI command replaces cm:entries:publish in CLI 2.x?

cm:stacks:bulk-entries, from the bulk operations plugin that ships with CLI 2.x. It publishes or unpublishes entries in bulk with filters, retries and reverts.


---

## Step 11: Audit your content model before a migration

- **Source:** https://developers.contentstack.com/guides/audit-your-content-model-before-a-migration
- **Checkpoint:** You can audit a content model and say what to refactor before moving it.

- **Authors:** Tim Benniks
- **Published:** 2026-12-03T09:00:00.000Z
- **Updated:** 2026-12-04T09:28:27.439Z
- **Level:** Intermediate
- **Intent:** Learn
- **Tags:** content_modeling, taxonomy, cli, api, migration

---

The short answer: before you migrate, inventory every content type and field, count entries per content type and how often each field is filled, find content types nobody uses or that duplicate each other, map how deep your references go and where they loop, check how global fields and modular blocks are reused, list your taxonomies and tags and clean up the terms, and check which locales actually have content. Then decide per content type whether to keep, merge, drop or refactor it, write down the target model and a mapping sheet from old fields to new ones, and only then run the migration.

Most migration tools copy the model you have. That is what you want for the move itself, but it means every unused field, every near-duplicate content type and every free-text tag comes along. This guide shows how to run the audit against a Contentstack stack with the CLI and the Content Management API (CMA). The method is the same for any source CMS: export the schema, count what is actually used, and decide before you move. If your source is Contentful, the [Contentful migration guide](/guides/migrating-from-contentful-to-contentstack-in-depth) covers the move. This guide is the step before it.

## What you'll learn

- How to export a stack's schema with csdx and the Content Management API


- How to measure entries per content type and field fill rates with a small Node script


- How to find reference chains and circular references, and check them against Contentstack limits


- How to audit taxonomies and tags and rationalize terms


- How to turn the numbers into keep, merge, drop or refactor decisions and a mapping sheet


- What to change during the move and what to leave for after



## Step 1: Export the schema

Start with a copy of the model you can read and diff. The CLI writes one JSON file per content type and global field:

```bash
csdx auth:tokens:add --management --alias audit-source \
  --stack-api-key <stack_api_key> --token <management_token>

csdx cm:stacks:export -a audit-source --branch main \
  --module content-types --data-dir ./export
csdx cm:stacks:export -a audit-source --branch main \
  --module global-fields --data-dir ./export
csdx cm:stacks:export -a audit-source --branch main \
  --module taxonomies --data-dir ./export
csdx cm:stacks:export -a audit-source --branch main \
  --module locales --data-dir ./export
```

Commit the export folder. It is your "before" snapshot, and every later model decision can be reviewed as a diff against it. If an export fails or hangs, [csdx import and export failures](/guides/csdx-import-and-export-failures) covers the usual causes.

If your source is another CMS, use its own schema export. What matters is that you end up with a machine-readable list of content types, fields, field types and reference targets.

## Step 2: Count what is actually used

A schema tells you what editors can fill in. It doesn't tell you what they do fill in. For that you need entry counts and fill rates, which means reading entries.

The script below uses the CMA with a management token. It lists content types with GET /v3/content_types, reads every entry of each content type with GET /v3/content_types/{uid}/entries, and counts how many entries have a value in each top-level field. It also collects reference targets, taxonomy terms and tags as it goes, so you only read the entries once.

```javascript
// audit.mjs, run with: node audit.mjs
import { writeFile } from "node:fs/promises";

const HOST = process.env.CS_CMA_HOST ?? "https://api.contentstack.io";
const headers = {
  api_key: process.env.CS_API_KEY,
  authorization: process.env.CS_MANAGEMENT_TOKEN,
  branch: process.env.CS_BRANCH ?? "main",
};
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));

async function get(path, params = {}) {
  const url = new URL(`/v3${path}`, HOST);
  for (const [k, v] of Object.entries(params)) url.searchParams.set(k, String(v));
  for (let attempt = 1; attempt <= 5; attempt++) {
    const res = await fetch(url, { headers });
    if (res.status === 429) { await sleep(1000 * attempt); continue; }
    if (!res.ok) throw new Error(`${res.status} ${path}: ${await res.text()}`);
    await sleep(150); // stay well under 10 CMA reads per second
    return res.json();
  }
  throw new Error(`Still rate limited on ${path}`);
}

async function getAll(path, key, params = {}) {
  const items = [];
  for (let skip = 0; ; skip += 100) {
    const page = await get(path, { ...params, include_count: true, limit: 100, skip });
    items.push(...page[key]);
    if (page[key].length < 100 || items.length >= page.count) return items;
  }
}

// Flatten a schema into field paths, including groups, blocks and global fields
function walk(schema = [], prefix = "", out = []) {
  for (const field of schema) {
    const path = prefix + field.uid;
    out.push({ path, field });
    if (field.data_type === "group" || field.data_type === "global_field") walk(field.schema, `${path}.`, out);
    if (field.data_type === "blocks") for (const b of field.blocks ?? []) walk(b.schema, `${path}.${b.uid}.`, out);
  }
  return out;
}

const isEmpty = (v) =>
  v == null || v === "" || (Array.isArray(v) && v.length === 0) ||
  (typeof v === "object" && !Array.isArray(v) && Object.keys(v).length === 0);

const contentTypes = await getAll("/content_types", "content_types", { include_global_field_schema: true });
const report = { contentTypes: [], references: {}, terms: {}, tags: {} };

for (const ct of contentTypes) {
  const fields = walk(ct.schema);
  const topLevel = ct.schema.map((f) => f.uid);
  const entries = await getAll(`/content_types/${ct.uid}/entries`, "entries");
  const filled = Object.fromEntries(topLevel.map((uid) => [uid, 0]));
  let lastUpdated = null;

  for (const entry of entries) {
    for (const uid of topLevel) if (!isEmpty(entry[uid])) filled[uid]++;
    for (const t of entry.taxonomies ?? []) {
      const key = `${t.taxonomy_uid}/${t.term_uid}`;
      report.terms[key] = (report.terms[key] ?? 0) + 1;
    }
    for (const tag of entry.tags ?? []) report.tags[tag] = (report.tags[tag] ?? 0) + 1;
    if (!lastUpdated || entry.updated_at > lastUpdated) lastUpdated = entry.updated_at;
  }

  report.references[ct.uid] = [...new Set(fields
    .filter(({ field }) => field.data_type === "reference")
    .flatMap(({ field }) => [].concat(field.reference_to)))];

  report.contentTypes.push({
    uid: ct.uid,
    entries: entries.length,
    lastUpdated,
    totalFields: fields.length,
    modularBlocksFields: ct.schema.filter((f) => f.data_type === "blocks").length,
    globalFields: fields.filter(({ field }) => field.data_type === "global_field").map((f) => f.path),
    fillRate: Object.fromEntries(topLevel.map((uid) =>
      [uid, entries.length ? Math.round((filled[uid] / entries.length) * 100) : 0])),
  });
}

await writeFile("audit-report.json", JSON.stringify(report, null, 2));
console.table(report.contentTypes.map(({ uid, entries, totalFields, lastUpdated }) =>
  ({ uid, entries, totalFields, lastUpdated })));
```

Set CS_API_KEY, CS_MANAGEMENT_TOKEN and CS_BRANCH, and set CS_CMA_HOST if your stack is not in AWS North America. Use a management token, not your user authtoken, for scripts like this.

A few things to know before you trust the numbers:

- The CMA allows 10 read requests per second per organization by default, shared with everything else that calls it. The script waits between requests and backs off on 429. On a large stack it takes a while, so run it outside working hours.


- Get all entries accepts a locale parameter. The script doesn't pass one, so add it and run the script per locale if your locales differ a lot.


- The emptiness check is shallow. A JSON RTE field with an empty paragraph, or a group whose sub-fields are all blank, counts as filled. Spot-check the fields that score high but look suspicious.



## Step 3: Find unused and duplicate content types

Sort the table by entries and lastUpdated. Three patterns show up in almost every stack:

- Content types with zero or a handful of entries. Often a test, a one-off campaign, or a type someone started and abandoned. Check with the owner, then plan to drop it.


- Content types nobody has touched in a long time. If the newest entry is years old and the frontend no longer renders it, it is archive content. Decide whether it migrates at all.


- Fields under 10 percent fill rate. Either the field is optional for a real reason, or nobody uses it. Ask the editors which one it is.



Duplicates take one more step. Add this to the end of audit.mjs to flag pairs of content types that share most of their top-level fields:

```javascript
const ids = Object.fromEntries(report.contentTypes.map((c) => [c.uid, new Set(Object.keys(c.fillRate))]));
for (const [a, fa] of Object.entries(ids)) for (const [b, fb] of Object.entries(ids)) {
  if (a >= b) continue;
  const shared = [...fa].filter((f) => fb.has(f)).length;
  const overlap = shared / new Set([...fa, ...fb]).size;
  if (overlap > 0.7) console.log(`${a} and ${b} share ${Math.round(overlap * 100)}% of fields`);
}
```

news_article and press_release with the same fields are usually one content type with a taxonomy term for the kind of article.

## Step 4: Map reference depth and circular references

report.references is a graph: each content type points at the content types its reference fields allow. Walk it at the end of the script to find the longest chain and any loops:

```javascript
const cycles = new Set();
let deepest = [];
function visit(node, path) {
  if (path.includes(node)) return cycles.add([...path.slice(path.indexOf(node)), node].join(" -> "));
  const next = [...path, node];
  if (next.length > deepest.length) deepest = next;
  for (const target of report.references[node] ?? []) visit(target, next);
}
for (const uid of Object.keys(report.references)) visit(uid, []);
console.log("Deepest chain:", deepest.join(" -> "));
console.log("Cycles:", [...cycles]);
```

Compare the result with the limits that bite at delivery and publish time:

- include_all_depth on the REST Delivery API goes up to 5 levels, with at most 100 reference paths per request.


- Multiple content type reference fields resolve up to 3 levels, and the GraphQL Content Delivery API stops at 3 levels too.


- Nested reference publishing sends references along up to 5 levels deep.



A chain like page, section, card, author, company is already past what GraphQL resolves. A cycle such as article referencing related articles is normal, but a long loop through four content types usually means the model is doing the job of a taxonomy or a navigation structure. To check one content type by hand, GET /v3/content_types/{uid}/references lists the content types that reference it, directly or nested. [Nested references empty or error 141](/guides/nested-references-empty-or-error-141) shows what deep chains look like from the frontend, and [Contentstack limits on one page](/guides/contentstack-limits-on-one-page) has the full list.

## Step 5: Review global fields and modular blocks

Use totalFields, modularBlocksFields and globalFields from the report to check each content type against the schema limits:

- A content type can hold 400 fields, counting everything inside modular blocks, groups and global fields.


- A content type can have 5 modular blocks fields and 25 global fields, and blocks nest 2 levels deep.



Then look for the reuse you are missing and the reuse you are faking. The same set of SEO fields copied into six content types is a global field waiting to happen. A modular block that editors fill in with the same testimonial on ten pages should be a reference, because a global field shares the structure, not the values. [Modular blocks, references or global fields](/guides/modular-blocks-references-or-global-fields) has a decision table for these calls.

## Step 6: Audit taxonomies and tags

List the stack's taxonomies and their terms with GET /v3/taxonomies and GET /v3/taxonomies/{taxonomy_uid}/terms, or read them from the export folder. Then compare with report.terms:

- Terms with zero entries are candidates to drop.


- Terms with near-identical names in one taxonomy, or the same idea in two taxonomies, are candidates to merge.


- Tags are free text. Sort report.tags and you will find "Next.js", "nextjs" and "next" next to each other. Tags you filter or build listings on should move into a taxonomy, where editors pick from a controlled list.



Check the target against the taxonomy limits: 25 terms per entry, 10,000 terms per taxonomy, 10 levels deep, and one Taxonomy field per content type, which can hold several taxonomies. [Taxonomies are your query layer](/blog/taxonomies-are-your-query-layer) explains why small, closed taxonomies make better filters than a long list of topics, and [Querying content by taxonomy](/guides/querying-content-by-taxonomy) shows how the result is queried.

## Step 7: Check locales

List locales with GET /v3/locales or from the export. For each one, ask whether it has real content and whether anyone maintains it. A locale with a few dozen translated entries out of thousands is usually relying on fallback. Contentstack supports one level of fallback, so a chain like de-at to de-de to en-us in your old CMS needs a decision: flatten it, or translate the missing content.

## Step 8: Decide keep, merge, drop or refactor

Put every content type on one list and give it one decision:

- Keep: used, owned, and the shape fits. Migrates as is.


- Merge: overlaps another content type. Pick the survivor, map the other's fields onto it, and add a taxonomy term if the difference was the kind of content.


- Drop: unused, abandoned or archive-only. Export the entries somewhere safe, then leave them out.


- Refactor: used, but the shape is wrong. Deep chains, copied field sets, tags that should be terms.



Do the same for low fill-rate fields, and get the decisions signed off by whoever owns the content.

## Step 9: Write the target model and a mapping sheet

The mapping sheet is the contract between the audit and the migration. One row per source field:

```csv
source_type,source_field,decision,target_type,target_field,transform,owner
news_article,headline,merge,article,title,none,content team
press_release,title,merge,article,title,none,content team
press_release,,merge,article,taxonomies,add term article_type/press_release,content team
article,legacy_banner,drop,,,,web team
article,tags,refactor,article,taxonomies,map tag spellings to subjects terms,content team
```

## What to refactor during the move and what to leave for after

Drop and merge during the move. Migrating content you will delete next month costs time, rate limit and a second cleanup. Converting tags to taxonomy terms also fits here, because the mapping is mechanical.

Leave refactors that need large frontend changes for after the move. If the migration also rewrites your data layer, every model change adds code changes on top. The Contentful tooling, for example, records a field mapping and rewrites queries for a one-to-one move, and treats global fields as an optional refactor rather than part of the migration. Get to a working site first. The [what migrates and how to verify](/guides/migrating-from-contentful-to-contentstack-in-depth/what-migrates-what-needs-manual-work-and-how-to-verify) chapter has the checklist for that point.

After the move, make model changes on a branch. Script them with cm:stacks:migration, diff them against main with cm:branches:diff, and merge them, or point your frontend at an alias and repoint it when the new model is ready. Keep changes additive: add new fields before you remove old ones. Taxonomies are global across branches, so plan term deletions separately. [Safe content model changes with branches and aliases](/guides/safe-content-model-changes-with-branches-and-aliases) walks through the full loop.

## Next steps

- Run the move with the [Contentful to Contentstack migration guide](/guides/migrating-from-contentful-to-contentstack-in-depth) if that is your source.


- Settle the structural calls in [Modular blocks, references or global fields](/guides/modular-blocks-references-or-global-fields).


- Keep [Contentstack limits on one page](/guides/contentstack-limits-on-one-page) open while you write the target model.


- Plan post-migration refactors with [Safe content model changes with branches and aliases](/guides/safe-content-model-changes-with-branches-and-aliases).





---

## Do this with AI

Install the cms-data-modeling-best-practices skill from [Contentstack agent skills](https://github.com/contentstack/contentstack-agent-skills). Then ask your agent:

> Read audit-report.json and the content types in ./export. List content types with fewer than 10 entries, fields filled in under 10 percent of entries, pairs of content types with mostly the same fields, and reference chains deeper than three levels. Suggest keep, merge, drop or refactor for each one with a one-line reason, but don't change any schema.

If your source is Contentful, the migration-companion skill runs the move itself once the audit is done.

New to this? [Set up your AI workbench](/guides/set-up-your-ai-workbench-for-contentstack) first.




---

## Frequently asked questions

### What should I check in a content model before a CMS migration?

Inventory content types and fields, measure how many entries each content type has and how often each field is filled, find unused and duplicate content types, map reference depth and circular references, review global fields and modular blocks, rationalize taxonomies and tags, and check locales. Then decide per content type whether to keep, merge, drop or refactor it, and write a mapping sheet.

### How do I count entries per content type in Contentstack?

Call GET /v3/content_types/{content_type_uid}/entries on the Content Management API with include_count=true. The response includes a count next to the entries. Page through with limit and skip, because one request returns at most 100 entries.

### Should I refactor the content model during the migration or after it?

Drop and merge during the move, because that is cheaper than migrating content you will delete. Keep renames and restructures that need code changes small during the move, and do larger refactors afterwards on a branch, where you can diff, merge and roll back.

### Does the Contentful migration tool clean up my content model?

No. It converts the model you have into a Contentstack bundle, field by field. Global fields are an optional refactor, not part of the one-to-one migration. Audit the model first and change it before or after the move.

