# Shipment tracking & labels

Path: `/label-provider/shipment-tracking`

Once you have a `packing_order_id`, `box_id` and `shipment_tracking.id` from a
[packing webhook](/label-provider/webhooks), you drive the label lifecycle with two
endpoints: **shipment tracking** (status) and **attach** (the label file).

## The status state machine

**Flow: shipment_tracking.status transitions.**

1. **null** — Default. No label activity yet.

2. **pulpowms_label_generation_started** — You have begun generating the label.

3. **pulpowms_label_generated** — Success — tracking info available.

Other valid transitions: `null → pulpowms_label_generation_failed` (failure — see
`error_message`) and `null → pulpowms_label_not_required` (skip label for this box).

**Endpoint: Update shipment tracking status** — `PUT /packing/orders/{packing_order_id}/boxes/{box_id}/shipment_tracking/{tracking_id}` (operationId: updateShipmentTracking)

| Field                          | Type | Required | Description                                                                                                                |
| ------------------------------ | ---- | -------- | -------------------------------------------------------------------------------------------------------------------------- |
| status                         | enum | yes      | null, pulpowms_label_generation_started, pulpowms_label_generation_failed, pulpowms_label_generated. Default null. |
| error_message                 |      |          | Populated on failure.                                                                                                      |
| tracking_code                 |      |          | External code to track the shipment.                                                                                       |
| tracking_url                  |      |          | External URL to track the shipment.                                                                                        |
| carrier_code                  |      |          | Carrier code as defined in Pulpo (typically the carrier alpha code).                                                       |
| attributes, service_point_id |      |          | Optional. id, updated_at and printed are generated automatically.                                                         |

### 1 · Initiate the shipment tracking

**PUT body — initiate**

```json
{
  "status": "pulpowms_label_generation_started",
  "error_message": ""
}
```

### 2 · Upload the label into the box

**Endpoint: Attach the label PDF to the box** — `POST /packing/orders/{packing_order_id}/boxes/{box_id}/attach` (operationId: attachLabelToBox)

Multipart upload of the generated label file.

**Example (cURL):**

```bash
curl -X POST \
https://eu.pulpo.co/api/v1/packing/orders/{packing_order_id}/boxes/{box_id}/attach \
-H "Authorization: Bearer $TOKEN" \
--form 'attachment=@"/Label/Location/packingBoxLabel0000001.pdf"' \
--form 'type="label"'
```

### 3 · Indicate the result

**PUT body — failure**

```json
{
  "error_message": "error message",
  "status": "pulpowms_label_generation_failed"
}
```

**PUT body — success**

```json
{
  "attributes": null,
  "service_point_id": null,
  "error_message": "",
  "tracking_code": "XXXXXXXXXXX",
  "tracking_url": "www.trackingurl.com",
  "carrier_code": "DDD",
  "status": "pulpowms_label_generated"
}
```

## Confirmation webhook

When you set the status to generated, Pulpo fires `shipment_tracking_updated`. Use it to
notify the end customer (SMS, email, push).

**Webhook event:&#x20;**`shipment_tracking_updated`

| Field                                          | Type | Required | Description                                        |
| ---------------------------------------------- | ---- | -------- | -------------------------------------------------- |
| data.id                                        |      |          | Shipment tracking id.                              |
| data.packing_box_id                          |      |          | The box this tracking belongs to.                  |
| data.sales_order                              |      |          | Order snapshot incl. ship_to (recipient address). |
| tracking_code / tracking_url / carrier_code |      |          | Populated once you set them on success.            |

Sample payload:

```json
{
  "webhook_id": null,
  "warehouse_name": "simon_warehouse_1",
  "warehouse_id": 2236,
  "updated_at": "2026-09-23T13:36:52",
  "type": "shipment_tracking_updated",
  "status": "triggered",
  "merchant_name": "default",
  "merchant_id": 1053,
  "merchant_channel_id": 1068,
  "id": "a63c3b9a-38bd-4285-aa5e-30bc114d9b05",
  "data": {
    "updated_at": "2026-09-23T13:36:52",
    "tracking_url": null,
    "tracking_code": "PA-0000054-72384",
    "status": "pulpowms_label_generated",
    "service_point_id": null,
    "sales_order": {
      "warehouse_id": 2236,
      "state": "packing",
      "ship_to": {
        "name": "Braun and Sons",
        "company_name": "Oberbrunner Inc",
        "address": {
          "street": "412 Willms Underpass",
          "country": "ME",
          "city": "New Elyse"
        }
      },
      "order_num": "ORDER_587493",
      "id": 26167904
    },
    "printed": false,
    "packing_box_id": 72384,
    "packing_box": {
      "width": 15,
      "weight": 336.2,
      "length": 20,
      "id": 72384,
      "height": 10
    },
    "id": 63898,
    "error_message": null,
    "carrier_code": null
  }
}
```

---

Website version: https://connect.pulpo.co/label-provider/shipment-tracking
Whole guide in one file: https://connect.pulpo.co/llms-full.txt
Index of all pages: https://connect.pulpo.co/llms.txt
