# How to Combine Multiple API Responses into One JSON Without a Backend

> You do not need to spin up an Express, FastAPI, or Docker microservice just to stitch REST APIs together. RealComposer fetches multiple upstream endpoints concurrently at the edge, injects private credentials, and combines the responses into a single JSON schema with sub-10ms response times.

- Canonical page: https://realcomposer.com/recipes/combine-multiple-apis-into-single-json
- Client platform: Any Frontend / Mobile
- Upstream services: REST APIs, Microservices
- Category: Multi-API Aggregation
- JSON version: https://realcomposer.com/recipes/combine-multiple-apis-into-single-json.json
- Install in RealComposer (free plan, pre-fills this pipeline): https://realcomposer.com/dashboard/pipelines/new?recipe=combine-multiple-apis-into-single-json&via=agent

## Problem: The Microservice Tax for Simple Aggregations

Maintaining Docker containers, Kubernetes, or Node servers just to merge 2 JSON responses introduces CI/CD overhead, server maintenance, and security patch burdens.

- High cloud hosting costs for idle microservices
- Maintaining server infrastructure for simple glue code

## Solution steps

1. **Add Upstream REST Steps**: Configure URLs and query params for each service.

2. **Map Keys in Visual Builder**: Assemble clean output hierarchy in the browser.

3. **Deploy Live at Edge**: Publish to Cloudflare edge in 1 click.

## 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": "Multi-API Orchestrator",
  "method": "GET",
  "cacheTtlSeconds": 60,
  "steps": [
    {
      "stepKey": "serviceA",
      "upstreamUrlTemplate": "https://jsonplaceholder.typicode.com/users/1",
      "httpMethod": "GET",
      "headersTemplate": {},
      "timeoutMs": 3000
    },
    {
      "stepKey": "serviceB",
      "upstreamUrlTemplate": "https://jsonplaceholder.typicode.com/posts/1",
      "httpMethod": "GET",
      "headersTemplate": {},
      "timeoutMs": 3000
    }
  ],
  "outputMapping": {
    "version": 1,
    "fields": [
      {
        "targetPath": "author.name",
        "sourceStep": "serviceA",
        "sourcePath": "name"
      },
      {
        "targetPath": "author.email",
        "sourceStep": "serviceA",
        "sourcePath": "email"
      },
      {
        "targetPath": "article.title",
        "sourceStep": "serviceB",
        "sourcePath": "title"
      }
    ]
  }
}
```

## Call the pipeline

```bash
curl -X GET "https://realcomposer.com/v1/acme/combined-feed"
```

## Payload before and after

Raw upstream response:

```json
{
  "serviceA": {
    "name": "Leanne",
    "email": "sincere@april.biz"
  },
  "serviceB": {
    "title": "Edge Computing"
  }
}
```

Slimmed RealComposer response:

```json
{
  "author": {
    "name": "Leanne",
    "email": "sincere@april.biz"
  },
  "article": {
    "title": "Edge Computing"
  }
}
```

## FAQ

### How many APIs can I merge into one?

RealComposer supports running multiple parallel steps concurrently via Promise.all.
