{
  "slug": "merge-cloudinary-with-contentful-entries",
  "title": "Merge cloudinary assets with contentful entries",
  "metaTitle": "Merge cloudinary assets with - RealComposer",
  "metaDescription": "Merge cloudinary assets with contentful entries. Merge Cloudinary and Contentful in one Next.js / React call with parallel Worker steps.",
  "headline": "DAM plus CMS composed media payload",
  "category": "aggregation",
  "categoryLabel": "Multi-API Aggregation",
  "urgency": 9,
  "clientPlatform": "Next.js / React",
  "upstreamServices": [
    "Cloudinary",
    "Contentful"
  ],
  "searchIntentQuery": "merge cloudinary assets with contentful entries",
  "directAnswerSummary": "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.",
  "problem": {
    "title": "Waterfall latency from multiple Cloudinary and Contentful requests",
    "explanation": "Next.js / React widgets often await Cloudinary and Contentful sequentially, multiplying TLS handshakes on cellular networks and amplifying failure rates.",
    "risks": [
      "Race conditions between parallel manual fetches",
      "Higher mobile data usage from redundant JSON",
      "Timeouts when any upstream exceeds cellular RTT"
    ]
  },
  "solutionSteps": [
    {
      "stepNumber": 1,
      "title": "Add vault secrets for this pipeline",
      "description": "Create CLOUDINARY_BASIC_AUTH, CONTENTFUL_ACCESS_TOKEN vault entries, then bind them to this pipeline step headers with {{secrets.NAME}} placeholders."
    },
    {
      "stepNumber": 2,
      "title": "Configure upstream steps and output mapping",
      "description": "Use GET against https://api.cloudinary.com/v1_1/{{secrets.CLOUDINARY_CLOUD_NAME}}/resources/image. Allowed origins on the client token should match leave cache ttl at 0 when each response is user-specific (include userid or record id in query params before enabling cache)."
    },
    {
      "stepNumber": 3,
      "title": "Call from Next.js / React",
      "description": "Allowed origins on the token should list every Next.js / React host that calls this URL.",
      "codeSnippet": "// app/api route or client component\nconst res = await fetch('https://realcomposer.com/v1/workspace/merge-cloudinary-with-contentful-entries', {\n  cache: 'no-store',\n  headers: { Authorization: 'Bearer rc_live_your_token' }\n});"
    }
  ],
  "pipelineConfig": {
    "name": "Merge cloudinary assets with contentful entries",
    "method": "GET",
    "cacheTtlSeconds": 0,
    "authMode": "client_token",
    "steps": [
      {
        "stepKey": "cloudinary",
        "upstreamUrlTemplate": "https://api.cloudinary.com/v1_1/{{secrets.CLOUDINARY_CLOUD_NAME}}/resources/image",
        "httpMethod": "GET",
        "headersTemplate": {
          "Authorization": "Basic {{secrets.CLOUDINARY_BASIC_AUTH}}"
        },
        "timeoutMs": 3000
      },
      {
        "stepKey": "contentful",
        "upstreamUrlTemplate": "https://cdn.contentful.com/spaces/{{query.spaceId}}/entries",
        "httpMethod": "GET",
        "headersTemplate": {
          "Authorization": "Bearer {{secrets.CONTENTFUL_ACCESS_TOKEN}}"
        },
        "timeoutMs": 3000
      }
    ],
    "outputMapping": {
      "version": 1,
      "fields": [
        {
          "targetPath": "cloudinary.publicId",
          "sourcePath": "resources.0.public_id",
          "type": "string",
          "sourceStep": "cloudinary"
        },
        {
          "targetPath": "cloudinary.format",
          "sourcePath": "resources.0.format",
          "type": "string",
          "sourceStep": "cloudinary"
        },
        {
          "targetPath": "contentful.entryId",
          "sourcePath": "items.0.sys.id",
          "type": "string",
          "sourceStep": "contentful"
        },
        {
          "targetPath": "contentful.title",
          "sourcePath": "items.0.fields.title",
          "type": "string",
          "sourceStep": "contentful"
        }
      ]
    }
  },
  "sampleBloatedInput": {
    "requestId": "req_merge-cl",
    "upstreamLatencyMs": 142,
    "audit": {
      "region": "edge",
      "trace": "merge-cloudinary-with-contentful-entries"
    },
    "payload": {
      "id": "sample_id",
      "status": "active",
      "nested": {
        "tags": [
          "demo"
        ],
        "internal": true
      },
      "unused_blob": {
        "foo": "bar",
        "bar": "baz"
      }
    }
  },
  "sampleSlimmedOutput": {
    "cloudinary_publicId": "sample",
    "cloudinary_format": "sample",
    "contentful_entryId": "sample",
    "contentful_title": "sample"
  },
  "curlSnippet": "curl -X GET \"https://realcomposer.com/v1/workspace/merge-cloudinary-with-contentful-entries\" \\\n  -H \"Authorization: Bearer rc_live_client_token\"",
  "faqs": [
    {
      "question": "Does Next.js / React need CORS changes after adding RealComposer?",
      "answer": "Use scoped tokens where the vendor allows them on merge-cloudinary-with-contentful-entries. Admin keys stay {{secrets.*}} references only."
    },
    {
      "question": "When does edge caching apply to this recipe?",
      "answer": "merge-cloudinary-with-contentful-entries forwards client JSON to POST upstreams unchanged; secrets interpolate only in URLs and header templates."
    },
    {
      "question": "How do I rotate upstream credentials?",
      "answer": "Upstream steps in merge-cloudinary-with-contentful-entries honor timeoutMs and optional fallback JSON without leaking secrets."
    }
  ],
  "relatedRecipeSlugs": [
    "merge-contentful-with-live-pricing",
    "stitch-contentful-with-shopify-products"
  ],
  "updatedAt": "2026-11-20",
  "links": {
    "page": "https://realcomposer.com/recipes/merge-cloudinary-with-contentful-entries",
    "markdown": "https://realcomposer.com/recipes/merge-cloudinary-with-contentful-entries.md",
    "json": "https://realcomposer.com/recipes/merge-cloudinary-with-contentful-entries.json",
    "install": "https://realcomposer.com/dashboard/pipelines/new?recipe=merge-cloudinary-with-contentful-entries&via=agent"
  }
}