Webhook
Chi tiết lần giao
Một lần giao: mọi lần thử và body đã gửi.
https://api.sangtao.ai/v2/webhooks/deliveries/{deliveryId}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
deliveryIdstringbắt buộcdeliveryId trong đường dẫn.
Response
idstringbắt buộcLần giao, dlv_…
eventIdstringbắt buộcSự kiện, evt_… — giữ nguyên khi gửi lại
eventTypestringbắt buộcVí dụ image.completed
statusstringbắt buộccanceled: endpoint bị xoá hoặc tắt trước khi gửi
Giá trị có thể:
pendingsucceededfailedcanceledattemptCountnumberbắt buộcSố lần đã thử
lastHttpStatusnumber | nullMã URL của bạn trả lần gần nhất
lastErrorstring | nullLý do lần thử gần nhất hỏng
nextAttemptAtstring | nullLần thử lại tiếp theo. Chỉ có khi pending
createdAtstringbắt buộcLúc lần giao vào hàng đợi
completedAtstring | nullLúc kết thúc: succeeded, failed hoặc canceled
attemptsobject[]bắt buộcMọi lần thử, cũ nhất trước
Hiện thuộc tính conẨn thuộc tính con
atstringbắt buộcLúc thử
httpStatusnumber | nullMã URL trả về. null: không kết nối được
durationMsnumberbắt buộcThời gian
responseSnippetstring | null1 KB đầu của nội dung URL trả về
errorstring | nullLỗi mạng hoặc quá thời gian
payloadobjectbắt buộcBody đã gửi, dạng đã phân tích
bodystringbắt buộcBody nguyên văn đã gửi. Kiểm chữ ký bằng trường này, không bằng payload
targetUrlstringwebhookUrl đã gửi tới. Chỉ có ở cách B (lần giao cho webhookUrl của request)
Mã lỗi
| Mã | errorCode | Khi nào |
|---|---|---|
| 404 | DELIVERY_NOT_FOUND | Không có lần giao nào của bạn với id này |
/webhooks/deliveries/{deliveryId}curl "https://api.sangtao.ai/v2/webhooks/deliveries/dlv_5Vt1kRm9P" \
-H "X-Api-Key: YOUR_API_KEY"{
"success": true,
"data": {
"id": "dlv_5Vt1kRm9P",
"eventId": "evt_8Kq2mXa7T",
"eventType": "image.completed",
"status": "succeeded",
"attemptCount": 1,
"lastHttpStatus": 200,
"lastError": null,
"nextAttemptAt": null,
"createdAt": "2026-11-10T09:43:31Z",
"completedAt": "2026-11-10T09:43:32Z",
"attempts": [
{
"at": "2026-11-10T09:43:32Z",
"httpStatus": 200,
"durationMs": 143,
"responseSnippet": "ok",
"error": null
}
],
"payload": {
"id": "evt_8Kq2mXa7T",
"type": "image.completed",
"createdAt": "2026-11-10T09:43:31Z",
"apiVersion": "v2",
"data": {
"jobId": "acff47cbfacf4e27bbc08770c9ea246d",
"status": "complete",
"source": "api"
}
},
"body": "{\"id\":\"evt_8Kq2mXa7T\",\"type\":\"image.completed\",\"createdAt\":\"2026-11-10T09:43:31Z\",\"apiVersion\":\"v2\",\"data\":{\"jobId\":\"acff47cbfacf4e27bbc08770c9ea246d\",\"status\":\"complete\",\"source\":\"api\"}}"
}
}/webhooks/deliveries/{deliveryId}curl "https://api.sangtao.ai/v2/webhooks/deliveries/dlv_5Vt1kRm9P" \
-H "X-Api-Key: YOUR_API_KEY"{
"success": true,
"data": {
"id": "dlv_5Vt1kRm9P",
"eventId": "evt_8Kq2mXa7T",
"eventType": "image.completed",
"status": "succeeded",
"attemptCount": 1,
"lastHttpStatus": 200,
"lastError": null,
"nextAttemptAt": null,
"createdAt": "2026-11-10T09:43:31Z",
"completedAt": "2026-11-10T09:43:32Z",
"attempts": [
{
"at": "2026-11-10T09:43:32Z",
"httpStatus": 200,
"durationMs": 143,
"responseSnippet": "ok",
"error": null
}
],
"payload": {
"id": "evt_8Kq2mXa7T",
"type": "image.completed",
"createdAt": "2026-11-10T09:43:31Z",
"apiVersion": "v2",
"data": {
"jobId": "acff47cbfacf4e27bbc08770c9ea246d",
"status": "complete",
"source": "api"
}
},
"body": "{\"id\":\"evt_8Kq2mXa7T\",\"type\":\"image.completed\",\"createdAt\":\"2026-11-10T09:43:31Z\",\"apiVersion\":\"v2\",\"data\":{\"jobId\":\"acff47cbfacf4e27bbc08770c9ea246d\",\"status\":\"complete\",\"source\":\"api\"}}"
}
}