# 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.

- Canonical page: https://realcomposer.com/recipes/call-contentful-from-flutterflow-securely
- Client platform: FlutterFlow
- Upstream services: Contentful
- Category: Security & Secret Vault
- JSON version: https://realcomposer.com/recipes/call-contentful-from-flutterflow-securely.json
- Install in RealComposer (free plan, pre-fills this pipeline): https://realcomposer.com/dashboard/pipelines/new?recipe=call-contentful-from-flutterflow-securely&via=agent

## Problem: Contentful keys in FlutterFlow network tabs

FlutterFlow ships code or scripts to end-user devices. Any Contentful bearer token in those bundles can be copied from DevTools, proxies, or repackaged apps.

- Shared FlutterFlow projects revealing Contentful tokens
- Sudden Contentful quota burn from scripted abuse
- Inability to rotate keys without redeploying clients

## Solution steps

1. **Add vault secrets for this pipeline**: Add CONTENTFUL_ACCESS_TOKEN to RealComposer Secret Vault. Values decrypt only inside the Cloudflare Worker that calls the upstream.

2. **Configure upstream steps and output mapping**: Point step contentful at https://cdn.contentful.com/spaces/{{query.spaceId}}/entries with GET. Add output mapping fields that mirror the JSON contract your screen already expects. Leave cache TTL at 0 when each response is user-specific (include userId or record id in query params before enabling cache).

3. **Wire the FlutterFlow API Call**: Allowed origins on the token should list every FlutterFlow host that calls this URL.

```
// FlutterFlow API Call
URL: https://realcomposer.com/v1/workspace/call-contentful-from-flutterflow-securely
Header Authorization: Bearer rc_live_your_token
```

## Pipeline config

Import this config into a RealComposer pipeline. `{{secrets.NAME}}` values are read from the encrypted Secret Vault at request time, so the client never sees them.

```json
{
  "name": "Call contentful delivery api from flutterflow securely",
  "method": "GET",
  "cacheTtlSeconds": 0,
  "authMode": "client_token",
  "steps": [
    {
      "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": "entryId",
        "sourcePath": "items.0.sys.id",
        "type": "string",
        "sourceStep": "contentful"
      },
      {
        "targetPath": "title",
        "sourcePath": "items.0.fields.title",
        "type": "string",
        "sourceStep": "contentful"
      }
    ]
  }
}
```

## Call the pipeline

```bash
curl -X GET "https://realcomposer.com/v1/workspace/call-contentful-from-flutterflow-securely" \
  -H "Authorization: Bearer rc_live_client_token"
```

## Payload before and after

Raw upstream response:

```json
{
  "requestId": "req_call-con",
  "upstreamLatencyMs": 142,
  "audit": {
    "region": "edge",
    "trace": "call-contentful-from-flutterflow-securely"
  },
  "payload": {
    "id": "sample_id",
    "status": "active",
    "nested": {
      "tags": [
        "demo"
      ],
      "internal": true
    },
    "unused_blob": {
      "foo": "bar",
      "bar": "baz"
    }
  }
}
```

Slimmed RealComposer response:

```json
{
  "entryId": "sample",
  "title": "sample"
}
```

## FAQ

### Is it safe to log Contentful responses in FlutterFlow?

Point FlutterFlow at /recipes/call-contentful-from-flutterflow-securely edge URL. RealComposer answers OPTIONS with Access-Control headers for allowed origins.

### Will Anthropic or Linear prompt bodies be rewritten?

call-contentful-from-flutterflow-securely POST steps bypass caches.default even if cacheTtlSeconds is set in the dashboard.

### What happens if an upstream step times out?

Upstream steps in call-contentful-from-flutterflow-securely honor timeoutMs and optional fallback JSON without leaking secrets.
