# 知识节点接口

# 创建文件夹

请求URL

POST https://lxapi.lexiangla.com/cgi-bin/v1/kb/entries

请求头

参数 是否必须 说明
Content-Type 固定值:"application/json; charset=utf-8"
Authorization 接口调用凭证 access_token
值格式:"Bearer access_token"
示例值:"Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJS"
x-staff-id 成员帐号,作为文件夹创建者

其他说明

事项 说明
权限要求 知识库管理
授权范围 AppKey绑定团队时,入参relationships.parent_entry.data.id父节点的知识需在授权的团队下
频率限制 3000次/分钟

请求参数

{
  "data": {
    "attributes": {
      "name": "一级目录",
      "entry_type": "folder"
    },
    "relationships": {
      "parent_entry": {
        "data": {
          "type": "entry",
          "id": "e8270053d38a41e3b80eb52fca8a30bb"
        }
      }
    }
  }
}

参数说明

参数 是否必须 说明
name 节点名称
entry_type 节点类型,创建文件夹时固定为 folder
relationships.parent_entry.data.id 父节点ID

响应 200 Ok 状态码

{
  "data": {
    "type": "kb_entry",
    "id": "e8270053d38a41e3b80eb52fca8a30bb",
    "attributes": {
      "name": "一级目录",
      "entry_type": "folder",
      "created_at": "2025-03-18 15:25:11",
      "updated_at": "2025-03-18 15:25:11"
    }
  }
}

# 上传文件

此接口只用于创建知识实体,不负责文件传输。开发者需先通过本地文件上传接口将文件上传于腾讯云,再把state通过此接口把文件和实体关联起来。

请求URL

POST https://lxapi.lexiangla.com/cgi-bin/v1/kb/entries?state={STATE}

请求头

参数 是否必须 说明
Content-Type 固定值:"application/json; charset=utf-8"
Authorization 接口调用凭证 access_token
值格式:"Bearer access_token"
示例值:"Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJS"
x-staff-id 成员帐号,作为文件创建者

其他说明

事项 说明
权限要求 知识库管理
授权范围 AppKey绑定团队时,入参relationships.parent_entry.data.id父节点的知识需在授权的团队下
频率限制 3000次/分钟

请求参数

{
  "data": {
    "attributes": {
      "name": "报销流程",
      "entry_type": "file"
    },
    "relationships": {
      "parent_entry": {
        "data": {
          "type": "entry",
          "id": "e8270053d38a41e3b80eb52fca8a30bb"
        }
      }
    }
  }
}

参数说明

参数 是否必须 说明
state 文件上传临时标识
name 节点标题,缺省时节点标题直接使用上传的文件名
entry_type 节点类型,决定文件预览方式。目前支持值:video、file
video: 支持视频类型文件预览,文件后缀包括WMV、RM、MOV、MPEG、MP4、3GP、FLV、AVI、RMVB、TS、ASF、MPG、WEBM、MKV、M3U8、WM、ASX、RAM、MPE、VOB、DAT、MP4V、M4V、F4V、MXF、QT

audio: 支持音频类型文件预览,文件后缀包括MP3、M4A、FLAC、OGG、WAV、AAC、AMR

file: 支持图片类型文件预览,文件后缀包括jpg、jpeg、png、bmp、webp、tiff、gif;文档类型文件预览,文件后缀包括doc、dot、wps、wpt、docx、dotx、docm、dotm;表格类型文件预览,文件后缀包括xls、xlt、et、ett、xlsx、xltx、csv、xlsb、xlsm、xltm、ets;幻灯片文件预览,文件后缀包括pptx、ppt、pot、potx、pps、ppsx、dps、dpt、pptm、potm、ppsm;其他类型文件后缀支持pdf、txt
relationships.parent_entry.data.id 父节点ID

提醒:不同类型文件可在线预览大小以及是否支持AI解析与站内上传一致,若有疑问可到页面上传测试对比

响应

200 Ok 状态码

