CropPath cho nhà phát triển

Tài liệu API

Sự kiện webhook

Nội dung CropPath gửi (POST) tới endpoint đã đăng ký cho từng loại sự kiện.

lot.sealed

lot.sealed (sent to the partner)

Every delivery is a POST of application/json to the subscription's URL with the Standard Webhooks headers webhook-id (the event id, the same on every attempt: deduplicate on it, delivery is at least once), webhook-timestamp (Unix seconds of this attempt) and webhook-signature (v1, + base64 of HMAC-SHA256 over {webhook-id}.{webhook-timestamp}.{body}, keyed with the base64-decoded part of the secret after whsec_). Verify the signature over the raw body with a constant-time comparison and refuse a timestamp more than 300 seconds from your clock. Answer 2xx within 10 seconds; any other answer (a redirect is not followed) or none is a failed attempt, retried with exponential backoff (1 minute doubling, at most 6 hours) for 12 attempts (about 21 hours). 50 failed attempts in a row disable the subscription.

Nội dung yêu cầu

WebhookEventLotSealed (bắt buộc)

Kiểu nội dung: application/json

Ví dụ yêu cầu · application/json
{
  "id": "evt_6f1c2d3e4a5b46c7889900aabbccddee",
  "type": "lot.sealed",
  "created_at": "2026-10-01T05:30:00.000Z",
  "tenant": "coop-dl",
  "data": {
    "lot": "LO-260928-014",
    "public_id": "9f86d081884c7d659a2feaa0c55ad015",
    "facility": "VN-TGPH-021",
    "sealed_at": "2026-09-28T10:15:00.000Z",
    "manifest_sha256": "2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae",
    "fruit_count": 128,
    "event_count": 260
  }
}

lot.recalled

lot.recalled (sent to the partner)

Every delivery is a POST of application/json to the subscription's URL with the Standard Webhooks headers webhook-id (the event id, the same on every attempt: deduplicate on it, delivery is at least once), webhook-timestamp (Unix seconds of this attempt) and webhook-signature (v1, + base64 of HMAC-SHA256 over {webhook-id}.{webhook-timestamp}.{body}, keyed with the base64-decoded part of the secret after whsec_). Verify the signature over the raw body with a constant-time comparison and refuse a timestamp more than 300 seconds from your clock. Answer 2xx within 10 seconds; any other answer (a redirect is not followed) or none is a failed attempt, retried with exponential backoff (1 minute doubling, at most 6 hours) for 12 attempts (about 21 hours). 50 failed attempts in a row disable the subscription.

Nội dung yêu cầu

WebhookEventLotRecalled (bắt buộc)

Kiểu nội dung: application/json

Ví dụ yêu cầu · application/json
{
  "id": "evt_6f1c2d3e4a5b46c7889900aabbccddee",
  "type": "lot.recalled",
  "created_at": "2026-10-01T05:30:00.000Z",
  "tenant": "coop-dl",
  "data": {
    "lot": "LO-260928-014",
    "public_id": "9f86d081884c7d659a2feaa0c55ad015",
    "kind": "recall",
    "reason": "contamination",
    "scope": "consumer",
    "recalled_at": "2026-10-02T03:00:00.000Z",
    "cartons": 41,
    "shipments": 1
  }
}

lot.withdrawn

lot.withdrawn (sent to the partner)

Every delivery is a POST of application/json to the subscription's URL with the Standard Webhooks headers webhook-id (the event id, the same on every attempt: deduplicate on it, delivery is at least once), webhook-timestamp (Unix seconds of this attempt) and webhook-signature (v1, + base64 of HMAC-SHA256 over {webhook-id}.{webhook-timestamp}.{body}, keyed with the base64-decoded part of the secret after whsec_). Verify the signature over the raw body with a constant-time comparison and refuse a timestamp more than 300 seconds from your clock. Answer 2xx within 10 seconds; any other answer (a redirect is not followed) or none is a failed attempt, retried with exponential backoff (1 minute doubling, at most 6 hours) for 12 attempts (about 21 hours). 50 failed attempts in a row disable the subscription.

Nội dung yêu cầu

WebhookEventLotWithdrawn (bắt buộc)

Kiểu nội dung: application/json

Ví dụ yêu cầu · application/json
{
  "id": "evt_6f1c2d3e4a5b46c7889900aabbccddee",
  "type": "lot.withdrawn",
  "created_at": "2026-10-01T05:30:00.000Z",
  "tenant": "coop-dl",
  "data": {
    "lot": "LO-260928-014",
    "public_id": "9f86d081884c7d659a2feaa0c55ad015",
    "kind": "withdrawal",
    "reason": "contamination",
    "scope": "consumer",
    "recalled_at": "2026-10-02T03:00:00.000Z",
    "cartons": 41,
    "shipments": 1
  }
}

lab_result.recorded

lab_result.recorded (sent to the partner)

Every delivery is a POST of application/json to the subscription's URL with the Standard Webhooks headers webhook-id (the event id, the same on every attempt: deduplicate on it, delivery is at least once), webhook-timestamp (Unix seconds of this attempt) and webhook-signature (v1, + base64 of HMAC-SHA256 over {webhook-id}.{webhook-timestamp}.{body}, keyed with the base64-decoded part of the secret after whsec_). Verify the signature over the raw body with a constant-time comparison and refuse a timestamp more than 300 seconds from your clock. Answer 2xx within 10 seconds; any other answer (a redirect is not followed) or none is a failed attempt, retried with exponential backoff (1 minute doubling, at most 6 hours) for 12 attempts (about 21 hours). 50 failed attempts in a row disable the subscription.

