> For the complete documentation index, see [llms.txt](https://docs.terminal.africa/tship/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.terminal.africa/tship/miscallaneous/sample-webhook-event-payloads/shipment.md).

# Shipment

Sample payloads for every shipment webhook event.

Shipment-related webhook payloads come in four shapes, including connected-account weight discrepancy detections. Which one you get depends on the event.

<table><thead><tr><th width="260">Events</th><th>Payload</th></tr></thead><tbody><tr><td><em>shipment.tracking_updated</em>, <em>shipment.updated</em>, <em>shipment.in-transit</em>, <em>shipment.delivered</em>, <em>shipment.cancelled</em>, <em>shipment.returned</em>, <em>shipment.awaiting-clearance</em>, <em>shipment.pending-cancellation</em></td><td>A lean <strong>tracking snapshot</strong>.</td></tr><tr><td><em>shipment.created</em></td><td>A fuller shipment object.</td></tr><tr><td><em>shipment.customs_event</em></td><td>A small customs-delay object.</td></tr><tr><td><em>connected_account.weight_discrepancy.detected</em></td><td>A connected-account weight discrepancy detection summary.</td></tr></tbody></table>

## Connected-account weight discrepancy detection

`connected_account.weight_discrepancy.detected` is sent when Terminal detects a qualifying increase over the booked chargeable weight of a delivered shipment processed through your connected carrier account. It carries a detection summary rather than the usual shipment tracking snapshot. Although the event is in the connected-account namespace, it describes one shipment: use `shipment_id` for simulation, delivery-history queries and shipment-based replay.

### Enable monitoring and subscribe

Weight discrepancy detection must be enabled on an active, supported connected account. Supported integrations are FedEx (`fedex`) and DHL Nigeria (`dhl-ng`); availability still depends on activation for the individual connection. Manage it in [Settings → Carriers](https://dashboard.terminal.africa/settings). Eligible shipments must have been processed through Terminal, delivered on or after activation, and have sufficient carrier measurements for all parcels. Shipments delivered before activation are excluded.

To receive webhook alerts, an **active webhook must explicitly subscribe to `connected_account.weight_discrepancy.detected`**. Existing subscriptions are not automatically expanded. See [Create Webhook](/tship/webhooks/create-webhook.md#add-the-event-to-an-existing-webhook) for an example of updating your subscription.

Enabling monitoring and subscribing to a webhook are separate: monitoring can send email alerts and incur the detection fee without a webhook subscription, and subscribing to the event does not enable monitoring. Adding a subscription does not automatically send past detections.

### Example payload

The identifiers and tracking number below are illustrative.

```json
{
  "event": "connected_account.weight_discrepancy.detected",
  "data": {
    "detection_id": "WD-SH-EXAMPLE000001",
    "shipment_id": "SH-EXAMPLE000001",
    "tracking_number": "123456789012",
    "carrier": {
      "carrier_id": "CA-EXAMPLE000001",
      "slug": "fedex",
      "name": "FedEx"
    },
    "personal_account_id": "PA-EXAMPLE000001",
    "declared_weight": 2,
    "actual_weight": 3,
    "discrepancy_weight": 1,
    "weight_unit": "kg",
    "source": "delivery_tracking",
    "invoice_verification_required": true,
    "detected_at": "2026-11-04T08:00:00.000Z",
    "parcel_measurements": {
      "source": "delivery_tracking",
      "observed_at": "2026-11-04T08:00:00.000Z",
      "dimension_unit": "cm",
      "weight_unit": "kg",
      "booked": [
        {
          "parcel_number": 1,
          "parcel_id": "PC-EXAMPLE000001",
          "dimensions": {
            "length": 20,
            "width": 20,
            "height": 20
          },
          "physical_weight": 2,
          "volumetric_weight": 1.6,
          "chargeable_weight": 2
        }
      ],
      "carrier": [
        {
          "parcel_number": 1,
          "tracking_number": "123456789012",
          "dimensions": {
            "length": 30,
            "width": 25,
            "height": 20
          },
          "physical_weight": 2.5,
          "volumetric_weight": 3,
          "chargeable_weight": 3
        }
      ]
    },
    "fee": {
      "amount": 0.02,
      "currency": "USD",
      "transaction_id": "TR-EXAMPLE000001"
    }
  }
}
```

### Payload fields

| Field in `data`                 | Meaning                                                                                                                                                                                                                          |
| ------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `detection_id`                  | Stable detection reference, `WD-<shipment_id>`. Use it to deduplicate repeated deliveries and replays.                                                                                                                           |
| `shipment_id`                   | Terminal shipment reference.                                                                                                                                                                                                     |
| `tracking_number`               | Carrier tracking number; it may be empty or withheld by tracking-release rules.                                                                                                                                                  |
| `carrier`                       | Carrier reference, slug and display name.                                                                                                                                                                                        |
| `personal_account_id`           | Terminal reference for the connected account, not the carrier account number. No carrier credentials or full account number are included.                                                                                        |
| `declared_weight`               | Booked chargeable comparison weight.                                                                                                                                                                                             |
| `actual_weight`                 | Carrier chargeable comparison weight derived from delivery tracking. This can include dimensional weight; it is not necessarily scale weight.                                                                                    |
| `discrepancy_weight`            | Positive difference between `actual_weight` and `declared_weight`, meeting the detection threshold.                                                                                                                              |
| `weight_unit`                   | `kg` for all three weight fields.                                                                                                                                                                                                |
| `source`                        | `delivery_tracking`.                                                                                                                                                                                                             |
| `invoice_verification_required` | `true`: verify the weight and any resulting carrier charges on your carrier invoice.                                                                                                                                             |
| `parcel_measurements`           | Optional saved comparison of booked and carrier dimensions, physical weight, volumetric weight and chargeable weight. See [Parcel measurement fields](/tship/miscallaneous/reconciliation-shipment-data.md#parcel-measurements). |
| `detected_at`                   | Time the detection was recorded, as an ISO 8601 timestamp.                                                                                                                                                                       |
| `fee.amount`, `fee.currency`    | Terminal's detection service fee: `0.02` `USD` per detected shipment, separate from any carrier adjustment charge.                                                                                                               |
| `fee.transaction_id`            | Related Terminal transaction reference, or `null` when unavailable or billing requires review. The event alone is not proof of successful payment.                                                                               |

When present, `parcel_measurements` uses centimetres and kilograms. `booked` and `carrier` are independent parcel lists; their order does not establish a match. Unknown measurements are `null`, and historical detections without a saved snapshot omit the field. `observed_at` identifies the saved tracking observation; retries and replays retain that evidence. FedEx volumetric weight is calculated from the returned dimensions using a divisor of 5,000; DHL volumetric weight is the value reported by DHL.

Only a positive overage meeting the configured minimum qualifies; the default minimum is `0.25 kg`. When both booked and carrier chargeable weights exceed `2 kg`, the booked comparison weight is rounded upward to the next `0.5 kg` increment before the difference is calculated.

{% hint style="warning" %}
This alert is based on delivery tracking for your connected account. It does not confirm a carrier invoice adjustment. Please verify the weight and any resulting carrier charges on your carrier invoice.
{% endhint %}

Verify the `X-Terminal-Signature` before processing the event; see [Handling Webhook Events](/tship/miscallaneous/webhook-events/handling-webhook-events.md). This event uses the `{ event, data }` envelope and has no top-level `event_id`. Make processing idempotent using `data.detection_id`. Replaying the recorded detection does not create another detection fee.

You can turn off detection for the connected account in [Settings → Carriers](https://dashboard.terminal.africa/settings). This stops new detections; already-paid pending notifications may still complete.

For testing, [Simulate Webhook](/tship/webhooks/simulate-webhook.md#simulate-a-weight-discrepancy-alert) is staging-only and requires a shipment with an already recorded detection. It does not generate a discrepancy or run billing.

## Status events

These carry a tracking snapshot, not the whole shipment. Addresses and the parcel appear as **ids**, not embedded objects — call [Get Shipment](/tship/shipment/get-shipment.md) if you need the full record.

Status events share this tracking snapshot. `shipment.tracking_updated` also includes `tracking_change`, described below.

### shipment.tracking\_updated

Fires after a hub parcel correction replaces the carrier waybill on an existing shipment. The `shipment_id` stays the same. The event carries the usual lean tracking snapshot plus `data.tracking_change`.

Hub Relabelling is being prepared for rollout. These notifications begin when the feature is enabled.

| Field in `data.tracking_change` | Meaning                                                                                 |
| ------------------------------- | --------------------------------------------------------------------------------------- |
| `previous_tracking_number`      | The carrier waybill number that was replaced.                                           |
| `tracking_number`               | The replacement carrier waybill number.                                                 |
| `shipping_label_url`            | Terminal's link for the replacement label. Normal label access and release rules apply. |
| `reason`                        | `hub_correction`.                                                                       |
| `correction_id`                 | Reference identifying the hub correction.                                               |
| `changed_at`                    | Time the replacement was saved, as an ISO 8601 timestamp.                               |

Illustrative payload; the identifiers and waybill numbers below are examples.

```json
{
    "event": "shipment.tracking_updated",
    "data": {
        "shipment_id": "SH-EXAMPLE000001",
        "user": "USER-EXAMPLE000001",
        "status": "confirmed",
        "sub_statuses": [],
        "tracking_number": "7412090123",
        "tracking_change": {
            "previous_tracking_number": "7412089553",
            "tracking_number": "7412090123",
            "shipping_label_url": "https://api.terminal.africa/v1/shipments/label/SH-EXAMPLE000001?v=1793268000000",
            "reason": "hub_correction",
            "correction_id": "HCR-EXAMPLE000001",
            "changed_at": "2026-10-29T10:00:00.000Z"
        },
        "events": [],
        "extras": {
            "tracking_number": "7412090123",
            "tracking_url": "https://track.terminal.africa/SH-EXAMPLE000001",
            "shipping_label_url": "https://api.terminal.africa/v1/shipments/label/SH-EXAMPLE000001?v=1793268000000"
        }
    }
}
```

Use `shipment_id` as your shipment reference, update the stored carrier number from `tracking_change.tracking_number`, and use the replacement label link. Keep `previous_tracking_number` as a tracking alias, rather than continuing to ship with the retired label.

The previous waybill number still resolves to the live shipment through [Track a Shipment](/tship/shipment/track-a-shipment.md). This compatibility applies to Terminal tracking; the old label must not be reused for shipping.

This event does not imply an additional charge. When a correction charge is captured, it produces the separate [`transaction.success` event](/tship/miscallaneous/sample-webhook-event-payloads/transaction.md#hub-correction-charges). Do not rely on delivery order between these events. Make repeated deliveries safe by recognizing the same `shipment_id`, `correction_id` and replacement `tracking_number`; fetch [Get Shipment](/tship/shipment/get-shipment.md) if you need the current record.

### shipment.delivered

```javascript
{
    "event": "shipment.delivered",
    "data": {
        "shipment_id": "SH-40208776515",
        "user": "USER-27450202164",
        "status": "delivered",
        "sub_statuses": [],
        "rate": "RT-64093387231",
        "carrier": "CA-85479996273",
        "tracking_number": "7412089553",
        "events": [
            {
                "status": "confirmed",
                "description": "Shipment arranged successfully by User.",
                "location": "Lagos, NG",
                "created_at": "2026-09-15T09:02:11.903Z"
            },
            {
                "status": "in-transit",
                "description": "Shipment picked up by carrier.",
                "location": "Lagos, NG",
                "created_at": "2026-09-15T14:38:40.512Z"
            },
            {
                "status": "delivered",
                "description": "Delivered - Signed for by: A. OBI",
                "location": "London, GB",
                "created_at": "2026-09-18T11:20:07.884Z"
            }
        ],
        "extras": {
            "tracking_number": "7412089553",
            "tracking_url": "https://track.terminal.africa/SH-40208776515",
            "carrier_tracking_url": "https://www.dhl.com/ng-en/home/tracking.html?tracking-id=7412089553",
            "shipping_label_url": "https://api.terminal.africa/v1/shipments/label/SH-40208776515",
            "proof_of_delivery": {
                "url": "https://assets.terminal.africa/pod/SH-40208776515.pdf",
                "type": "signature",
                "signed_by": "A. OBI",
                "fetched_at": "2026-09-18T11:34:52.006Z"
            }
        },
        "metadata": {
            "order_id": "ORD-10023"
        },
        "address_to": "AD-00632494668",
        "address_from": "AD-00632494667",
        "parcel": "PC-09857312356",
        "pickup_date": "2026-09-15T14:00:00.000Z",
        "delivery_date": "2026-09-18T11:20:07.884Z",
        "delivery_arranged": true,
        "delivery_picked_up": true,
        "delivery_delivered": true,
        "created_at": "2026-09-15T09:02:11.903Z",
        "updated_at": "2026-09-18T11:20:07.884Z"
    }
}
```

### shipment.in-transit

Fires **once**, the first time a shipment moves.

```javascript
{
    "event": "shipment.in-transit",
    "data": {
        "shipment_id": "SH-40208776515",
        "user": "USER-27450202164",
        "status": "in-transit",
        "sub_statuses": [],
        "rate": "RT-64093387231",
        "carrier": "CA-85479996273",
        "tracking_number": "7412089553",
        "events": [
            {
                "status": "in-transit",
                "description": "Shipment picked up by carrier.",
                "location": "Lagos, NG",
                "created_at": "2026-09-15T14:38:40.512Z"
            }
        ],
        "extras": {
            "tracking_number": "7412089553",
            "tracking_url": "https://track.terminal.africa/SH-40208776515"
        },
        "metadata": {
            "order_id": "ORD-10023"
        },
        "address_to": "AD-00632494668",
        "address_from": "AD-00632494667",
        "parcel": "PC-09857312356",
        "delivery_arranged": true,
        "delivery_picked_up": true,
        "created_at": "2026-09-15T09:02:11.903Z",
        "updated_at": "2026-09-15T14:38:40.512Z"
    }
}
```

### shipment.awaiting-clearance

The shipment is held at customs. `awaiting-clearance` also appears in `sub_statuses` while the main `status` stays `in-transit`.

```javascript
{
    "event": "shipment.awaiting-clearance",
    "data": {
        "shipment_id": "SH-40208776515",
        "user": "USER-27450202164",
        "status": "in-transit",
        "sub_statuses": ["awaiting-clearance"],
        "rate": "RT-64093387231",
        "carrier": "CA-85479996273",
        "tracking_number": "7412089553",
        "events": [
            {
                "status": "in-transit",
                "description": "Shipment is on hold - customs clearance required.",
                "location": "London, GB",
                "created_at": "2026-09-17T06:14:33.120Z"
            }
        ],
        "address_to": "AD-00632494668",
        "address_from": "AD-00632494667",
        "parcel": "PC-09857312356",
        "created_at": "2026-09-15T09:02:11.903Z",
        "updated_at": "2026-09-17T06:14:33.120Z"
    }
}
```

### shipment.returned

```javascript
{
    "event": "shipment.returned",
    "data": {
        "shipment_id": "SH-40208776515",
        "user": "USER-27450202164",
        "status": "returned",
        "sub_statuses": [],
        "rate": "RT-64093387231",
        "carrier": "CA-85479996273",
        "tracking_number": "7412089553",
        "events": [
            {
                "status": "returned",
                "description": "Shipment returned to shipper - recipient unavailable.",
                "location": "London, GB",
                "created_at": "2026-09-19T13:45:02.771Z"
            }
        ],
        "address_to": "AD-00632494668",
        "address_from": "AD-00632494667",
        "address_return": "AD-00632494667",
        "parcel": "PC-09857312356",
        "created_at": "2026-09-15T09:02:11.903Z",
        "updated_at": "2026-09-19T13:45:02.771Z"
    }
}
```

### shipment.pending-cancellation

Cancellation has been requested but the carrier has not confirmed it.

```javascript
{
    "event": "shipment.pending-cancellation",
    "data": {
        "shipment_id": "SH-40208776515",
        "user": "USER-27450202164",
        "status": "in-transit",
        "sub_statuses": ["pending-cancellation"],
        "rate": "RT-64093387231",
        "carrier": "CA-85479996273",
        "tracking_number": "7412089553",
        "events": [],
        "address_to": "AD-00632494668",
        "address_from": "AD-00632494667",
        "parcel": "PC-09857312356",
        "cancellation_request": true,
        "cancellation_reason": "Customer cancelled the order",
        "created_at": "2026-09-15T09:02:11.903Z",
        "updated_at": "2026-09-16T10:05:19.443Z"
    }
}
```

### shipment.cancelled

```javascript
{
    "event": "shipment.cancelled",
    "data": {
        "shipment_id": "SH-40208776515",
        "user": "USER-27450202164",
        "status": "cancelled",
        "sub_statuses": [],
        "rate": "RT-64093387231",
        "carrier": "CA-85479996273",
        "tracking_number": "7412089553",
        "events": [],
        "address_to": "AD-00632494668",
        "address_from": "AD-00632494667",
        "parcel": "PC-09857312356",
        "cancellation_request": true,
        "cancellation_reason": "Customer cancelled the order",
        "delivery_cancelled": true,
        "created_at": "2026-09-15T09:02:11.903Z",
        "updated_at": "2026-09-16T12:31:57.009Z"
    }
}
```

### shipment.updated

Fires on any other change to an active shipment. Same shape; read `events` for what changed.

```javascript
{
    "event": "shipment.updated",
    "data": {
        "shipment_id": "SH-40208776515",
        "user": "USER-27450202164",
        "status": "in-transit",
        "sub_statuses": [],
        "rate": "RT-64093387231",
        "carrier": "CA-85479996273",
        "tracking_number": "7412089553",
        "events": [
            {
                "status": "in-transit",
                "description": "Arrived at sort facility.",
                "location": "Dubai, AE",
                "created_at": "2026-09-16T22:11:04.330Z"
            }
        ],
        "address_to": "AD-00632494668",
        "address_from": "AD-00632494667",
        "parcel": "PC-09857312356",
        "created_at": "2026-09-15T09:02:11.903Z",
        "updated_at": "2026-09-16T22:11:04.330Z"
    }
}
```

## shipment.created

Carries a fuller shipment object than the status events — close to what [Get Shipment](/tship/shipment/get-shipment.md) returns.

These are always stripped out and will never appear:

* `extras.shipping_label` and `extras.aws_shipping_label_url` (label bytes and internal storage keys)
* `metadata.shipment_payload`, `metadata.carrier_shipment`, `metadata.selected_rate` (carrier blobs)
* `legs`

```javascript
{
    "event": "shipment.created",
    "data": {
        "shipment_id": "SH-40208776515",
        "user": "USER-27450202164",
        "status": "confirmed",
        "sub_statuses": [],
        "rate": "RT-64093387231",
        "carrier": "CA-85479996273",
        "tracking_number": "7412089553",
        "address_to": "AD-00632494668",
        "address_from": "AD-00632494667",
        "parcel": "PC-09857312356",
        "events": [
            {
                "status": "confirmed",
                "description": "Shipment arranged successfully by User.",
                "location": "Lagos, NG",
                "created_at": "2026-09-15T09:02:11.903Z"
            }
        ],
        "extras": {
            "tracking_number": "7412089553",
            "tracking_url": "https://track.terminal.africa/SH-40208776515",
            "carrier_tracking_url": "https://www.dhl.com/ng-en/home/tracking.html?tracking-id=7412089553",
            "shipping_label_url": "https://api.terminal.africa/v1/shipments/label/SH-40208776515",
            "commercial_invoice_url": "https://assets.terminal.africa/invoices/SH-40208776515.pdf"
        },
        "metadata": {
            "order_id": "ORD-10023"
        },
        "pickup_date": "2026-09-15T14:00:00.000Z",
        "delivery_arranged": true,
        "created_at": "2026-09-15T09:02:11.903Z",
        "updated_at": "2026-09-15T09:02:11.903Z"
    }
}
```

## shipment.customs\_event

Fires when a customs delay is **detected**, and again when it is **resolved**. Read `status` to tell them apart — the event type is the same both times.

### Detected

```javascript
{
    "event": "shipment.customs_event",
    "data": {
        "shipment_id": "SH-40208776515",
        "status": "detected",
        "custom_delay_occured_at": "2026-09-17T06:14:33.120Z",
        "custom_delay_ended_at": null
    }
}
```

### Resolved

```javascript
{
    "event": "shipment.customs_event",
    "data": {
        "shipment_id": "SH-40208776515",
        "status": "resolved",
        "custom_delay_occured_at": "2026-09-17T06:14:33.120Z",
        "custom_delay_ended_at": "2026-09-18T08:52:16.401Z"
    }
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.terminal.africa/tship/miscallaneous/sample-webhook-event-payloads/shipment.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
