DeleteIndexDocument
Permanently deletes files from a specified knowledge base.
Operation description
- This operation does not support deleting data from data query or image Q&A knowledge bases. Use the Alibaba Cloud Model Studio console instead.
- RAM users (sub-accounts) must first obtain the API permissions for Alibaba Cloud Model Studio (requiring AliyunBailianDataFullAccess, which includes the sfm:DeleteIndexDocument permission) before they can call this operation. Alibaba Cloud accounts (primary accounts) can call this operation directly without authorization. We recommend that you call this operation by using the latest version of the Alibaba Cloud Model Studio SDK.
- Before you call this operation, make sure that your knowledge base has been created and is not deleted (that is, the knowledge base ID IndexId is valid).
- You can only delete files whose status is import failed (INSERT_ERROR) or import succeeded (FINISH) in the knowledge base. To query the status of files in a specified knowledge base, call the ListIndexDocuments operation.
- The delete operation is irreversible. The content of deleted files cannot be recovered, and the Retrieve operation can no longer obtain related information. Proceed with caution.
- Calling this operation does not delete documents that have been imported into application data.
- This operation is idempotent.
Throttling: This operation is throttled if it is called frequently. Do not exceed 10 calls per second. If you are throttled, retry later.
Debug
You can run this API directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After the run succeeds, OpenAPI Explorer can automatically generate SDK code examples.
Authorization information
The following table describes the authorization information of the API. You can use it in the Action element of a RAM policy statement to grant RAM users or RAM roles the permission to call this API. Details:
-
Action: the specific permission point.
-
Access level: the access level of each operation. Valid values: Write, Read, or List.
-
Resource type: the resource types that support authorization for the operation. Details:
- For required resource types, an asterisk (*) is prefixed.
- For operations that do not support resource-level authorization,
All Resourcesis used.
-
Condition key: the condition keys defined by the cloud service itself.
-
Dependent action: other permissions required to successfully perform the operation. The caller must have the permissions of all dependent actions for the operation to succeed.
| Action | Access level | Resource type | Condition key | Dependent action |
|---|---|---|---|---|
| sfm:DeleteIndexDocument | delete | *All Resources * |
| None |
Request syntax
POST /{WorkspaceId}/index/delete_index_document HTTP/1.1
Request parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
| WorkspaceId | string | Yes | The ID of the workspace to which the knowledge base belongs. For information about how to obtain the workspace ID, see How to use workspaces. | llm-3z7uw7fwz0vxxxx |
| IndexId | string | Yes | The knowledge base ID, which is the | 79c0alxxxx |
| DocumentIds | array | Yes | The list of file IDs. | |
| string | Yes | The file ID, which is the | file_5f03dfea56da4050ab68d61871fc4cb3_xxxxxxxx |
Response parameters
| Element | Type | Description | Example |
|---|---|---|---|
| object | Schema of Response | ||
| RequestId | string | The request ID. | 17204B98-xxxx-4F9A-8464-2446A84821CA |
| Code | string | The error code. | Index.InvalidParameter |
| Message | string | The error message. | Required parameter(%s) missing or invalid, please check the request parameters. |
| Success | boolean | Indicates whether the operation call is successful. Valid values:
| true |
| Data | object | The business data field returned by the operation. | |
| DeletedDocument | array | The list of file IDs that have been successfully deleted. | |
| deleted | string | The file ID. | file_5f03dfea56da4050ab68d61871fc4cb3_xxxxxxxx |
| Status | string | The status code returned by the operation. | 200 |
Examples
Success response
JSON format
{
"RequestId": "17204B98-xxxx-4F9A-8464-2446A84821CA",
"Code": "Index.InvalidParameter",
"Message": "Required parameter(%s) missing or invalid, please check the request parameters.",
"Success": true,
"Data": {
"DeletedDocument": [
"file_5f03dfea56da4050ab68d61871fc4cb3_xxxxxxxx"
]
},
"Status": 200
}
Error codes
Visit the Error Center to view more error codes.