Uploading Documents
Function
This API is used to upload a file to a knowledge base.
URI
POST /v1/{project_id}/applications/{application_id}/uni-search/{repo_id}/files
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Definition: Project ID. For details about how to obtain the project ID, see Obtaining a Project ID. Constraints: N/A Value range: The value can contain 1 to 64 characters. Only digits, letters, hyphens (-), and underscores (_) are allowed. The value must start with a letter. Default value: N/A |
application_id |
Yes |
String |
Definition: Application ID. For details about how to obtain the application ID, see Obtaining an Application ID. Constraints: Character string Value range: The value can contain 1 to 64 characters. Only digits, letters, hyphens (-), and underscores (_) are allowed. The value must start with a letter. Default value: N/A |
repo_id |
Yes |
String |
Definition: Knowledge base ID. How to obtain: Log in to the KooSearch experience platform. In the navigation tree on the left, choose Knowledge Bases to view knowledge base IDs. Each knowledge base has a unique ID stored in the vector database. Constraints: N/A Value range: Length: 1 to 64 characters. The value can contain only digits, letters, hyphens (-), and underscores (_). Default value: N/A |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
Yes |
String |
Definition: Token used for API authentication. For details about how to obtain the token, see Obtaining an IAM User Token. Constraints: N/A Value range: N/A Default value: N/A |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
file |
Yes |
File |
Definition: File to be uploaded. Constraints: Supported document formats are as follows: .doc, .docx, .pdf, .pptx, .ppt, .xlsx, .xls, .csv, .wps, .png, .jpg, .jpeg, .bmp, .gif, .tiff, .tif, .webp, .pcx, .ico, .psd, .dps, .et, .txt, .ofd, .md. Multiple documents can be uploaded at once. The size of each single document cannot exceed 128 MB. (Upload a document through an API if its size exceeds 60 MB.) Value range: N/A Default value: N/A |
category |
No |
String |
Definition: Document directory, which corresponds to the leaf nodes in the directory tree. This parameter has only one value. The recommended format is "leaf node directory name (directory ID)", for example, patent (3166-1). Constraints: N/A Value range: N/A Default value: N/A |
tags |
No |
Array of strings |
Definition: Document tags. You can use tags to automatically group documents for filtering. Constraints: In 25.2.T1, the following special characters are allowed in URLs: :/.?&=@#%+~!$'(),;*[] Precautions:
Value range: The value can contain 1 to 255 characters. It can only contain letters, digits, and the following special characters: : - _ / . ? & = @ # / %+ ~ ! $ ' ( ) , ; *[]. The value must start with a letter or digit. Default value: N/A |
file_extract_req |
No |
String |
Definition: Document-level parsing parameters. For details, see FileExtractTaskReq. Example {"mode":1,"language":"CHINESE","parse_conf":{"ocr_enabled":true," mllm_model":"mllm6","image_enabled":true,"image_conf":"IMAGE","header_footer_enabled":false," footnote_enabled":false,"catalog_enabled":false},"split_conf":{"split_mode":"RULE","chunk_size":500,"separators":[". ",".","! ","!","? ","?"],"title_level":3,"combine_title":true,"merge_titles":true,"rule_regexs":["^Chapter ([1-9]{1,7})","^Section ([1-9]{1,7}),"^Clause([1-9]{1,7})"]}}. Constraints: For details about the structure, see FileExtractTaskReq. Value range: N/A Default value: N/A |
chat_id |
No |
String |
Definition: Chat ID. Constraints: N/A Value range: The maximum length is 64 characters. Default value: N/A |
Response Parameters
Status code: 201
Parameter |
Type |
Description |
---|---|---|
file_id |
String |
Definition: Document ID. Value range: N/A |
Status code: 400
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Definition: Value range: N/A |
error_msg |
String |
Definition: Error message. Value range: N/A |
Status code: 500
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Definition: Value range: N/A |
error_msg |
String |
Definition: Error message. Value range: N/A |
Example Requests
Upload documents to a knowledge base.
/v1/b25446daeb1a41a7953c5deba2b2677a/applications/0ac621de-3624-454e-adcf-8c5b4cf7317c/uni-search/111/files
Example Responses
Status code: 201
Response body of the API for uploading documents.
{ "file_id" : "5c46f7e31c5c4587ac99ef0da0502470" }
Status Codes
Status Code |
Description |
---|---|
201 |
Response body of the API for uploading documents. |
400 |
Incorrect request body parameter. |
500 |
Internal error. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot