# 知识节点接口

# 创建文件夹

请求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"
        }
      }
    }
  }
}

参数说明

参数 是否必须 说明
space_id 空间ID(通过query传递)
name 节点名称
entry_type 节点类型,创建文件夹时固定为 folder
relationships.parent_entry.data.id 父节点ID, 默认为查询知识库根目录(需传space_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"
    }
  }
}

# 更名知识节点

请求URL

PUT https://lxapi.lexiangla.com/cgi-bin/v1/kb/entries/{entry_id}/rename
参数 是否必须 说明
Content-Type 固定值:"application/json; charset=utf-8"
Authorization 接口调用凭证 access_token
值格式:"Bearer access_token"
示例值:"Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJS"
x-staff-id 成员帐号,作为知识更新者

其他说明

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

URL 参数说明

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

请求参数

{
  "data": {
    "attributes": {
      "name": "API重命名知识节点"
    }
  }
}

参数说明

参数 是否必须 说明
data.attributes.name 知识节点名称,长度为1~150个字符

响应

200 Ok 状态码

{
  "data": {
    "type": "kb_entry",
    "id": "fe604f859a7d495fbb5f0d477f655a4b",
    "attributes": {
      "name": "API重命名知识节点"
    }
  }
}

参数说明

参数 说明
name 知识节点名称

# 上传文件

此接口只用于创建知识实体,不负责文件传输。开发者需先通过本地文件上传接口将文件上传于腾讯云,再把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"
        }
      }
    }
  }
}

参数说明

参数 是否必须 说明
space_id 空间ID(通过query传递)
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, 默认为查询知识库根目录(需传space_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

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": "page"
    },
    "relationships": {
      "parent_entry": {
        "data": {
          "type": "entry",
          "id": "e8270053d38a41e3b80eb52fca8a30bb"
        }
      }
    }
  }
}

参数说明

参数 是否必须 说明
space_id 空间ID(通过query传递)
name 节点名称
entry_type 节点类型,创建在线文档时固定为 page
relationships.parent_entry.data.id 父节点ID, 默认为查询知识库根目录(需传space_id)

响应 200 Ok 状态码

{
  "data": {
    "type": "kb_entry",
    "id": "e8270053d38a41e3b80eb52fca8a30bb",
    "attributes": {
      "name": "在线文档标题",
      "entry_type": "page",
      "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?downgrade={downgrade}

请求头

参数 是否必须 说明
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
downgrade 是否允许覆盖权限。默认为1,设置为1时新权限会直接覆盖原有权限。设置为0时,只增加权限,低权限不会覆盖高权限

请求参数

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

参数说明

参数 是否必须 说明
data 请求数据数组,每项为一个对象。
data.*.type 对象类型,staff, department 或 contact_tag。
data.*.id 对象ID。staff 填成员帐号,department 填部门ID,contact_tag填成员标签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 或 contact_tag。
data.id 对象ID。staff 填成员帐号,department 填部门ID,contact_tag填成员标签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 每页拉取条数,取值范围1~100,默认100
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: 音频
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",
      "has_children": false,
      "external_access": "none",
      "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.external_access 是否对外公开:none 不公开,internet_view 公开查看,internet_download 公开查看/下载,inherit_internet_view 继承上级查看,inherit_internet_download 继承上级查看/下载,inherit_space_internet_view 继承知识库查看,inherit_space_internet_download 继承知识库查看/下载
data.attributes.member_inherit_type 给知识节点的上级节点所属成员分配角色 none:无权限 default:与上级节点一致 viewer:仅查看 downloader:可查看/下载 editor:可编辑 manager:可管理
data.attributes.has_children 节点是否包含子节点
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",
            "has_children": false
        }
    }
}

参数说明

参数 说明
data.attributes.name 文档标题
data.attributes.html_content 转化为html格式内容
data.attributes.has_children 节点是否包含子节点