Nội dung yêu cầu

WebhookEventLabResultRecorded (bắt buộc)

Kiểu nội dung: application/json

Ví dụ yêu cầu · application/json
{
  "id": "evt_6f1c2d3e4a5b46c7889900aabbccddee",
  "type": "lab_result.recorded",
  "created_at": "2026-10-01T05:30:00.000Z",
  "tenant": "coop-dl",
  "data": {
    "lot": "LO-260928-014",
    "sampling_id": 12,
    "lab": "LAB-VN-118",
    "report_no": "KN-LO-260928-014",
    "market": "CN",
    "signed_at": "2026-09-29T02:00:00.000Z",
    "passed": true
  }
}

shipment.departed

shipment.departed (sent to the partner)

Every delivery is a POST of application/json to the subscription's URL with the Standard Webhooks headers webhook-id (the event id, the same on every attempt: deduplicate on it, delivery is at least once), webhook-timestamp (Unix seconds of this attempt) and webhook-signature (v1, + base64 of HMAC-SHA256 over {webhook-id}.{webhook-timestamp}.{body}, keyed with the base64-decoded part of the secret after whsec_). Verify the signature over the raw body with a constant-time comparison and refuse a timestamp more than 300 seconds from your clock. Answer 2xx within 10 seconds; any other answer (a redirect is not followed) or none is a failed attempt, retried with exponential backoff (1 minute doubling, at most 6 hours) for 12 attempts (about 21 hours). 50 failed attempts in a row disable the subscription.

Nội dung yêu cầu

WebhookEventShipmentDeparted (bắt buộc)

Kiểu nội dung: application/json

Ví dụ yêu cầu · application/json
{
  "id": "evt_6f1c2d3e4a5b46c7889900aabbccddee",
  "type": "shipment.departed",
  "created_at": "2026-10-01T05:30:00.000Z",
  "tenant": "coop-dl",
  "data": {
    "shipment": "SH-LO-260928-014",
    "facility": "VN-TGPH-021",
    "container": "MSKU1234565",
    "border_gate": "Hữu Nghị",
    "destination": "CN",
    "departed_at": "2026-09-29T09:00:00.000Z",
    "lots": [
      "LO-260928-014"
    ]
  }
}

lot.trust_tier_changed

lot.trust_tier_changed (sent to the partner)

Every delivery is a POST of application/json to the subscription's URL with the Standard Webhooks headers webhook-id (the event id, the same on every attempt: deduplicate on it, delivery is at least once), webhook-timestamp (Unix seconds of this attempt) and webhook-signature (v1, + base64 of HMAC-SHA256 over {webhook-id}.{webhook-timestamp}.{body}, keyed with the base64-decoded part of the secret after whsec_). Verify the signature over the raw body with a constant-time comparison and refuse a timestamp more than 300 seconds from your clock. Answer 2xx within 10 seconds; any other answer (a redirect is not followed) or none is a failed attempt, retried with exponential backoff (1 minute doubling, at most 6 hours) for 12 attempts (about 21 hours). 50 failed attempts in a row disable the subscription.

Nội dung yêu cầu

WebhookEventLotTrustTierChanged (bắt buộc)

Kiểu nội dung: application/json

Ví dụ yêu cầu · application/json
{
  "id": "evt_6f1c2d3e4a5b46c7889900aabbccddee",
  "type": "lot.trust_tier_changed",
  "created_at": "2026-10-01T05:30:00.000Z",
  "tenant": "coop-dl",
  "data": {
    "lot": "LO-260928-014",
    "public_id": "9f86d081884c7d659a2feaa0c55ad015",
    "tier": "self_declared",
    "previous_tier": "cross_checked",
    "status": "on_hold",
    "changed_at": "2026-10-01T05:30:00.000Z"
  }
}

report.filed

report.filed (sent to the partner)

Every delivery is a POST of application/json to the subscription's URL with the Standard Webhooks headers webhook-id (the event id, the same on every attempt: deduplicate on it, delivery is at least once), webhook-timestamp (Unix seconds of this attempt) and webhook-signature (v1, + base64 of HMAC-SHA256 over {webhook-id}.{webhook-timestamp}.{body}, keyed with the base64-decoded part of the secret after whsec_). Verify the signature over the raw body with a constant-time comparison and refuse a timestamp more than 300 seconds from your clock. Answer 2xx within 10 seconds; any other answer (a redirect is not followed) or none is a failed attempt, retried with exponential backoff (1 minute doubling, at most 6 hours) for 12 attempts (about 21 hours). 50 failed attempts in a row disable the subscription.

Nội dung yêu cầu

WebhookEventReportFiled (bắt buộc)

Kiểu nội dung: application/json

Ví dụ yêu cầu · application/json
{
  "id": "evt_6f1c2d3e4a5b46c7889900aabbccddee",
  "type": "report.filed",
  "created_at": "2026-10-01T05:30:00.000Z",
  "tenant": "coop-dl",
  "data": {
    "report_id": 5,
    "lot": "LO-260928-014",
    "fruit": "Q-14-37",
    "category": "ripeness_off",
    "filed_at": "2026-10-01T05:29:58.000Z"
  }
}