Updated on 2025-08-13 GMT+08:00

Modifying Document Directories in Batches

Function

Move knowledge base documents to a specified directory in batches.

URI

PUT /v1/{project_id}/applications/{application_id}/uni-search/{repo_id}/directory/files

Table 1 Path Parameters

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

Table 2 Request header 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

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

file_ids

Yes

Array of strings

Definition:

List of document IDs to be modified.

Constraints:

N/A

Value range:

N/A

Default value:

N/A

directory_id

No

String

Definition:

ID of the directory to which the document is moved. null is allowed, indicating no directory. The value can contain a maximum of 64 characters.

Constraints:

N/A

Value range:

N/A

Default value:

N/A

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

directory_id

String

Definition:

Directory ID.

Value range:

N/A

success_file_ids

Array of strings

Definition:

Number of documents that are successfully modified.

Value range:

N/A

filter_same_category_file_ids

Array of strings

Definition:

Documents whose directories remain unchanged and are filtered out.

Value range:

N/A

filter_exist_file_ids

Array of strings

Definition:

Documents that already exist in the target directory and are filtered out.

Value range:

N/A

filter_not_in_status_file_ids

Array of strings

Definition:

Documents in non-SUCCESS or non-ERROR state that are filtered out. Documents in non-SUCCESS or non-ERROR state cannot be moved.

Value range:

N/A

Example Requests

Move knowledge base documents to a specified directory in batches.

/v1/{project_id}/applications/{application_id}/uni-search/{repo_id}/directory/files

{
  "file_ids" : [ "622f8e93ec50f5ce415afdd670a00527", "61170c6fc8cc84a0f546556ce1956c1a" ],
  "directory_id" : "0b6a2f30-3f66-4e8b-bbeb-5dd8cb56b38ea"
}

Example Responses

Status code: 200

Response to a document directory upgrade request.

{
  "directory_id" : "c327c4d7-6f4c-4b9a-8116-c1222b65d02b",
  "success_file_ids" : [ "8036fcab50cf21f9a1b9a3f80f2f320c", "9a3f96119a766d0087e2d99560d26d80", "3a4bc212ce2761e9a7f71b22507ab68b" ],
  "filter_same_category_file_ids" : [ ],
  "filter_exist_file_ids" : [ ],
  "filter_not_in_status_file_ids" : [ ]
}

Status Codes

Status Code

Description

200

Response to a document directory upgrade request.

Error Codes

See Error Codes.