Skip to main content

Create Document

Create web or article knowledge entries.

Request

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

Header Parameters

ParameterTypeRequiredDescription
x-chat-signaturestringYesHMAC-SHA256 signature
AcceptstringNoDefault: application/json
Content-TypestringYesapplication/json

Body Parameters

ParameterTypeRequiredDescription
appidstringYesApplication identifier from the console
timestampintegerYesRequest timestamp
ranstrstringYesRandom string
lxintegerYes1 for web, 2 for article
urlstring[]Required for webWeb URLs to parse, up to 10 entries
mcstringRequired for articleArticle title, 1 to 255 characters
nrstringRequired for articleArticle content, 1 to 2000 characters

Request Example

{
"appid": "your-appid",
"timestamp": 1735689600,
"ranstr": "random-string",
"lx": 2,
"mc": "Getting Started",
"nr": "Welcome to the product."
}

Response

200 Success

ParameterTypeRequiredDescription
codeintegerYes1 success, -1 failure
msgstringYesResponse message
data.idintegerYesPrimary newly created knowledge ID
data.idsinteger[]YesAll IDs created by this request; web URLs may create multiple entries
{
"code": 1,
"msg": "ok",
"data": {
"id": 1002,
"ids": [1002]
}
}

Error Example

{
"code": -1,
"msg": "Invalid parameters",
"data": ""
}