API referenceShipments
Cancel a shipment
Attempts to cancel the shipment immediately. By default, the request succeeds only when the cancellation path available right now is free. To accept a paid cancellation, set acceptFees, and optionally cap the fee with limitAmountCents.
POST
/ shipments/{shipmentId}/ cancelhttps:/ / sandbox.api.mothership.com/ betaReads your token from
$MOTHERSHIP_API_TOKENResponse
Hover a key to see what it means. Click it to jump to the field.
Cancellation is immediate. The request only succeeds when cancelling is free, unless you set acceptFees to true. With acceptFees, add limitAmountCents to cap the fee you'll pay. A successful cancellation returns the fee charged in cancellationFeeCents.
| Response | When |
|---|---|
200 | The shipment was cancelled. |
402 PAYMENT_REQUIRED | Cancelling costs more than you accepted. metadata.feeCents is the lowest fee available, and metadata.availableCancellationOptions lists each option's type and feeCents. Retry with acceptFees: true and a high enough limitAmountCents. |
409 INVALID_REQUEST | "This shipment cannot be cancelled at this time." For example, a cancellation is already in progress. |