列出 Webhook 与投递记录

读取端点、订阅事件及最近 100 条投递记录。

GET/api/settings/webhooks
认证
控制台会话 Cookie。
成功状态
200

请求参数

参数类型位置必填说明
statusfailedquery否传入 failed 只返回失败投递,省略时返回所有近期投递。

请求示例

JavaScript 示例可在本站已登录的浏览器中运行。cURL 和 Python 示例读取你本机的 cookies.txt Cookie 文件。请将会话 Cookie 视为私密凭据。

cURL
curl -i -X GET 'https://social2api.com/api/settings/webhooks?status=failed' \
  --cookie ./cookies.txt
Python
from urllib.error import HTTPError
from urllib.request import Request, HTTPCookieProcessor, build_opener
from http.cookiejar import MozillaCookieJar

request = Request(
    "https://social2api.com/api/settings/webhooks?status=failed",
    method="GET",
)
cookies = MozillaCookieJar("./cookies.txt")
cookies.load(ignore_discard=True)
send = build_opener(HTTPCookieProcessor(cookies)).open
try:
    with send(request) as response:
        print(response.status, response.read().decode("utf-8"))
except HTTPError as error:
    print(error.code, error.read().decode("utf-8"))
JavaScript
const response = await fetch("/api/settings/webhooks?status=failed", {
  method: "GET",
  credentials: "same-origin",
});
console.log(response.status, await response.text());

响应

200 · 示例响应
{
  "endpoints": [
    {
      "id": "wh_4a5076aa-f9ab-46e6-b383-7b1374392dc4",
      "url": "https://example.com/webhook",
      "events": [
        "tool_run.finished"
      ],
      "enabled": true,
      "createdAt": "2026-01-15T12:00:00.000Z",
      "updatedAt": "2026-01-15T12:00:00.000Z"
    }
  ],
  "deliveries": [],
  "failedCount": 0,
  "deliveryCount": 1,
  "limit": 10,
  "eventTypes": [
    "tool_run.finished",
    "tool_run.failed",
    "batch.finished",
    "schedule_run.finished",
    "schedule.alert",
    "balance.low",
    "daily_cap.reached"
  ]
}
错误示例
{
  "error": "请先登录。"
}
字段类型说明
endpoints[].idstring端点 ID。
endpoints[].urlURI端点的接收地址。
endpoints[].eventsstring[]订阅的事件类型。
endpoints[].enabledboolean是否开启自动事件投递。
endpoints[].createdAtISO 8601 date-time端点创建时间。
endpoints[].updatedAtISO 8601 date-time端点上次更新时间。
deliveries[].idstring投递记录 ID。
deliveries[].endpointIdstring接收端点 ID。
deliveries[].urlURI投递时使用的端点地址。
deliveries[].eventIdstring事件 ID。同一事件重投时保持一致。
deliveries[].typestring事件类型。测试投递使用 webhook.test。
deliveries[].statusdelivered | failed本次投递结果。
deliveries[].statusCodeinteger | null端点返回的 HTTP 状态。连接失败时为 null。
deliveries[].errorstring | null失败信息。投递成功时为 null。
deliveries[].createdAtISO 8601 date-time投递时间。
failedCountinteger近期记录中的失败数,独立于筛选条件。
deliveryCountinteger近期记录总数,独立于筛选条件。
limitinteger每个账号最多拥有的端点数。
eventTypesstring[]可以订阅的事件类型。

错误状态

HTTP原因与处理
401控制台会话缺失、过期或无效。
405请求方法不受支持。
503此部署未配置该控制台服务。

使用细节

  • 实时取数会触发工具任务、批处理和额度相关事件。定时事件需要独立调度。