API 文档

使用客服码 Open API 以编程方式管理产品说明书、上传素材、触发生成和与 AI 客服交互。

认证

需要认证的接口请在 HTTP 请求头中添加:

Authorization: Bearer YOUR_API_KEY

管理后台 > API 页面创建和管理 API Key。 Key 格式为 kfm_...

接口列表

POST/api/projects需要认证

创建新项目

Request Body

{
  "productName": "My Product",
  "summary": "A brief description"
}

Response

{
  "project": {
    "id": "...",
    "slug": "my-product",
    "productName": "My Product"
  }
}
GET/api/projects需要认证

列出当前用户的所有项目

Response

{
  "projects": [
    {
      "slug": "my-product",
      "productName": "My Product",
      "status": "published"
    }
  ]
}
POST/api/projects/:slug/materials需要认证

上传素材(JSON 文本或 FormData 文件)

Request Body

{
  "title": "FAQ Document",
  "type": "TXT",
  "summary": "",
  "content": "The full text..."
}

Response

{
  "material": {
    "id": "mat_xxx",
    "title": "FAQ Document",
    "status": "parsed"
  }
}
POST/api/projects/:slug/generate需要认证

触发 AI 重新生成说明书内容(异步)

Response

{
  "status": "generating"
}
POST/api/projects/:slug/publish需要认证

发布当前草稿为新版本

Response

{
  "project": {
    "status": "published",
    "versions": [
      "v1.0"
    ]
  }
}
POST/api/projects/:slug/chat

向 AI 客服提问(无需鉴权)

Request Body

{
  "question": "How do I reset my device?"
}

Response

{
  "answer": "To reset your device...",
  "references": [
    "sec_01"
  ],
  "confidenceLabel": "high",
  "suggestedQuestions": [
    "..."
  ]
}
GET/api/projects/:slug/qr

获取项目二维码图片(PNG/SVG)

Response

Binary image data (PNG)
GET/api/projects/:slug/pdf

下载产品说明书 PDF

Response

Binary PDF data