Skip to main content

DeleteFile

Permanently delete a specified file from application data. Deleting data tables via API is not supported. For details, see the API Guide below.

Operation description

  • The API does not support deleting data tables. Open Collections and click Details for the target table dataset. Delete the target table or the selected data in the table.
  • This API is used to delete files in Collections and does not affect the knowledge bases that have already been built. To delete a file from a knowledge base, call the DeleteIndexDocument API.
  • A RAM user (sub-account) must first obtain the API permissions for Alibaba Cloud Model Studio (requiring AliyunBailianDataFullAccess, which includes the sfm:DeleteFile permission point) and join a workspace before calling this API. An Alibaba Cloud account (primary account) can call this API directly without authorization. We recommend that you call this API by using the latest version of the Alibaba Cloud Model Studio SDK.
  • This API can only delete files whose status is parse failed (PARSE_FAILED) or parse succeeded (PARSE_SUCCESS).
  • This API is idempotent.
Rate limit notice: Frequent calls to this API are subject to rate limiting. Do not call this API more than 10 times per second. If rate limited, retry after a short wait.

Debug

You can run this API directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After a successful run, 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 are as follows:
  • Action: refers to the specific permission point.
  • Access level: refers to the access level of each operation. Valid values: Write, Read, or List.
  • Resource type: refers to the resource types that support authorization for the operation. Details are as follows:
    • For required resource types, an asterisk (*) is added as a prefix.
    • For operations that do not support resource-level authorization, All Resources is used.
  • Condition key: refers to the condition keys defined by the cloud service itself.
  • Dependent action: refers to 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:DeleteFile

delete

*All Resources

*

NoneNone

Request syntax

DELETE /{WorkspaceId}/datacenter/file/{FileId}/ HTTP/1.1

Path parameters

Name

Type

Required

Description

Example value

FileId

string

Yes

The file ID, which is the FileId returned by the AddFile API. Open Collections and click Details for the target file dataset. Click the ID icon next to the file name, then click the copy icon to copy the file ID.

file_9a65732555b54d5ea10796ca5742ba22_xxxxxxxx

WorkspaceId

string

Yes

The ID of the workspace to which the file belongs. For more information, see How to use workspaces.

llm-3shx2gu255oxxxx

Request parameters

Name

Type

Required

Description

Example value

This API does not require any request parameters.

Response parameters

Name

Type

Description

Example value

object

Schema of Response

Code

string

The error status code.

InvalidParameter

Data

object

The business data field of the API response.

FileId

string

The file ID.

file_9a65732555b54d5ea10796ca5742ba22_xxxxxxxx

Message

string

The error message.

Current file status does not support delete.

RequestId

string

The request ID.

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

Status

string

The status code returned by the API.

200

Success

boolean

Indicates whether the API call succeeded. Valid values:

  • true: Succeeded.

  • false: Failed.

true

Examples

Success response JSON format
{
  "Code": "InvalidParameter",
  "Data": {
    "FileId": "file_9a65732555b54d5ea10796ca5742ba22_xxxxxxxx"
  },
  "Message": "Current file status does not support delete.",
  "RequestId": "17204B98-xxxx-4F9A-8464-2446A84821CA",
  "Status": "200",
  "Success": true
}

Error codes

Visit Error Center to view more error codes.

Release notes

For more information, see Change details.