RealComposer

Contentful Safe & Unsafe Practices

Direct Answer

Contentful Content Delivery API tokens only read published entries and are lower risk, but Content Preview tokens expose unpublished drafts and Content Management tokens can edit or delete content. Keep preview and management tokens on a server or edge proxy only.

Credentials & Where They Belong

Client safe
Content Delivery API token

Reads published content only. Still scope it per environment.

Server only
Content Preview API token

Reads unpublished drafts and embargoed content.

Server only
Content Management API token

Creates, edits, publishes, and deletes content.

Safe Practices

  • Inject preview tokens only in server-rendered preview routes

    Gate preview mode behind authentication and keep the token out of client bundles.

  • Use separate API keys per environment

    Staging and production should not share delivery tokens.

  • Cache delivery responses at the edge

    Published content changes rarely, so caching cuts API usage and latency.

Unsafe Practices

  • Using NEXT_PUBLIC_ or VITE_ variables for preview tokens

    Those prefixes inline values into the public bundle, leaking unreleased content.

  • Shipping a CMA token to any client

    It allows anyone to rewrite or delete your site content.

The RealComposer Pattern

Store the preview token in the vault and expose a client-token-protected preview pipeline, while published content runs through a cached public pipeline.

START BUILDING FREE

Frequently Asked Questions

Q:Is the Contentful delivery token a secret?

It is low risk because it reads published content only, but treat it as a credential and rotate it if abused.

Contentful Recipes

Security & Secret Vault

Call contentful delivery api from flutterflow securely

Contentful Delivery API proxied with preview and delivery keys in Vault. For "call contentful delivery api from flutterflow securely", store CONTENTFUL_ACCESS_TOKEN in Secret Vault, call https://cdn.contentful.com/spaces/{{query.spaceId}}/entries from a Worker, and let FlutterFlow hit only https://realcomposer.com/v1/workspace/call-contentful-from-flutterflow-securely with an rc_live_ client token.

Sub-10ms edgeView Recipe
Security & Secret Vault

Hide contentful preview token in nextjs app

Edge injects preview token; ISR pages fetch composed CMS JSON safely. For "hide contentful preview token in nextjs app", store CONTENTFUL_PREVIEW_TOKEN in Secret Vault, call https://preview.contentful.com/spaces/{{query.spaceId}}/entries from a Worker, and let Next.js / React hit only https://realcomposer.com/v1/workspace/hide-contentful-preview-token-nextjs with an rc_live_ client token.

Sub-10ms edgeView Recipe

Stitch contentful entries with shopify products api

Contentful marketing fields plus Shopify SKU inventory in parallel. For "stitch contentful entries with shopify products api", store CONTENTFUL_ACCESS_TOKEN, SHOPIFY_ACCESS_TOKEN in Secret Vault, call https://cdn.contentful.com/spaces/{{query.spaceId}}/entries from a Worker, and let Next.js / React hit only https://realcomposer.com/v1/workspace/stitch-contentful-with-shopify-products with an rc_live_ client token.

Sub-10ms edgeView Recipe

Merge cloudinary assets with contentful entries

Resolve Contentful asset references with Cloudinary transformation metadata. For "merge cloudinary assets with contentful entries", store CLOUDINARY_BASIC_AUTH, CONTENTFUL_ACCESS_TOKEN in Secret Vault, call https://api.cloudinary.com/v1_1/{{secrets.CLOUDINARY_CLOUD_NAME}}/resources/image from a Worker, and let Next.js / React hit only https://realcomposer.com/v1/workspace/merge-cloudinary-with-contentful-entries with an rc_live_ client token.

Sub-10ms edgeView Recipe
Edge Caching & Rate Limits

Cache contentful delivery api at edge avoid limits

300s TTL on composed entry responses at Cloudflare edge. For "cache contentful delivery api at edge avoid limits", store CONTENTFUL_ACCESS_TOKEN in Secret Vault, call https://cdn.contentful.com/spaces/{{query.spaceId}}/entries from a Worker, and let Next.js / React hit only https://realcomposer.com/v1/workspace/cache-contentful-delivery-api-edge with an rc_live_ client token. Enable 300s GET cache only when query params identify the resource.

Sub-10ms edgeView Recipe
Security & Secret Vault

Contentful management api secure proxy retool

Contentful CMA writes from Retool via edge with scoped tokens. For "contentful management api secure proxy retool", store CONTENTFUL_MANAGEMENT_TOKEN in Secret Vault, call https://api.contentful.com/spaces/{{query.spaceId}}/entries from a Worker, and let Retool hit only https://realcomposer.com/v1/workspace/contentful-cma-proxy-retool with an rc_live_ client token.

Sub-10ms edgeView Recipe

Related Concepts