{
  "data": {
    "type": "kb_entry",
    "id": "e8270053d38a41e3b80eb52fca8a30bb",
    "attributes": {
      "name": "报销流程",
      "entry_type": "file",
      "created_at": "2025-03-18 15:25:11",
      "updated_at": "2025-03-18 15:25:11"
    }
  }
}

# 重新上传文件

开发者需先通过本地文件上传接口将文件上传于腾讯云,再把state通过此接口把文件和实体关联起来。

请求URL

PUT https://lxapi.lexiangla.com/cgi-bin/v1/kb/entries/{entry_id}/upload?state={STATE}

请求头

参数 是否必须 说明
Authorization 接口调用凭证 access_token
值格式:"Bearer access_token"
示例值:"Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJS"
x-staff-id 成员帐号,作为修改者需具有操作权限

其他说明

事项 说明
权限要求 知识库管理
授权范围 AppKey绑定团队时,入参entry_id知识需在授权的团队下
频率限制 3000次/分钟

参数说明

参数 是否必须 说明
state 文件上传临时标识。新版本文件扩展名必须与原文件一致

响应

200 Ok 状态码

{
  "data": {
    "type": "kb_entry",
    "id": "e8270053d38a41e3b80eb52fca8a3xxx",
    "attributes": {
      "name": "报销流程",
      "entry_type": "file",
      "created_at": "2025-03-18 15:25:11",
      "updated_at": "2025-03-18 15:25:11"
    }
  }
}

# 删除知识节点

此接口删除知识节点时需要保证要删除的知识节点下没有其他的子知识节点。

请求URL

DELETE https://lxapi.lexiangla.com/cgi-bin/v1/kb/entries/{entry_id}

请求头

参数 是否必须 说明
Authorization 接口调用凭证 access_token
值格式:"Bearer access_token"
示例值:"Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJS"
x-staff-id 成员帐号,作为知识节点的删除者
若不希望指定删除者或忽略权限校验,可设置为固定值:"system-bot"

其他说明

事项 说明
权限要求 知识库管理
授权范围 AppKey绑定团队时,入参entry_id知识需在授权的团队下
频率限制 3000次/分钟

参数说明

参数 是否必须 说明
entry_id 知识节点ID

响应

204 No Content

# 设置成员与权限

请求URL

POST https://lxapi.lexiangla.com/cgi-bin/v1/kb/entries/{entry_id}/subject

请求头

参数 是否必须 说明
Content-Type 固定值:"application/json; charset=utf-8"
Authorization 接口调用凭证 access_token
值格式:"Bearer access_token"
示例值:"Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJS"
x-staff-id 成员帐号,作为设置者需具有操作权限
若不希望指定设置者或忽略权限校验,可设置为固定值:"system-bot"

其他说明

事项 说明
权限要求 知识库管理
授权范围 AppKey绑定团队时,入参entry_id知识需在授权的团队下
频率限制 3000次/分钟

URL 参数说明

参数 是否必须 说明
entry_id 知识节点ID

请求参数

{
  "data": [
    {
      "type": "staff",
      "id": "ThreeZhang",
      "attributes": {
        "role": "viewer"
      }
    },
    {
      "type": "department",
      "id": 1,
      "attributes": {
        "role": "editor"
      }
    }
  ]
}

参数说明

参数 是否必须 说明
data 请求数据数组,每项为一个对象。
data.*.type 对象类型,staff 或 department。
data.*.id 对象ID。staff 填成员帐号,department 填部门ID。
data.*.attributes.role 给当前对象分配的角色
manager:管理 editor:编辑 downloader:查看下载 viewer:仅查看

响应

200 Ok 状态码

# 移除成员与权限

请求URL

DELETE https://lxapi.lexiangla.com/cgi-bin/v1/kb/entries/{entry_id}/subject

请求头

参数 是否必须 说明
Content-Type 固定值:"application/json; charset=utf-8"
Authorization 接口调用凭证 access_token
值格式:"Bearer access_token"
示例值:"Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJS"
x-staff-id 成员帐号,作为移除者需具有操作权限
若不希望指定移除者或忽略权限校验,可设置为固定值:"system-bot"

