跳至主要内容

新增文档知识

新增网页或文章知识。

请求

POST https://apichat.twt.com/openapi/zhishi/create_doc

Header 参数

参数名类型必填说明
x-chat-signaturestringHMAC-SHA256 签名
Acceptstring默认值:application/json
Content-Typestringapplication/json

Body 参数

参数名类型必填说明
appidstring应用标识
timestampinteger请求时间戳
ranstrstring随机字符串
lxinteger1 表示网页,2 表示文章
urlstring[]网页必填待解析的网页地址,最多 10 条
mcstring文章必填文章标题,1 至 255 个字符
nrstring文章必填文章内容,1 至 2000 个字符

请求示例

{
"appid": "your-appid",
"timestamp": 1735689600,
"ranstr": "random-string",
"lx": 2,
"mc": "使用入门",
"nr": "欢迎使用本产品。"
}

返回响应

200 成功

参数名类型必填说明
codeinteger1 正常,-1 失败
msgstring响应信息
data.idinteger本次新增的主知识库 ID
data.idsinteger[]本次实际创建的全部 ID;多个网页地址可能创建多条知识
{
"code": 1,
"msg": "ok",
"data": {
"id": 1002,
"ids": [1002]
}
}

错误示例

{
"code": -1,
"msg": "参数错误",
"data": ""
}