sangtao.ai
API key

Webhook

Gửi lại lần giao

Gửi lại sự kiện của một lần giao.

POSThttps://api.sangtao.ai/v2/webhooks/{id}/deliveries/{deliveryId}/retry

Xác thực

  • X-Api-Keystring · headerbắt buộc

    API key của bạn, tạo ở trang API key trong tài khoản.

Tham số đường dẫn

  • idstringbắt buộc

    ID trong đường dẫn.

  • deliveryIdstringbắt buộc

    deliveryId trong đường dẫn.

Xếp lại cùng sự kiện vào hàng gửi, bất kể lần giao đang ở trạng thái nào: lần giao mới (dlv_… mới), cùng mã sự kiện — nên khử trùng vẫn đúng.

Response

  • idstringbắt buộc

    Lần giao, dlv_…

  • eventIdstringbắt buộc

    Sự kiện, evt_… — giữ nguyên khi gửi lại

  • eventTypestringbắt buộc

    Ví dụ image.completed

  • statusstringbắt buộc

    canceled: endpoint bị xoá hoặc tắt trước khi gửi

    Giá trị có thể:pendingsucceededfailedcanceled

  • attemptCountnumberbắt buộc

    Số lần đã thử

  • lastHttpStatusnumber | null

    Mã URL của bạn trả lần gần nhất

  • lastErrorstring | null

    Lý do lần thử gần nhất hỏng

  • nextAttemptAtstring | null

    Lần thử lại tiếp theo. Chỉ có khi pending

  • createdAtstringbắt buộc

    Lúc lần giao vào hàng đợi

  • completedAtstring | null

    Lúc kết thúc: succeeded, failed hoặc canceled

Trả 202, status pending.

Mã lỗi

MãerrorCodeKhi nào
404WEBHOOK_NOT_FOUNDKhông có endpoint nào của bạn với id này
404DELIVERY_NOT_FOUNDKhông có lần giao này ở endpoint đó
409WEBHOOK_DISABLEDEndpoint đang tắt — PATCH enabled: true trước
POST/webhooks/{id}/deliveries/{deliveryId}/retry
curl -X POST "https://api.sangtao.ai/v2/webhooks/whk_4nP8rT2xK/deliveries/dlv_5Vt1kRm9P/retry" \
  -H "X-Api-Key: YOUR_API_KEY"
{
  "success": true,
  "data": {
    "id": "dlv_9Rx3qTa6M",
    "eventId": "evt_8Kq2mXa7T",
    "eventType": "image.completed",
    "status": "pending",
    "attemptCount": 0,
    "lastHttpStatus": null,
    "lastError": null,
    "nextAttemptAt": "2026-11-10T10:00:00Z",
    "createdAt": "2026-11-10T10:00:00Z",
    "completedAt": null
  }
}