Get API key
Authenticated — all requests require Authorization: Bearer mk_test_…Learn more
API ReferenceShipmentsCancel a pre-pickup shipment

Cancel a pre-pickup shipment

POST/api/v1/shipments/{shipment_id}/cancel idempotent

Only label_created (and draft if any exist) are cancellable; anything past first carrier scan returns 400 INVALID_FIELD(status). Idempotent — cancel-then-cancel returns the existing snapshot with refund_hkd=0. Live mode refunds the wallet by the original total; test mode does not (test create skipped the deduction). A shipment with an interception request in progress (filed in the Merdi portal) cannot be cancelled and returns 409 SHIPMENT_CANCEL_INTERCEPT_IN_PROGRESS until the request is withdrawn or closed. A shipment that a pickup currently holds (an in-flight pickup request, a held pickup manifest, or a self-drop-off declaration) also cannot be cancelled and returns 409 SHIPMENT_HAS_ACTIVE_PICKUP (1500116) with nothing changed. If a pickup arrangement (an in-flight pickup request or a held pickup manifest) holds it, cancel that pickup first; if a self-drop-off declaration holds it there is no pickup to cancel, so contact customer service to release it. Then retry the same request (the Idempotency-Key reservation is released, so the same key works). USD-wallet account: the response also carries refund, e.g. {"currency":"USD","amount":0} (refund_hkd stays 0). HKD accounts receive no refund key.

Parameters

shipment_id*
stringpath

Responses

Success body
{
  "status": 200,
  "message": "OK",
  "data": {
    "cancelled_at": "2026-05-28T07:48:17.607Z",
    "id": "IM-2026-0528-9ZNCP3-1",
    "refund_hkd": 0,
    "status": "label_created",
    "tracking_number": "IM-2026-0528-9ZNCP3-1"
  }
}

Returned object

FieldTypeSample
statusnumber200
messagestringOK
dataobject{5 keys}