Skip to main content
File

Delete file

Delete a file by its ID.

DELETE
/files/{file_id}
Python
import os
from openai import OpenAI

client = OpenAI(
  api_key=os.getenv("DASHSCOPE_API_KEY"),
  base_url="https://dashscope-intl.aliyuncs.com/compatible-mode/v1",
)

result = client.files.delete(
  "file-batch-xxx"
)
print(result.model_dump_json())
{
  "object": "file",
  "deleted": true,
  "id": "file-batch-xxx"
}

Authorizations

string
header
required

Qwen Cloud API Key. Create one in the console.

Path Parameters

string
required

The ID of the file to delete.

file-batch-xxx

Response

200-application/json
enum<string>

Always file.

file
boolean

Whether the deletion succeeded.

string

The deleted file's ID.

file-batch-xxx