{
  "slug": "call-linear-api-from-client-securely",
  "title": "Call linear api from client without exposing api key",
  "metaTitle": "Call linear api from client without - RealComposer",
  "metaDescription": "Call linear api from client without exposing api key. Keep Linear keys in RealComposer Vault; Frontend / Web uses rc_live_ tokens only.",
  "headline": "Linear GraphQL from internal dashboards safely",
  "category": "security",
  "categoryLabel": "Security & Secret Vault",
  "urgency": 9,
  "clientPlatform": "Frontend / Web",
  "upstreamServices": [
    "Linear"
  ],
  "searchIntentQuery": "call linear api from client without exposing api key",
  "directAnswerSummary": "Linear API key stays in Vault; GraphQL POST runs on Workers. For \"call linear api from client without exposing api key\", store LINEAR_API_KEY in Secret Vault, call https://api.linear.app/graphql from a Worker, and let Frontend / Web hit only https://realcomposer.com/v1/workspace/call-linear-api-from-client-securely with an rc_live_ client token. POST upstream calls are not stored in caches.default; clients must send JSON bodies and headers forward unchanged.",
  "problem": {
    "title": "Why Frontend / Web leaks Linear credentials",
    "explanation": "Attackers routinely extract Linear secrets from Frontend / Web builds. Direct browser calls also expose internal error payloads with hostnames.",
    "risks": [
      "Production Linear keys copied from Frontend / Web bundles",
      "Compliance violations after credential leaks",
      "Attackers replaying vault-grade scopes from a laptop"
    ]
  },
  "solutionSteps": [
    {
      "stepNumber": 1,
      "title": "Store upstream credentials in Secret Vault",
      "description": "Create LINEAR_API_KEY vault entries, then bind them to this pipeline step headers with {{secrets.NAME}} placeholders."
    },
    {
      "stepNumber": 2,
      "title": "Target the real upstream URL",
      "description": "Configure headersTemplate to inject vault secrets, target https://api.linear.app/graphql, and Add output mapping fields that mirror the JSON contract your screen already expects."
    },
    {
      "stepNumber": 3,
      "title": "Call from Frontend / Web",
      "description": "Allowed origins on the token should list every Frontend / Web host that calls this URL.",
      "codeSnippet": "const res = await fetch('https://realcomposer.com/v1/workspace/call-linear-api-from-client-securely', {\n  headers: { Authorization: 'Bearer rc_live_your_token' }\n});"
    }
  ],
  "pipelineConfig": {
    "name": "Call linear api from client without exposing api key",
    "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
      }
    ],
    "outputMapping": {
      "version": 1,
      "fields": [
        {
          "targetPath": "issueId",
          "sourcePath": "data.issue.id",
          "type": "string",
          "sourceStep": "linear"
        },
        {
          "targetPath": "title",
          "sourcePath": "data.issue.title",
          "type": "string",
          "sourceStep": "linear"
        }
      ]
    }
  },
  "sampleBloatedInput": {
    "requestId": "req_call-lin",
    "upstreamLatencyMs": 142,
    "audit": {
      "region": "edge",
      "trace": "call-linear-api-from-client-securely"
    },
    "payload": {
      "id": "sample_id",
      "status": "active",
      "nested": {
        "tags": [
          "demo"
        ],
        "internal": true
      },
      "unused_blob": {
        "foo": "bar",
        "bar": "baz"
      }
    }
  },
  "sampleSlimmedOutput": {
    "issueId": "sample",
    "title": "sample"
  },
  "curlSnippet": "curl -X POST \"https://realcomposer.com/v1/workspace/call-linear-api-from-client-securely\" \\\n  -H \"Authorization: Bearer rc_live_client_token\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"model\":\"example\"}'",
  "faqs": [
    {
      "question": "Is it safe to log Linear responses in Frontend / Web?",
      "answer": "Yes for call-linear-api-from-client-securely. Ship only an rc_live_ client token in Frontend / Web; RealComposer injects LINEAR_API_KEY on https://api.linear.app/graphql."
    },
    {
      "question": "Will Anthropic or Linear prompt bodies be rewritten?",
      "answer": "call-linear-api-from-client-securely vault headers attach server-side, but Anthropic or OpenAI model and messages must come from the client body."
    },
    {
      "question": "How do I rotate upstream credentials?",
      "answer": "Upstream steps in call-linear-api-from-client-securely honor timeoutMs and optional fallback JSON without leaking secrets."
    }
  ],
  "relatedRecipeSlugs": [
    "github-api-private-token-proxy",
    "merge-linear-and-github-pr-api"
  ],
  "updatedAt": "2026-11-20",
  "links": {
    "page": "https://realcomposer.com/recipes/call-linear-api-from-client-securely",
    "markdown": "https://realcomposer.com/recipes/call-linear-api-from-client-securely.md",
    "json": "https://realcomposer.com/recipes/call-linear-api-from-client-securely.json",
    "install": "https://realcomposer.com/dashboard/pipelines/new?recipe=call-linear-api-from-client-securely&via=agent"
  }
}