Create Document
Create web or article knowledge entries.
Request
POST https://apichat.twt.com/openapi/zhishi/create_doc
Header Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
x-chat-signature | string | Yes | HMAC-SHA256 signature |
Accept | string | No | Default: application/json |
Content-Type | string | Yes | application/json |
Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
appid | string | Yes | Application identifier from the console |
timestamp | integer | Yes | Request timestamp |
ranstr | string | Yes | Random string |
lx | integer | Yes | 1 for web, 2 for article |
url | string[] | Required for web | Web URLs to parse, up to 10 entries |
mc | string | Required for article | Article title, 1 to 255 characters |
nr | string | Required for article | Article 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
| Parameter | Type | Required | Description |
|---|---|---|---|
code | integer | Yes | 1 success, -1 failure |
msg | string | Yes | Response message |
data.id | integer | Yes | Primary newly created knowledge ID |
data.ids | integer[] | Yes | All 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": ""
}