删除文件

更新时间:
复制为 MD 格式

根据文件 ID 永久删除一个文件。删除操作不可逆。

请求头

头部

必选

说明

Authorization

Bearer <PAT>

路径参数

参数

类型

必选

说明

file_id

string

文件唯一标识(file_ 前缀)

示例请求

curl -X DELETE "https://api.qoder.com.cn/api/v1/cloud/files/file_019e3bb8e4b67b7789e49ca6ecb2aae0" \
  -H "Authorization: Bearer $QODER_PAT"

示例响应

HTTP 204 No Content

删除成功时返回 HTTP 204,无响应体。

错误码

HTTP

type

触发条件

401

authentication_error

缺少或无效的认证令牌

404

not_found_error

指定 ID 的文件不存在

错误响应示例:

{
  "type": "error",
  "error": {
    "type": "not_found_error",
    "message": "File 'file_nonexistent123' was not found."
  }
}

注意事项

  • 删除操作是永久性的,无法恢复

  • 删除后,通过列表接口将不再返回该文件

  • 如果文件正在被某个会话引用,删除后会话中对该文件的引用将失效

完整错误信封说明详见 错误参考