其他说明

事项 说明
权限要求 知识库管理
授权范围 AppKey绑定团队时,入参entry_id知识需在授权的团队下
频率限制 3000次/分钟

URL 参数说明

参数 是否必须 说明
entry_id 知识节点ID

请求参数

{
  "data": {
    "type": "staff",
    "id": "ThreeZhang",
    "attributes": {
      "role": "viewer"
    }
  }
}

参数说明

参数 是否必须 说明
data.type 对象类型,staff 或 department。
data.id 对象ID。staff 填成员帐号,department 填部门ID。
data.attributes.role 当前对象的角色
manager:管理 editor:编辑 downloader:查看下载 viewer:仅查看

响应

200 Ok 状态码

# 设置知识继承权限

请求URL

PUT https://lxapi.lexiangla.com/cgi-bin/v1/kb/entries/{entry_id}/inherit

请求头

参数 是否必须 说明
Content-Type 固定值:"application/json; charset=utf-8"
Authorization 接口调用凭证 access_token
值格式:"Bearer access_token"
示例值:"Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJS"
x-staff-id 成员帐号,作为移除者需具有操作权限
若不希望指定移除者或忽略权限校验,可设置为固定值:"system-bot"

其他说明

事项 说明
权限要求 知识库管理
授权范围 AppKey绑定团队时,入参entry_id知识需在授权的团队下
频率限制 3000次/分钟

URL 参数说明

参数 是否必须 说明
entry_id 知识节点ID

请求参数

{
  "data": {
    "attributes": {
      "member_inherit_type":"viewer"
    }
  }
}

参数说明

参数 是否必须 说明
data.attributes.member_inherit_type none:无权限 default:与上级节点一致 manager:管理 editor:编辑 downloader:查看下载 viewer:仅查看

响应

200 Ok 状态码

# 获取知识列表

请求URL

GET https://lxapi.lexiangla.com/cgi-bin/v1/kb/entries

请求头

参数 是否必须 说明
Authorization 接口调用凭证 access_token
值格式:"Bearer access_token"
示例值:"Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJS"

其他说明

事项 说明
权限要求 知识库管理
授权范围 AppKey绑定团队时,入参space_id知识库需在授权的团队下
频率限制 3000次/分钟

参数说明

参数 是否必须 说明
space_id 知识库ID
parent_id 节点ID,默认为查询知识库根目录
limit 拉取条数
page_token 分页游标,根据上一页返回的page_token传入

响应

200 Ok 状态码

{
    "data": [
        {
            "type": "kb_entry",
            "id": "0e75db22d07c4ad593982baf77xxxxxx",
            "attributes": {
                "name": "知识节点标题1",
                "entry_type": "video",
                "created_at": "2025-06-30 15:26:14",
                "updated_at": "2025-06-30 16:30:03",
                "has_children": false
            }
        },
        {
            "type": "kb_entry",
            "id": "be8eeddc2ed64845b616a98ef7xxxxxx",
            "attributes": {
                "name": "知识节点标题2",
                "entry_type": "page",
                "created_at": "2025-06-30 19:24:17",
                "updated_at": "2025-07-15 02:07:52",
                "has_children": false
            }
        },
        {
            "type": "kb_entry",
            "id": "ee32105ee9e545d681d94941b4xxxxxx",
            "attributes": {
                "name": "知识节点标题3",
                "entry_type": "video",
                "created_at": "2025-06-30 15:26:03",
                "updated_at": "2025-07-15 02:07:52",
                "has_children": false
            }
        }
    ],
    "meta": {
        "page_token": "WyIyMDI1LTA2LTMwVDE1OjI2OjAzKzA4OjAwIiwzNDgyMl0="
    }
}

参数说明

参数 说明
data.attributes.name 节点名称
data.attributes.entry_type 节点类型
folder: 文件夹
file: 文件
video: 视频
audio: 音频
link: 链接
page: 线上文档
smartsheet: 智能表格
data.attributes.has_children 节点是否包含子节点

# 获取知识详情

请求URL

