Linear API密钥需在官网Settings→Developers→Personal API Keys中创建并妥善保存;可用GraphQL客户端、SDK或curl调用接口,均需在请求头添加Bearer认证,且teamId须从团队URL提取。

获取Linear API密钥
登录 Linear 官网(linear.app),进入 Settings → Developers → Personal API Keys,点击 “Create API Key”,输入描述名称后生成密钥。
【密钥仅显示一次,复制后立即保存,丢失需重新生成】
用GraphQL客户端直接调用API
Linear 使用 GraphQL 接口,推荐用 GraphiQL 或 VS Code 的 GraphQL 插件调试。
在请求头中添加 Authorization: Bearer 【你的API密钥】,请求地址为 https://api.linear.app/graphql。
执行一个简单查询,例如获取当前用户信息:
{ viewer { id name email } }
使用Linear SDK发起请求
安装官方SDK:
npm install @linear/sdk
初始化客户端并创建问题:
import { LinearClient } from "@linear/sdk";<br>const client = new LinearClient({ apiKey: "your_api_key_here" });<br>const issue = await client.issueCreate({ title: "Fix login timeout", teamId: "te_abc123" });
teamId 必须是真实存在的团队ID,可在团队URL中提取:https://linear.app/teams/【te_abc123】/issues。
用curl命令快速测试接口
打开终端,粘贴以下命令(将 YOUR_API_KEY 替换为实际密钥):
curl -X POST https://api.linear.app/graphql \<br> -H "Content-Type: application/json" \<br> -H "Authorization: Bearer YOUR_API_KEY" \<br> -d '{"query":"{ issues(first:2){nodes{name id}}}"}
如果返回 JSON 中包含 issues 字段和两个节点,说明认证与基础查询已通。
大量免费API接口:立即使用
涵盖生活服务API、金融科技API、企业工商API、等相关的API接口服务。免费API接口可安全、合规地连接上下游,为数据API应用能力赋能!











