# Shopify Order JSON Too Big Reduce Payload Size

> Shopify responses include fields Frontend / Web never renders. Map id, status, and UI columns at the edge after calling https://{{secrets.SHOPIFY_STORE}}.myshopify.com/admin/api/2026-10/products.json?limit=5.

- Canonical page: https://realcomposer.com/recipes/reduce-shopify-order-json-payload
- Client platform: Frontend / Web
- Upstream services: Shopify
- Category: Payload Slimmer
- JSON version: https://realcomposer.com/recipes/reduce-shopify-order-json-payload.json
- Install in RealComposer (free plan, pre-fills this pipeline): https://realcomposer.com/dashboard/pipelines/new?recipe=reduce-shopify-order-json-payload&via=agent

## Problem: Unmapped Shopify fields waste bandwidth

Shopify returns nested CRM, audit, and configuration objects. Frontend / Web parses them on the main thread even when the UI binds three fields.

- Large arrays kept in memory after navigation
- Analytics showing poor LCP on API-heavy screens
- Developers shipping defensive null checks for unused paths

## Solution steps

1. **Store upstream credentials in Secret Vault**: Store SHOPIFY_ACCESS_TOKEN in the vault. Frontend / Web never embeds the raw secret, only a revocable rc_live_ client token.

2. **Set headers, mapping, and cache TTL**: Configure headersTemplate to inject vault secrets, target https://{{secrets.SHOPIFY_STORE}}.myshopify.com/admin/api/2026-10/products.json?limit=5, and Map only the UI fields in output mapping so clients never download audit or nested blobs.

3. **Call from Frontend / Web**: Authorize with Bearer rc_live_ and fetch the mapped JSON contract your UI already expects.

```
const res = await fetch('https://realcomposer.com/v1/workspace/reduce-shopify-order-json-payload', {
  headers: { 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": "Shopify Order JSON Too Big Reduce Payload Size",
  "method": "GET",
  "cacheTtlSeconds": 0,
  "authMode": "client_token",
  "steps": [
    {
      "stepKey": "shopify",
      "upstreamUrlTemplate": "https://{{secrets.SHOPIFY_STORE}}.myshopify.com/admin/api/2026-10/products.json?limit=5",
      "httpMethod": "GET",
      "headersTemplate": {
        "X-Shopify-Access-Token": "{{secrets.SHOPIFY_ACCESS_TOKEN}}"
      },
      "timeoutMs": 3000
    }
  ],
  "outputMapping": {
    "version": 1,
    "fields": [
      {
        "targetPath": "productId",
        "sourcePath": "products.0.id",
        "type": "number",
        "sourceStep": "shopify"
      },
      {
        "targetPath": "title",
        "sourcePath": "products.0.title",
        "type": "string",
        "sourceStep": "shopify"
      }
    ]
  }
}
```

## Call the pipeline

```bash
curl -X GET "https://realcomposer.com/v1/workspace/reduce-shopify-order-json-payload" \
  -H "Authorization: Bearer rc_live_client_token"
```

## Payload before and after

Raw upstream response:

```json
{
  "requestId": "req_reduce-s",
  "upstreamLatencyMs": 142,
  "audit": {
    "region": "edge",
    "trace": "reduce-shopify-order-json-payload"
  },
  "payload": {
    "id": "sample_id",
    "status": "active",
    "nested": {
      "tags": [
        "demo"
      ],
      "internal": true
    },
    "unused_blob": {
      "foo": "bar",
      "bar": "baz"
    }
  }
}
```

Slimmed RealComposer response:

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

## FAQ

### Which Shopify credential belongs in the vault for this pipeline?

Yes for reduce-shopify-order-json-payload. Ship only an rc_live_ client token in Frontend / Web; RealComposer injects SHOPIFY_ACCESS_TOKEN on https://{{secrets.SHOPIFY_STORE}}.myshopify.com/admin/api/2026-10/products.json?limit=5.

### What cache key does RealComposer use?

reduce-shopify-order-json-payload vault headers attach server-side, but Anthropic or OpenAI model and messages must come from the client body.

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

Allowed origins on the reduce-shopify-order-json-payload client token restrict which domains may call the edge URL.
