Skip to main content

Cancel Label

mailhub_cancel_label

Cancel a Label that has been bought, voiding it with the carrier and returning the Order to Packed — because the Label was wrong, or because the Order itself has to be cancelled.

Permission and safety​

Changes dataYes
ConfirmationRequired — confirm: true
Spends fundsNo
PermissionUpdate access to Orders

Confirmation is enforced by the server.

Input​

FieldTypeRequiredNotes
labelIdstringYesThe Label's UUID
confirmbooleanNoDefaults to false; the operation is refused unless the value is the boolean true
orderIdstringNoAn Order the Label is for, given together with shipmentId, so the result lists every Order the Label covers
shipmentIdstringNoThe Label's Shipment, given together with orderId

The Label identifier appears on the Order — see mailhub_list_orders and mailhub_get_order.

Example input​

{
"labelId": "44444444-4444-4444-4444-444444444444",
"confirm": true
}

Output​

There is no data payload, unless orderId and shipmentId were given: the result then lists every Order the Label covered in coversOrders. A successful call means Mailhub asked the carrier to void the Label and the request was accepted, and an Order that was LabelCreated is back in Packed — see mailhub_get_order. It does not mean the carrier has already confirmed the void.

Rules and common tool-specific errors​

Mailhub asks the carrier to void the Label, clears the Shipment's tracking and carrier selection, and moves the Order back to Packed so it can be re-rated, bought again, or cancelled. An Order that had already moved on, such as Fulfilled or Returned, keeps its status. When several Orders share the Shipment, every one of them loses the Label: tell the user before cancelling.

  • Cancelling the same Label twice is safe. An already-cancelled Label is not sent to the carrier again; the call simply succeeds.
  • Whether a Label can be voided at all is the carrier's rule, not Mailhub's. A carrier that refuses the void later, after Mailhub accepted the request, is not reported back through MCP: tell the user the void was requested, not that it is done.
  • A cancelled Label can no longer be downloaded. Buy a new one if the Shipment still needs a Label.

Common tool-specific errors​

CodeWhat it meansRetrying
MCP_CONFIRMATION_REQUIREDThe call did not carry confirm: trueYes, confirming
MCP_INVALID_UUIDlabelId, orderId, or shipmentId is not a UUIDNo — fix the value
Label.NotFoundNo such LabelNo — re-read the Order
Label.AccessDeniedThe Label belongs to another accountNo
Shipment.TrackingCodeMissing or Carrier.NotFoundThe Label's Shipment has no tracking code or carrier to void it withNo — contact Developer Support
MCP_WRITE_RATE_LIMITEDToo many changing calls for the account just nowYes, shortly

Every code above, plus the access and shared failures this table does not cover, is listed in Errors & Troubleshooting.

Next​