返回的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"
      }
    },
    {
        "type": "contact_tag",
        "id": "1",
        "attributes": {
            "id": "1",
            "name": "成员标签",
            "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:仅查看

data.type = contact_tag

参数 说明
name 成员标签名称
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 状态码

# 搜索知识节点

请求URL

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

请求头

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

其他说明

事项 说明
权限要求 搜索知识
授权范围 AppKey绑定团队时,搜索结果仅限授权团队范围内的知识;team_id 与 space_id 需至少填其一,且须在授权范围内
频率限制 3000次/分钟

请求参数

{
    "keyword": "搜索关键词",
    "limit": 20,
    "page_token": "",
    "space_id": "e8270053d38a41e3b80eb52fca8a30bb",
    "filters": {
        "properties": [
            {
                "id": "97639f86fc974e298d7cff3bb800eb82",
                "keys": ["文本值"]
            },
            {
                "id": "08d1525397e34ae9a570852367fd8491",
                "keys": ["orve3sy18br", "fc5t3mzkzm"]
            }
        ]
    }
}

参数说明

参数 是否必须 说明
keyword 搜索关键词,标题或者内容命中分词,最大200个字符
team_id 团队ID,限定在指定团队范围内搜索
space_id 知识库ID,限定在指定知识库范围内搜索
sort_by 排序方式。可选值:创建时间升序:created_at、创建时间降序:-created_at、修改时间升序:edited_at、修改时间降序:-edited_at,不传时按搜索相关性排序
limit 每页拉取条数,取值范围1~100,默认20
page_token 分页游标,根据上一页返回的 meta.page_token 传入
filters 筛选条件
filters.properties 自定义属性筛选数组,多个条件之间为 AND 关系,返回全部命中的数据
filters.properties.*.id 当 filters.properties 非空时必填
自定义属性ID,可通过 获取自定义属性列表 接口获取
filters.properties.*.keys 当 filters.properties 非空时必填
筛选值数组,可通过 获取自定义属性详情 接口获取选项的唯一标识
文本类型:传入文本值,如["关键词"]
单选类型:传入选项的唯一标识ID,如["orve3sy18br"]
多选类型:传入选项ID数组,如["orve3sy18br", "fc5t3mzkzm"]
分类类型:传入分类的唯一标识ID,如["uf4t7azgxh"]

响应

200 Ok 状态码

{
    "data": [
        {
            "type": "kb_entry",
            "id": "0e75db22d07c4ad593982baf77xxxxxx",
            "attributes": {
                "name": "知识节点标题1",
                "entry_type": "page",
                "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": "file",
                "created_at": "2025-06-30 19:24:17",
                "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: 音频
page: 线上文档
smartsheet: 智能表格
data.attributes.created_at 创建时间
data.attributes.updated_at 内容最后修改时间
data.attributes.has_children 节点是否包含子节点
meta.page_token 分页游标,用于下一页请求。当返回为空字符串时,表示已无更多数据

# 获取知识标签

请求URL

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

请求头

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

其他说明

事项 说明
权限要求 获取知识标签
授权范围 AppKey 绑定团队时,入参 entry_id 对应知识需在授权的团队下
频率限制 3000次/分钟

URL 参数说明

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

响应

200 Ok 状态码

{
  "data": [
    {
      "type": "tag",
      "id": "f24be52cb6ec4798a86442f172931836",
      "attributes": {
        "name": "标签a",
        "created_at": "2025-12-18 17:37:19",
        "updated_at": "2025-12-18 17:37:19"
      },
      "relationships": {
        "owner": {
          "data": {
            "type": "staff",
            "id": "LX001"
          }
        }
      }
    },
    {
      "type": "tag",
      "id": "63c8609e804d4bf088c549d7cbd45924",
      "attributes": {
        "name": "标签b",
        "created_at": "2026-06-10 15:42:24",
        "updated_at": "2026-06-10 15:42:24"
      },
      "relationships": {
        "owner": {
          "data": {
            "type": "staff",
            "id": "LX001"
          }
        }
      }
    }
  ],
  "included": [
    {
      "type": "staff",
      "id": "LX001",
      "attributes": {
        "name": "成员001",
        "english_name": "别名",
        "organization": "开发组"
      }
    }
  ]
}

参数说明

参数 说明
id 标签ID
attributes.name 标签名
attributes.created_at 标签创建时间(Unix 时间戳,单位:秒)
attributes.updated_at 标签最近一次更新时间(Unix 时间戳,单位:秒)
relationships.owner 属性创建者,可根据 id 在 included 中查找

# 更新知识标签

增量更新指定知识节点上的标签绑定关系。add_tagsdel_tags 在同一请求中可同时存在,先增后删。

  • 同名标签不存在时会自动按公司维度创建后再绑定到 entry
  • 同一标签重复增/删均按幂等处理,不会报错
  • 删除标签仅解除与该 entry 的绑定关系,不会删除标签本身

请求URL

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

请求头

参数 是否必须 说明
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": "tag",
        "attributes": {
            "add_tags": ["产品规划", "新增标签"],
            "del_tags": ["旧标签"]
        }
    }
}

参数说明

参数 是否必须 说明
data.type 资源类型,固定值 tag
data.attributes.add_tags 待新增绑定的标签名数组;标签不存在时自动创建
data.attributes.del_tags 待解除绑定的标签名数组

add_tagsdel_tags 不能同时为空。 单个标签名最长36个字符

响应

204 No Content

# 生成智能标签

为指定知识节点触发一次基于内容的智能标签生成,标签结果会异步绑定到该知识节点。

接口采用异步受理模式:

  • 主请求立即返回 204,表示已受理(同一知识节点已有任务在进行中时也按幂等成功返回 204
  • 标签会在服务端后台生成并自动绑定到 entry,整体耗时通常 3 ~ 30 秒
  • 调用方需通过 获取知识标签 轮询对比调用前后获取最终结果,建议轮询间隔 ≥ 3 秒
  • 触发全局限流时返回 429,调用方稍后重试即可

请求URL

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

请求头

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

其他说明

事项 说明
权限要求 生成智能标签
授权范围 AppKey 绑定团队时,入参 entry_id 对应知识需在授权的团队下
频率限制 3000次/分钟(接口请求侧)
智能标签生成全局并发上限:32

URL 参数说明

参数 是否必须 说明
entry_id 知识节点ID。建议仅对线上文档(page)、文件(file)等具备文本内容,且AI解析成功的节点调用,空文本内容不生成标签

请求参数

无(请求 body 为空对象或留空均可)。

响应

  • 204 No Content

    已受理。包括两种情况:

    1. 新触发了一次智能标签生成任务
    2. 同一知识节点已有任务在进行中(幂等命中)

    调用方无需区分这两种情况,统一通过 获取知识标签 拉取最终结果。

错误说明

  • 429 Too Many Requests 智能标签生成全局并发已满
{
    "errors": {
        "detail": "标签生成请求过于频繁,请稍后重试"
    }
}

# 设置知识有效期

设置指定知识节点的有效期,支持四种类型:长期有效、指定日期有效、强制过期、移除有效期。

请求URL

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

请求头

参数 是否必须 说明
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": "entry",
        "attributes": {
            "validity_type": "time_range",
            "expired_at": "2026-06-24"
        }
    }
}

参数说明

参数 是否必须 说明
data.type 资源类型,固定值 entry
data.attributes.validity_type 有效期类型,可选值:
permanent - 长期有效
time_range - 指定日期前有效
force_expire - 强制过期
none - 移除有效期
data.attributes.expired_at 失效日期,格式 YYYY-MM-DD
time_range 类型时必填,例如2026-06-25 表示25号0点前有效

time_range 类型时 expired_at 指定的日期不能早于今天

响应

204 No Content

错误说明

状态码 说明
400 参数校验失败
404 指定的知识节点不存在
500 服务内部错误

# 创建知识反馈

对指定知识节点创建反馈。

请求URL

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

请求头

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

其他说明

事项 说明
权限要求 创建知识反馈
授权范围 AppKey 绑定团队时,入参 entry_id 对应知识需在授权的团队下
频率限制 3000次/分钟

URL 参数说明

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

请求参数

{
    "data": {
        "type": "kb_feedback",
        "attributes": {
            "type": "kb_content_mistake",
            "content": "内容有误,第3段数据不对",
            "attachments": ["https://example.com/screenshot.png"]
        }
    }
}

参数说明

参数 是否必须 说明
data.type 资源类型,固定值 kb_feedback
data.attributes.type 反馈类型,可选值:
kb_content_incomplete 内容缺失
kb_content_mistake 内容有误
kb_content_suggestion 内容建议
kb_content_too_old 内容陈旧
kb_content_other 其他
data.attributes.content 反馈内容,最长 1024 字符。与 attachments 不能同时为空
data.attributes.attachments 图片链接数组,最多 9 个。与 content 不能同时为空
使用乐享图片地址,参考素材上传,长度为1~1000个字符

响应

204 No Content

错误说明

状态码 说明
400 参数校验失败
404 指定的知识节点不存在
500 服务内部错误