Webhook
Sửa endpoint
Đổi URL, sự kiện, ghi chú của endpoint, hoặc tắt / bật nó.
PATCH
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.
Body
urlstringURL mới, kiểm như lúc tạo
eventsstring[]Thay cả danh sách
Giá trị có thể:
*image.completedimage.failedvideo.completedvideo.failedpost.publishedpost.failedsocial_account.needs_attentiondescriptionstringTối đa 200 ký tự
enabledbooleanfalse để ngừng gửi. true để bật lại, kể cả khi đang disabled_failing
Chỉ gửi trường cần đổi. Response là cả endpoint.
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 |
| 422 | INVALID_WEBHOOK_URL | url không phải URL https công khai cổng 443, hoặc có kèm tài khoản / mật khẩu |
| 422 | INVALID_WEBHOOK_EVENT | events trống hoặc có loại không tồn tại — các loại hợp lệ ở details[0].params.allowed |
| 422 | VALIDATION_ERROR | description dài quá 200 ký tự |
PATCH
/webhooks/{id}curl -X PATCH "https://api.sangtao.ai/v2/webhooks/whk_4nP8rT2xK" \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"events": [
"*"
]
}'{
"success": true,
"data": {
"id": "whk_4nP8rT2xK",
"url": "https://example.com/webhooks/sangtao",
"events": [
"*"
],
"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
}
}PATCH
/webhooks/{id}curl -X PATCH "https://api.sangtao.ai/v2/webhooks/whk_4nP8rT2xK" \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"events": [
"*"
]
}'{
"success": true,
"data": {
"id": "whk_4nP8rT2xK",
"url": "https://example.com/webhooks/sangtao",
"events": [
"*"
],
"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
}
}