Add a File Document
Adds a file document to the knowledge base. Upload the file to the resource service to obtain a resource ID first.
Request URL
POST {base_url}/uc-ai/api/v1/knowledge-base/documents/files
Request parameters
- Headers
-
Parameter Required Type Description Authorization Yes String The access token used for authentication. Format: Bearer
{access_token}.x-tenant-code Yes String The tenant name. Note: You can obtain tenant name using the Query Tenants interface.
- Body parameters
-
Parameter Required Type Description resourceId Yes Integer The file resource ID returned by the resource service. Upload the file through the resource service to obtain this ID first. name No String The name of the document, with a maximum length of 64 bytes. When this parameter is empty, the original file name of the resource is used.
Response parameters
| Parameter | Type | Description |
|---|---|---|
| requestId | String | The unique ID of the request, which can be used to quickly locate the request. |
| code | String | The HTTP status code of the request.
|
| message | String | The status message of the request. |
| detailMessage | String | The detailed error information. When the request is successful, this parameter returns empty. |
| result | Object<Document> | The added file document. |
- Document
-
Parameter Type Description id String The ID of the document. documentId String The internal document ID of the knowledge base. name String The name of the document. type String The type of the document:
FILE: A file.URL: A web page link.TEXT: A text.
fileSize Integer The size of the document file, in bytes. This parameter is returned for URL documents. ragStatus String The parsing status of the document in the knowledge base, such as PARSING. createTime String The creation time, in Unix timestamp format (milliseconds). updateTime String The last update time, in Unix timestamp format (milliseconds).