echloe.io

API 参考

将 Echloe 的 GEO 审计、内容生成与关键词发现集成到你自己的应用中。

身份验证

所有 API 请求都需在 Authorization 请求头中以 Bearer token 形式传入有效的 API 密钥。

API 密钥以 ek_live_ 开头,可在控制台设置中生成。

bashcurl https://echloe.io/api/v1/audit \
  -H "Authorization: Bearer ek_live_abc123def456..." \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com"}'

基础 URL

https://echloe.io/api/v1

速率限制

端点限额
POST /api/v1/audit每个 API 密钥每天 10 次请求
POST /api/v1/content无硬性限制(合理使用)
POST /api/v1/keywords无硬性限制(合理使用)

触发速率限制时,API 返回 429 Too Many Requests


运行 GEO 审计

POST/api/v1/audit

对指定 URL 运行完整的 GEO(生成式引擎优化)审计,返回带分类明细、发现项与改进建议的详细评分。

请求体

参数类型必填说明
urlstring要审计的 URL(可带或不带 https://)

示例

bashcurl -X POST https://echloe.io/api/v1/audit \
  -H "Authorization: Bearer ek_live_..." \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com"}'

响应

json{
  "url": "https://example.com/",
  "score": 42,
  "categories": [
    {
      "name": "AI Citability",
      "score": 12,
      "maxScore": 25,
      "weight": 25,
      "details": "Average passage citability: 48/100..."
    }
  ],
  "findings": [
    {
      "severity": "critical",
      "category": "Schema & Structured Data",
      "message": "No JSON-LD structured data found."
    }
  ],
  "recommendations": [
    {
      "priority": 1,
      "title": "Fix: No JSON-LD structured data found",
      "description": "...",
      "impact": "high"
    }
  ],
  "crawledAt": "2026-04-02T12:00:00.000Z",
  "citability": { "averageScore": 48, "blockCount": 12, ... },
  "brandPresence": { "platforms": { ... }, "overallScore": 35 },
  "crawlerAccess": { "tier1Allowed": 5, "tier2Allowed": 7, ... },
  "llmsTxt": { "exists": false, ... },
  "schemaReport": { "typesFound": ["Organization"], ... }
}

生成内容

POST/api/v1/content

为某个产品生成 AI 内容(目前为博客文章)。内容会存入你的账户并在响应中返回。

请求体

参数类型必填说明
productIdstring要生成内容的产品 ID
topicstring要撰写的主题或关键词
typestring内容类型。目前仅支持 “blog_post”。

示例

bashcurl -X POST https://echloe.io/api/v1/content \
  -H "Authorization: Bearer ek_live_..." \
  -H "Content-Type: application/json" \
  -d '{"productId": "abc123", "topic": "AI SEO best practices", "type": "blog_post"}'

响应

json{
  "id": "ctn_xyz789",
  "title": "AI SEO Best Practices for 2026",
  "content": "# AI SEO Best Practices for 2026\n\n..."
}

列出内容

GET/api/v1/content

返回你已生成内容的分页列表。

查询参数

参数类型必填说明
limitinteger返回条数上限(默认 20,最大 100)
offsetinteger跳过的条数(默认 0)

示例

bashcurl "https://echloe.io/api/v1/content?limit=10" \
  -H "Authorization: Bearer ek_live_..."

响应

json{
  "items": [
    {
      "id": "...",
      "title": "AI SEO Best Practices",
      "type": "blog_post",
      "status": "draft",
      "tokenCount": 2048,
      "createdAt": "2026-04-01T10:00:00.000Z"
    }
  ],
  "limit": 10,
  "offset": 0
}

发现关键词

POST/api/v1/keywords

使用 AI 为某个产品发现最多 20 个新关键词。已发现的关键词会自动存储,后续调用不会重复返回。

请求体

参数类型必填说明
productIdstring要发现关键词的产品 ID

示例

bashcurl -X POST https://echloe.io/api/v1/keywords \
  -H "Authorization: Bearer ek_live_..." \
  -H "Content-Type: application/json" \
  -d '{"productId": "abc123"}'

响应

json{
  "keywords": [
    {
      "id": "kw_001",
      "keyword": "ai content optimization",
      "intent": "informational",
      "difficulty": "medium",
      "source": "ai_discovered",
      "status": "active"
    }
  ],
  "count": 18
}

列出关键词

GET/api/v1/keywords

返回指定产品的全部关键词。

查询参数

参数类型必填说明
productIdstring要列出关键词的产品 ID

示例

bashcurl "https://echloe.io/api/v1/keywords?productId=abc123" \
  -H "Authorization: Bearer ek_live_..."

Webhook

事件发生时,Echloe 可向你的服务器发送实时通知。请在控制台设置中配置 Webhook 端点。

事件

事件说明
audit.completed一次 GEO 审计已处理完成
content.published内容已生成
keyword.discovered已发现新关键词

载荷格式

json{
  "event": "audit.completed",
  "timestamp": "2026-04-02T12:00:00.000Z",
  "data": {
    "url": "https://example.com",
    "score": 72,
    "auditId": "https://example.com/"
  }
}

请求头

请求头说明
X-Echloe-Signature原始请求体的 HMAC-SHA256 十六进制摘要
X-Echloe-Event事件名称(例如 audit.completed)

签名校验

每个 Webhook 请求都带有 X-Echloe-Signature 请求头,其中包含用你的 Webhook 密钥对原始请求体签名得到的 HMAC-SHA256 值。

javascriptconst crypto = require('crypto');

function verifyWebhook(body, signature, secret) {
  const expected = crypto
    .createHmac('sha256', secret)
    .update(body)
    .digest('hex');
  return crypto.timingSafeEqual(
    Buffer.from(signature),
    Buffer.from(expected)
  );
}

// In your webhook handler:
app.post('/webhook', (req, res) => {
  const signature = req.headers['x-echloe-signature'];
  const event = req.headers['x-echloe-event'];

  if (!verifyWebhook(req.rawBody, signature, WEBHOOK_SECRET)) {
    return res.status(401).send('Invalid signature');
  }

  const payload = JSON.parse(req.rawBody);
  console.log('Received ' + event + ':', payload.data);
  res.status(200).send('OK');
});

错误处理

状态码含义
400请求有误:参数缺失或无效
401未授权:API 密钥无效或缺失
404资源不存在
429超出速率限制
500服务器内部错误

所有错误均以 JSON 返回:

json{
  "error": "Human-readable error message"
}

需要帮助? [email protected]