All Products
Search
Document Center

Alibaba Cloud Model Studio:DeleteIndexDocument

Last Updated:Jun 12, 2026

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 Model Studio console instead.

  • Resource Access Management (RAM) users must first obtain API permissions for Model Studio (requiring AliyunBailianDataFullAccess, which includes the sfm:DeleteIndexDocument permission), before calling this operation. Alibaba Cloud accounts can call this operation directly without authorization. Use the latest Model Studio SDK to call this operation.

  • Before calling this operation, make sure that your knowledge base has been created and has not been 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 file status in a specified knowledge base, call the ListIndexDocuments operation.

  • Deletion is irreversible. The content of deleted files cannot be recovered, and the Retrieve operation can no longer retrieve 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 called too frequently. Do not exceed 10 calls per second. If you are throttled, retry later.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

sfm:DeleteIndexDocument

delete

*All Resource

*

None None

Request syntax

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

Path 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 a workspace.

llm-3z7uw7fwz0vxxxx

Request parameters

Parameter

Type

Required

Description

Example

IndexId

string

Yes

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

79c0alxxxx

DocumentIds

array

Yes

The list of file IDs.

string

No

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

file_5f03dfea56da4050ab68d61871fc4cb3_xxxxxxxx

Response elements

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 was successful. Valid values:

  • true: The operation was successful.

  • false: The operation failed.

true

Data

object

The business data field returned by the operation.

DeletedDocument

array

The list of successfully deleted file IDs.

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

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.