The Contentstack Sync API: Keeping External Systems Up to Date

Fetch everything once, then only what changed

Some systems need a full local copy of your content: mobile apps working offline, search indexes, data warehouses, AI knowledge bases. Re-downloading everything constantly is wasteful. The Sync API gives you everything once, then only changes.

Initial Sync

const result = await Stack.sync({ init: true });
// result.items — all published entries and assets
// result.pagination_token — more pages
// result.sync_token — save this for next time

Follow pagination tokens until you receive a sync_token.

Delta Sync

const changes = await Stack.sync({ sync_token: savedToken });

Each item has a type:

  • entry_published
  • entry_unpublished
  • entry_deleted
  • asset_published, asset_unpublished, asset_deleted
  • content_type_deleted

Apply each change to your local store, then save the new sync token.

Filtering

Initial sync can be filtered by content type, locale, start date, or event type to reduce volume.

Use Cases

  • Mobile offline content
  • Search indexes (backup to webhook-driven indexing)
  • AI knowledge bases and RAG — keep embeddings in sync with published content
  • Data warehouses for content analytics

Tips

  • Store the sync token durably
  • Make processing idempotent
  • Periodically run a full resync as a safety net

Webhooks push changes in real time; the Sync API guarantees you can always catch up. Use both for reliable integrations.

Arivanandhan Chitheshwaran