Webhook
Lấy một endpoint
Một endpoint và lần giao gần nhất.
https://api.sangtao.ai/v2/webhooks/{id}Xác thực
X-Api-Keystring · headerbắt buộcAPI key của bạn, tạo ở trang API key trong tài khoản.
Tham số đường dẫn
idstringbắt buộcID trong đường dẫn.
Response
idstringbắt buộcMã endpoint, whk_…
urlstringbắt buộcNơi nhận sự kiện
eventsstring[]bắt buộcCác loại sự kiện endpoint nhận. ["*"] là tất cả
descriptionstring | nullGhi chú của bạn
enabledbooleanbắt buộcCó đang gửi sự kiện tới endpoint không
statusstringbắt buộcdisabled_failing: tự tắt sau 3 ngày giao hỏng liên tục
Giá trị có thể:
activedisableddisabled_failingcreatedAtstringbắt buộcLúc tạo (ISO 8601, UTC). Endpoint chỉ nhận sự kiện xảy ra từ lúc này
lastDeliveryAtstring | nullLần gần nhất thử giao tới endpoint
lastSuccessAtstring | nullLần gần nhất endpoint trả 2xx
lastFailureAtstring | nullLần gần nhất giao hỏng
Mã lỗi
| Mã | errorCode | Khi nào |
|---|---|---|
| 404 | WEBHOOK_NOT_FOUND | Không có endpoint nào của bạn với id này |
/webhooks/{id}curl "https://api.sangtao.ai/v2/webhooks/whk_4nP8rT2xK" \
-H "X-Api-Key: YOUR_API_KEY"{
"success": true,
"data": {
"id": "whk_4nP8rT2xK",
"url": "https://example.com/webhooks/sangtao",
"events": [
"image.completed",
"image.failed"
],
"description": "Production",
"enabled": true,
"status": "active",
"createdAt": "2026-11-10T08:00:00Z",
"lastDeliveryAt": "2026-11-10T09:43:32Z",
"lastSuccessAt": "2026-11-10T09:43:32Z",
"lastFailureAt": null
}
}/webhooks/{id}curl "https://api.sangtao.ai/v2/webhooks/whk_4nP8rT2xK" \
-H "X-Api-Key: YOUR_API_KEY"{
"success": true,
"data": {
"id": "whk_4nP8rT2xK",
"url": "https://example.com/webhooks/sangtao",
"events": [
"image.completed",
"image.failed"
],
"description": "Production",
"enabled": true,
"status": "active",
"createdAt": "2026-11-10T08:00:00Z",
"lastDeliveryAt": "2026-11-10T09:43:32Z",
"lastSuccessAt": "2026-11-10T09:43:32Z",
"lastFailureAt": null
}
}