跳转到内容
EN

删除环境

DELETE/anthropic/v1/environments/{environment_id}◐ 部分支持

请求参数

  • environment_idstring必填

    path: 环境 ID(路径或查询参数)。

返回

501

删除是归档式软删除:环境被加上删除墓标,GET 返回 404,默认列表与 include_archived=true 列表都不再显示;普通归档不受影响,归档而未删除的环境仍可读取,include_archived=true 仍列出。已存在的会话不受影响,继续使用创建时固定的配置;未归档的智能体引用不阻止删除。内置环境不能删除,返回 409。响应与官方一致:200 与 {id, type:"environment_deleted"}。官方语义是无会话引用时硬删除;平台改为软删除墓标,不永久清除数据。

错误按 Claude Managed Agents 格式返回,参见 错误码

请求示例

curl
curl -X DELETE https://api.deepraxis.com/anthropic/v1/environments/environment_123 \
  -H "x-api-key: $PRAXIS_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "anthropic-beta: managed-agents-2026-04-01"
Python
from anthropic import Anthropic

client = Anthropic(
    base_url="https://api.deepraxis.com/anthropic",
    api_key="$PRAXIS_API_KEY",
)

# 官方有、平台未支持:调用得到 501(not_implemented_error),无副作用。
result = client.beta.delete("environment_123")
print(result)
TypeScript
import Anthropic from "@anthropic-ai/sdk";

const client = new Anthropic({
  baseURL: "https://api.deepraxis.com/anthropic",
  apiKey: "$PRAXIS_API_KEY",
});

// 官方有、平台未支持:调用得到 501(not_implemented_error),无副作用。
const result = await client.beta.delete("environment_123");
console.log(result);

响应示例 501

{
  "type": "error",
  "error": {
    "type": "not_implemented_error",
    "message": "Not implemented: environments cannot be deleted (DELETE /v1/environments/{environment_id}); archive the environment instead with POST /v1/environments/{environment_id}/archive."
  },
  "request_id": "67ea4f2b-e060-4bb8-b382-e85357aa29c7"
}

响应

HTTP 200

Successful response

application/json

名称 类型 说明
id string Environment identifier
type string The type of response