tencent cloud

Last updated: 2025-10-30 21:48:50
SaveDoc
Last updated: 2025-10-30 21:48:50

1. API Description

Domain name for API request: lke.intl.tencentcloudapi.com.

This API is used to save a knowledge base document Q&As.
Three steps to store a file in the knowledge library of the application:

  1. Obtain a temporary key. For more information, see API Documentation. Different parameter combinations of the temporary key have different permissions. For more information, see Tencent Cloud Agent Development Platform/ADP COS Guide.
  2. Call the COS storage API provided by Tencent Cloud to store the file in the COS of ADP. For details, see COS SDK Overview. Note that the temporary key method is used to operate COS.
  3. Call this API to store the basic information of the file in ADP.
    For the above steps, see Documentation. At the end of the documentation, there is a code demo, which can be used as a reference.

A maximum of 100 requests can be initiated per second for this API.

We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

2. Input Parameters

The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

Parameter Name Required Type Description
Action Yes String Common Params. The value used for this API: SaveDoc.
Version Yes String Common Params. The value used for this API: 2023-11-30.
Region Yes String Common Params. For more information, please see the list of regions supported by the product. This API only supports: ap-jakarta.
BotBizId Yes String Application ID.
FileName Yes String File name.
FileType Yes String File type (md|txt|docx|pdf|xlsx).
CosUrl Yes String The cos path of the platform, consistent with the UploadPath parameter queried by the DescribeStorageCredential api.
ETag Yes String ETag, short for entity tag, is an information tag that identifies the content of an object when it is created and can be used to check whether the content of the object has changed.
CosHash Yes String Verify the consistency of the uploaded file on the cloud and the local file by validating the crc64 encoding in the cos_hash x-cos-hash-crc64ecma header.
After the COS is successfully uploaded, obtain it from the response header.
Size Yes String File size.
AttrRange No Integer Applicable scope of labels: 1: all; 2: by conditional range.
Source No Integer Source (0: source file import; 1: web page import).
WebUrl No String Web page (or custom link) address.
AttrLabels.N No Array of AttrLabelRefer Label reference.
ReferUrlType No Integer External reference link type: 0: system link; 1: custom link.
When the value is 1, the weburl field cannot be empty; otherwise, it will not take effect.
ExpireStart No String Effective start time, unix timestamp.
ExpireEnd No String Effective end time, unix timestamp. 0 indicates permanent validity.
IsRefer No Boolean Whether to reference a link.
Opt No Integer Document operation type: 1: batch import (import Q&A pairs in batches); 2: document import (normally import a single document). The default value is 1.
Please note that when opt = 1, please download the Excel template from the Tencent Cloud Agent Development Platform/ADP page.
CateBizId No String Category ID.
IsDownload No Boolean
DuplicateFileHandles.N No Array of DuplicateFileHandle
SplitRule No String
UpdatePeriodInfo No UpdatePeriodInfo

3. Output Parameters

Parameter Name Type Description
DocBizId String Document ID.
ErrorMsg String Import error message.
ErrorLink String Error link.
ErrorLinkText String Error link text.
DuplicateFileCheckType Integer
RequestId String The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.

4. Example

Example1

Input Example

POST / HTTP/1.1
Host: lke.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: SaveDoc
<Common request parameters>

{
    "BotBizId": "1727231073371148288",
    "FileName": "test.docx",
    "FileType": "docx",
    "CosUrl": "/corp/23432432/233432/doc/zeSOHIBjwcWoEmlMMXOp-1796022574489010176.docx",
    "ETag": "\"58e88ad7665f11c4f66eba0eada383a5\"",
    "CosHash": "xxxxxxxxx",
    "Size": "643000",
    "Source": 0,
    "WebUrl": "",
    "AttrRange": 1,
    "AttrLabels": [],
    "ReferUrlType": 0
}

Output Example

{
    "Response": {
        "DocBizId": "1694921462777761792",
        "ErrorMsg": "",
        "ErrorLink": "",
        "ErrorLinkText": "",
        "RequestId": "e3338103-3165-49c0-b218-245be865cca5"
    }
}

5. Developer Resources

SDK

TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

Command Line Interface

6. Error Code

The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

Error Code Description
FailedOperation Operation failed.
Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback