Delete File

Updated at:

Hard deletes the file metadata and original content; this action cannot be undone. Internal copies already mounted to session sandboxes are not affected; new sessions can no longer mount this file_id.

Prerequisites

Endpoint and authentication configured. For details, see Overview and authentication.

Endpoint

DELETE/files/{file_id}

Path parameters

file_idstringRequired

File ID, format file_<24 alphanumeric characters>

Response fields

request_idstring

Unique identifier for this request

Request example

curl -X DELETE "$AGENTSTUDIO_URL/files/file_xxx" \
  -H "Authorization: Bearer $DASHSCOPE_API_KEY"
import os
import dashscope

client = dashscope.Client(api_key=os.getenv('DASHSCOPE_API_KEY'))

# Delete a file
result = client.files.delete('file-xxx')
print(result.deleted)
client.files().delete("file_xxx");

Response example

{
  "request_id": "xxx"
}