Skip to main content
Webhook

更新 Webhook

更新 Webhook 的描述、回调地址或订阅事件。字段缺省表示保持不变。

前提

已完成 Endpoint 与鉴权配置,详见API 总览与认证

接口

PUT /webhook_endpoints/{id}

路径参数

参数必填类型说明
idstringWebhook ID,格式 wep_<ULID>

请求体

字段必填类型说明
descriptionstring | null最长 256 个字符;null 或空字符串表示清空,字段缺省表示保持不变
urlstring新回调地址;传入时重新校验,私网、回环、链路本地和保留地址会被拒绝
eventsarray<string>使用具名事件类型替换整个订阅列表;字段缺省表示保持不变

请求示例

curl -X PUT "$AGENTSTUDIO_URL/webhook_endpoints/wep_01JXX7YQGPRPV1BZXA35QE7WDP" \
  -H "Authorization: Bearer $DASHSCOPE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "description": "生产环境 Agent 与 Session 事件",
    "url": "https://example.com/managedagent/webhooks-v2",
    "events": [
      "agent.updated",
      "session.status_idled"
    ]
  }'

响应

{
  "id": "wep_01JXX7YQGPRPV1BZXA35QE7WDP",
  "description": "生产环境 Agent 与 Session 事件",
  "url": "https://example.com/managedagent/webhooks-v2",
  "events": [
    "agent.updated",
    "session.status_idled"
  ],
  "status": "ACTIVE",
  "disabled_reason": null,
  "consecutive_fail": 2,
  "last_success_at": "2026-08-06T10:05:00Z",
  "last_failure_at": "2026-08-06T10:10:00Z",
  "created_at": "2026-08-06T10:00:00Z",
  "updated_at": "2026-08-06T10:15:00Z",
  "request_id": "8e1d16e4"
}

响应字段

字段类型说明
idstring
descriptionstring | null
urlstring
eventsarray<string>
statusstring
disabled_reasonstring | null
consecutive_failinteger返回更新完成时的当前值
last_success_atstring | null返回更新完成时的当前值
last_failure_atstring | null返回更新完成时的当前值
created_atstring
updated_atstring
request_idstring本次请求的唯一标识,排查问题时附带

错误码

状态码错误码说明
40011800016invalid webhook request
40411800001webhook not found