sangtao.ai
API key

Webhook

Chi tiết lần giao

Một lần giao: mọi lần thử và body đã gửi.

GEThttps://api.sangtao.ai/v2/webhooks/deliveries/{deliveryId}

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

  • deliveryIdstringbắt buộc

    deliveryId trong đường dẫn.

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

  • attemptsobject[]bắt buộc

    Mọi lần thử, cũ nhất trước

    Hiện thuộc tính con
    • atstringbắt buộc

      Lúc thử

    • httpStatusnumber | null

      Mã URL trả về. null: không kết nối được

    • durationMsnumberbắt buộc

      Thời gian

    • responseSnippetstring | null

      1 KB đầu của nội dung URL trả về

    • errorstring | null

      Lỗi mạng hoặc quá thời gian

  • payloadobjectbắt buộc

    Body đã gửi, dạng đã phân tích

  • bodystringbắt buộc

    Body nguyên văn đã gửi. Kiểm chữ ký bằng trường này, không bằng payload

  • targetUrlstring

    webhookUrl đã gửi tới. Chỉ có ở cách B (lần giao cho webhookUrl của request)

Mã lỗi

MãerrorCodeKhi nào
404DELIVERY_NOT_FOUNDKhông có lần giao nào của bạn với id này
GET/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\"}}"
  }
}