DeleteIndexDocument

Updated at:

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.

Debug

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 Resources is 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.

ActionAccess levelResource typeCondition keyDependent action
sfm:DeleteIndexDocumentdelete
*All Resources
*
    None
None

Request syntax

POST /{WorkspaceId}/index/delete_index_document HTTP/1.1

Request parameters

ParameterTypeRequiredDescriptionExample
WorkspaceIdstringYes

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
IndexIdstringYes

The knowledge base ID, which is the Data.Id returned by the CreateIndex operation.

79c0alxxxx
DocumentIdsarrayYes

The list of file IDs.

stringYes

The file ID, which is the FileId returned by the AddFile operation. You can also click the ID icon next to the file name on the Application Data - Files tab to obtain the file ID.

file_5f03dfea56da4050ab68d61871fc4cb3_xxxxxxxx

Response parameters

ElementTypeDescriptionExample
object

Schema of Response

RequestIdstring

The request ID.

17204B98-xxxx-4F9A-8464-2446A84821CA
Codestring

The error code.

Index.InvalidParameter
Messagestring

The error message.

Required parameter(%s) missing or invalid, please check the request parameters.
Successboolean

Indicates whether the operation call is successful. Valid values:

  • true: The operation was successful.
  • false: The operation failed.
true
Dataobject

The business data field returned by the operation.

DeletedDocumentarray

The list of file IDs that have been successfully deleted.

deletedstring

The file ID.

file_5f03dfea56da4050ab68d61871fc4cb3_xxxxxxxx
Statusstring

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.