GET https://lxapi.lexiangla.com/cgi-bin/v1/kb/entries/{entry_id}

请求头

参数 是否必须 说明
Authorization 接口调用凭证 access_token
值格式:"Bearer access_token"
示例值:"Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJS"

其他说明

事项 说明
权限要求 知识库管理
授权范围 AppKey绑定团队时,入参entry_id知识需在授权的团队下
频率限制 3000次/分钟

参数说明

参数 是否必须 说明
entry_id 节点ID

响应

文件类型(entry_type=file)的响应


{
  "data": {
    "type": "kb_entry",
    "id": "552d9d5729e94b1485c34afa3dae6b1f",
    "attributes": {
      "name": "excel",
      "entry_type": "file",
      "created_at": "2025-05-23 15:55:39",
      "updated_at": "2025-05-23 15:55:39",
      "member_inherit_type": "viewer"
    },
    "relationships": {
      "parent": {
        "data": {
          "type": "kb_entry",
          "id": "09c081349f704daba4185da852cf0df5"
        }
      },
      "owner": {
        "data": {
          "type": "staff",
          "id": "ThreeZhang"
        }
      }
    }
  },
  "included": [
    {
      "type": "kb_entry",
      "id": "09c081349f704daba4185da852cf0df5",
      "attributes": {
        "name": "#ROOT#",
        "entry_type": "root",
        "created_at": "2025-04-18 10:20:09",
        "updated_at": "2025-05-23 15:55:39"
      }
    },
    {
      "type": "staff",
      "id": "ThreeZhang",
      "attributes": {
        "name": "张三",
        "english_name": "ThreeZhang",
        "organization": "开发部"
      }
    }
  ],
  "links": {
    "download": "https://file.lexiang-asset.com/xxx/kb/entries/2025/05/xxx.xlsx?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=X-Amz-Credential"
  }
}

参数说明

参数 说明
data.attributes.name 文件标题
data.attributes.created_at 文件创建时间
data.attributes.updated_at 文件内容最后修改时间
data.attributes.member_inherit_type 给知识节点的上级节点所属成员分配角色 none:无权限 default:与上级节点一致 viewer:仅查看 downloader:可查看/下载 editor:可编辑 manager:可管理
links.download 若是成员上传的文件可下载,有效时长为60分钟。非上传的文件(如公众号导入等)则不返回下载链接

# 获取线上文档内容

请求URL

GET https://lxapi.lexiangla.com/cgi-bin/v1/kb/entries/{entry_id}/content

请求头

参数 是否必须 说明
Authorization 接口调用凭证 access_token
值格式:"Bearer access_token"
示例值:"Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJS"

其他说明

事项 说明
权限要求 知识库管理
授权范围 AppKey绑定团队时,入参entry_id知识需在授权的团队下
频率限制 3000次/分钟

参数说明

参数 是否必须 说明
entry_id 知识节点ID,只支持entry_type=page的知识节点,即线上文档
content_type 导出内容格式,固定值:"html"

响应

200 Ok 状态码


{
    "data": {
        "type": "kb_entry",
        "id": "a0a5aaxxxxxxxxxxxxxxxxxxxxxx3b27e3c2",
        "attributes": {
            "name": "文档标题",
            "html_content": "\n<div class=\"page\" data-type=\"page\">\n<p class=\"p\" data-type=\"p\" >内容1</p>\n\n<p class=\"p\" data-type=\"p\" >内容2</p>\n\n<p class=\"p\" data-type=\"p\" >内容3</p>\n</div>\n"
        }
    }
}

参数说明

参数 说明
name 文档标题
html_content 转化为html格式内容

返回的html_content里可能会包含附件链接/kb_files/{file_id},若需要下载附件,参考获取附件详情

# 获取成员与权限

请求URL

GET https://lxapi.lexiangla.com/cgi-bin/v1/kb/entries/{entry_id}/subject

请求头

参数 是否必须 说明
Authorization 接口调用凭证 access_token
值格式:"Bearer access_token"
示例值:"Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJS"

其他说明

