This API cancels a shipment that has not been picked up for delivery. If the shipment has already been picked up, you cannot cancel it.

Please head over to Cancel API Reference for more details.