# Combine linear with github project board api

> Upgraded multi-step Linear GraphQL plus GitHub repos (replaces single-step batch1). For "combine linear with github project board api", store LINEAR_API_KEY, GITHUB_TOKEN in Secret Vault, call https://api.linear.app/graphql from a Worker, and let Frontend / Web hit only https://realcomposer.com/v1/workspace/combine-linear-with-github-board with an rc_live_ client token. POST upstream calls are not stored in caches.default; clients must send JSON bodies and headers forward unchanged.

- Canonical page: https://realcomposer.com/recipes/combine-linear-with-github-board
- Client platform: Frontend / Web
- Upstream services: Linear, GitHub
- Category: Multi-API Aggregation
- JSON version: https://realcomposer.com/recipes/combine-linear-with-github-board.json
- Install in RealComposer (free plan, pre-fills this pipeline): https://realcomposer.com/dashboard/pipelines/new?recipe=combine-linear-with-github-board&via=agent

## Problem: Serial Linear and GitHub calls slow Frontend / Web pages

Each extra Linear and GitHub hop adds hundreds of milliseconds and another OAuth refresh path your UI must manage.

- One slow upstream blocking an entire page
- Partial failures leaving UI in inconsistent states
- Duplicate auth refresh logic per service

## Solution steps

1. **Store upstream credentials in Secret Vault**: Create LINEAR_API_KEY, GITHUB_TOKEN vault entries, then bind them to this pipeline step headers with {{secrets.NAME}} placeholders.

2. **Configure upstream steps and output mapping**: Use POST against https://api.linear.app/graphql. Allowed origins on the client token should match post pipelines set cache ttl to 0 because realcomposer only stores get responses at the edge.

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/combine-linear-with-github-board', {
  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": "Combine linear with github project board api",
  "method": "POST",
  "cacheTtlSeconds": 0,
  "authMode": "client_token",
  "steps": [
    {
      "stepKey": "linear",
      "upstreamUrlTemplate": "https://api.linear.app/graphql",
      "httpMethod": "POST",
      "headersTemplate": {
        "Authorization": "{{secrets.LINEAR_API_KEY}}",
        "Content-Type": "application/json"
      },
      "timeoutMs": 10000
    },
    {
      "stepKey": "github",
      "upstreamUrlTemplate": "https://api.github.com/user/repos?per_page=5",
      "httpMethod": "GET",
      "headersTemplate": {
        "Authorization": "Bearer {{secrets.GITHUB_TOKEN}}",
        "Accept": "application/vnd.github+json"
      },
      "timeoutMs": 3000
    }
  ],
  "outputMapping": {
    "version": 1,
    "fields": [
      {
        "targetPath": "linear.issueId",
        "sourcePath": "data.issue.id",
        "type": "string",
        "sourceStep": "linear"
      },
      {
        "targetPath": "linear.title",
        "sourcePath": "data.issue.title",
        "type": "string",
        "sourceStep": "linear"
      },
      {
        "targetPath": "github.repoId",
        "sourcePath": "0.id",
        "type": "number",
        "sourceStep": "github"
      },
      {
        "targetPath": "github.fullName",
        "sourcePath": "0.full_name",
        "type": "string",
        "sourceStep": "github"
      }
    ]
  }
}
```

## Call the pipeline

```bash
curl -X POST "https://realcomposer.com/v1/workspace/combine-linear-with-github-board" \
  -H "Authorization: Bearer rc_live_client_token" \
  -H "Content-Type: application/json" \
  -d '{"model":"example"}'
```

## Payload before and after

Raw upstream response:

```json
{
  "requestId": "req_combine-",
  "upstreamLatencyMs": 142,
  "audit": {
    "region": "edge",
    "trace": "combine-linear-with-github-board"
  },
  "payload": {
    "id": "sample_id",
    "status": "active",
    "nested": {
      "tags": [
        "demo"
      ],
      "internal": true
    },
    "unused_blob": {
      "foo": "bar",
      "bar": "baz"
    }
  }
}
```

Slimmed RealComposer response:

```json
{
  "linear_issueId": "sample",
  "linear_title": "sample",
  "github_repoId": "sample",
  "github_fullName": "sample"
}
```

## FAQ

### Can Frontend / Web call Linear without holding the production key?

Use scoped tokens where the vendor allows them on combine-linear-with-github-board. Admin keys stay {{secrets.*}} references only.

### How do I forward JSON bodies to POST upstreams?

combine-linear-with-github-board keeps cache TTL at 0 because it uses POST upstream calls or per-user responses. Add ids to query strings before enabling GET cache.

### How do I rotate upstream credentials?

Upstream steps in combine-linear-with-github-board honor timeoutMs and optional fallback JSON without leaking secrets.
