跳转到内容
simail文档v0

API 参考

Webhooks

读取 webhook 端点、自定义请求头的名字和投递日志。创建、修改和删除 webhook 只能由人完成。

docs.simail.ai/zh/api/webhooks

webhook 端点由人在控制台里管理。key 可以读取它们。投递如何签名、重试和停用,见 Webhook 指南。

{
"webhook_id": "whk_01JZX4E0F1G2H3J4K5M6N7P8Q9",
"url": "https://example.com/simail-webhook",
"event_types": ["message.received", "thread.locked", "thread.unlocked"],
"status": "enabled",
"created_at": "2026-10-18T16:50:00Z"
}

status 为 enabled、disabled(人停用的)或 auto_disabled(收到 410 或连续失败五天后)。返回对象只有上面这些字段(没有过滤条件,也没有 disabled_reason)。签名密钥永远不会返回。

GET/v0/webhooks
GET/v0/webhooks/{webhook_id}

权限 webhook_read。列表和其他列表一样分页:limit(1-200,默认 50)、page_token、ascending(默认最新在前),响应是 { count, limit, next_page_token?, webhooks }。只有你的 key 看得到的端点才计入 limit。pod 和邮箱变体的分页方式相同。

GET/v0/webhooks/{webhook_id}/headers

权限 webhook_read。返回 { "webhook_id", "header_names": [ … ] }:接收方应当预期的固定请求头名字(webhook-id、webhook-timestamp、webhook-signature 以及对应的 svix-*)。自定义请求头的值加密存储,永远不返回。

GET/v0/webhooks/{webhook_id}/deliveries

权限 webhook_read。每次投递一行(重试时原地更新这一行,attempt 记次数),最新的在前,保留 30 天。分页方式和其他列表相同:

{
"count": 1,
"limit": 50,
"deliveries": [
{ "id": "dlv_…", "webhook_id": "whk_01JZX4E0F1G2H3J4K5M6N7P8Q9", "event_id": "evt_01JZX4F0G1H2J3K4M5N6P7Q8R9", "replay_id": null, "attempt": 1, "status": "succeeded", "http_status": 200, "error": null, "duration_ms": 182, "next_attempt_at": null, "created_at": "2026-10-18T17:02:13Z", "updated_at": "2026-10-18T17:02:13Z" }
]
}

status 为 pending、succeeded、failed(还会重试)、dead(重试已用尽)或 replayed。http_status 是接收方回的 HTTP 状态码(若它回应了)。响应正文从不存储。

POST /v0/webhooks · PATCH /v0/webhooks/{webhook_id} · DELETE /v0/webhooks/{webhook_id} · PATCH /v0/webhooks/{webhook_id}/headers

全部返回 403 human_required。测试、重放和轮换密钥也是控制台操作。这是有意的:能添加端点的 key 就可以把你的全部邮件事件转发到别处。

/v0/inboxes/{inbox_id}/webhooks… 和 /v0/pods/{pod_id}/webhooks… 行为相同,范围限在过滤到那个邮箱或 pod 的端点。

/v0/webhooks/polling 返回 501 not_implemented;请用 GET /v0/events。