事项 说明
权限要求 知识库管理
授权范围 AppKey绑定团队时,入参entry_id知识需在授权的团队下
频率限制 3000次/分钟

参数说明

参数 是否必须 说明
entry_id 知识节点ID
page_token 用于分页,从响应的meta.page_token获取
limit 每页拉取条数,默认100;最大100
role 指定要拉取的角色。可选值:
manager(可管理)
editor(可编辑)
downloader(可查看/下载)
viewer(仅查看)
不指定时拉取所有角色

响应

200 Ok 状态码

{
  "data": [
    {
      "type": "staff",
      "id": "xiaochen",
      "attributes": {
        "name": "小陈",
        "english_name": "chen",
        "organization": "开发组",
        "role": "viewer"
      }
    },
    {
      "type": "department",
      "id": 1,
      "attributes": {
        "name": "xx公司",
        "order": 33655,
        "role": "viewer"
      }
    }
  ],
  "meta": {
    "page_token": "WyJzdGFmZiIsMTE3ODk2XQ"
  }
}

参数说明

data.type = staff

参数 说明
name 成员名称
english_name 成员别名
organization 成员所属部门
role 给当前对象分配的角色
manager:管理 editor:编辑 downloader:查看下载 viewer:仅查看

data.type = department

参数 说明
name 部门名称
order 显示优先级
role 给当前对象分配的角色
manager:管理 editor:编辑 downloader:查看下载 viewer:仅查看

# 获取知识自定义属性

请求URL

GET https://lxapi.lexiangla.com/cgi-bin/v1/kb/entries/{entry_id}/properties/values

请求头

参数 是否必须 说明
Authorization 接口调用凭证 access_token
值格式:"Bearer access_token"
示例值:"Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJS"

其他说明

事项 说明
权限要求 知识库管理
授权范围 AppKey绑定团队时,入参entry_id知识需在授权的团队下
频率限制 3000次/分钟

参数说明

参数 是否必须 说明
entry_id 节点ID

响应


{
  "data": {
    "attributes": {
      "97639f86fc974e298d7cff3bb800eb82": {
        "value": "文本test",
        "name": "文本属性"
      },
      "08d1525397e34ae9a570852367fd8491": {
        "value": ["a", "b"],
        "name": "多选属性"
      },
      "9026e292ba27405c8e22c2bf7a1828ff": {
        "value": "分类1/分类2",
        "name": "分类属性"
      }
    }
  }
}

参数说明

参数 说明
data.attributes.自定义属性id.value 自定义属性值
自定义字段为多选时,值为字符数组
自定义字段为单选时,值为字符串
自定义字段为分类时,值为path路径
自定义字段为文本时,值为字符串
data.attributes.自定义属性id.name 自定义字段的名称

# 修改知识自定义属性

请求URL

PUT https://lxapi.lexiangla.com/cgi-bin/v1/kb/entries/{entry_id}/properties/values

请求头

参数 是否必须 说明
Authorization 接口调用凭证 access_token
值格式:"Bearer access_token"
示例值:"Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJS"
x-staff-id 成员帐号,作为设置者需具有操作权限
若不希望指定设置者或忽略权限校验,可设置为固定值:"system-bot"

其他说明

事项 说明
权限要求 知识库管理
授权范围 AppKey绑定团队时,入参entry_id知识需在授权的团队下
频率限制 3000次/分钟

URL 参数说明

参数 是否必须 说明
entry_id 节点ID

请求参数


{
  "data": {
    "attributes": {
      "97639f86fc974e298d7cff3bb800eb82": {
        "value": "文本test2"
      },
      "08d1525397e34ae9a570852367fd8491": {
        "value": ["b", "c"]
      },
      "9026e292ba27405c8e22c2bf7a1828ff": {
        "value": "分类3/分类4"
      }
    }
  }
}

参数说明

参数 说明
data.attributes.自定义属性id.value 自定义属性值
自定义字段为多选时,值为字符数组
自定义字段为单选时,值为字符串
自定义字段为分类时,值为path路径
自定义字段为文本时,值为字符串

响应

  • 200 Ok 状态码