跳转到主要内容
DELETE /api/v1/cloud/environments/{environment_id} 删除 Environment 并返回删除确认。如果该 Environment 仍被 Session 或 tool call 引用,API 会返回 409,此时应改为归档该 Environment。

请求头

头部必选说明
AuthorizationBearer <PAT>

路径参数

参数类型必选说明
environment_idstring环境的唯一标识(前缀为 env_

示例请求

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

示例响应

HTTP 200 OK
{
  "id": "env_019e3bb39b6774d8878cd0b9d237574b",
  "type": "environment_deleted"
}
删除成功通过响应体中的 "type": "environment_deleted" 标识。

错误码

HTTPtype说明
401authentication_error认证失败,PAT 无效或过期
403permission_error无权访问此资源
404not_found_error指定 ID 的环境不存在
409invalid_request_errorEnvironment 仍被 Session 或 tool call 引用
HTTP 404 Not Found
{
  "type": "error",
  "request_id": "cb80235f-76a2-4ff3-9e28-5aa2da12dc14",
  "error": {
    "type": "not_found_error",
    "message": "Environment 'env_does_not_exist_0000000000000000000000000000' was not found."
  }
}
HTTP 409 Conflict
{
  "type": "error",
  "request_id": "cb80235f-76a2-4ff3-9e28-5aa2da12dc14",
  "error": {
    "type": "invalid_request_error",
    "message": "Environment 'env_019e3bb39b6774d8878cd0b9d237574b' is in use and cannot be deleted: 1 session still reference it. Archive the environment instead."
  }
}
完整错误信封格式见错误参考

相关

云端环境

选择 Agent 运行的容器、网络与依赖。