This API is used to cancel an existing consignment. Cancelled consignments are notified to the carrier and the label becomes invalid.
| Property | Value |
|---|---|
| URL | {{BASE_URL}}/api/v1/consignments/{idBarcodeOrReference}/cancel |
| HTTP Method | POST |
| Content Type | application/json |
| Authentication | APIKEY header |
Not all consignments can be cancelled. Consignments in the following statuses can be cancelled:
| Status | Cancellable |
|---|---|
| Label created, not yet picked up | ✅ Yes |
| Handed to carrier (in transit) | ⚠️ Provider dependent |
| Delivered | ❌ No |
| Already cancelled | ❌ No |
Important: After being handed to the carrier, cancellation depends on the provider's rules. Some providers do not support cancellation of in-transit shipments.
| Parameter | Type | Required | Description |
|---|---|---|---|
idBarcodeOrReference |
String/Integer | REQUIRED | Consignment ID, barcode, or reference number |
Flexible Search: You can cancel the consignment using ID, ComToHome barcode (C2H...), or your own reference number (reference_no).
curl -X POST "{{BASE_URL}}/api/v1/consignments/632236/cancel" \
-H "Content-Type: application/json" \
-H "APIKEY: {{APIKEY}}"
curl -X POST "{{BASE_URL}}/api/v1/consignments/C2H07238640094/cancel" \
-H "Content-Type: application/json" \
-H "APIKEY: {{APIKEY}}"
curl -X POST "{{BASE_URL}}/api/v1/consignments/ORDER-2024-001/cancel" \
-H "Content-Type: application/json" \
-H "APIKEY: {{APIKEY}}"
{
"status": true,
"message": "Cancelled by customer",
"data": {
"consignment": 632236
}
}
| Field | Type | Description |
|---|---|---|
status |
Boolean | Operation success status |
message |
String | Cancellation result message |
data.consignment |
Integer | Cancelled consignment ID |
{
"status": false,
"errors": [
{
"message": "Consignment not found"
}
]
}
{
"status": false,
"errors": [
{
"message": "Consignment cancel failed: Shipment already in transit"
}
]
}
| Error | Description | Solution |
|---|---|---|
Consignment not found |
Consignment not found | Check ID, barcode, or reference number |
Consignment cancel failed |
Cancellation failed | Check consignment status |
Shipment already delivered |
Shipment has been delivered | Delivered shipments cannot be cancelled |
Shipment already cancelled |
Shipment already cancelled | - |
Unlike cancellation, you can use the DELETE method to completely delete the consignment:
| Property | Value |
|---|---|
| URL | {{BASE_URL}}/api/v1/consignments/{idBarcodeOrReference} |
| HTTP Method | DELETE |
curl -X DELETE "{{BASE_URL}}/api/v1/consignments/632236" \
-H "APIKEY: {{APIKEY}}"
Difference: The cancel endpoint cancels the consignment and keeps it in records. The DELETE endpoint first cancels the consignment, then removes it from the system.
After cancelling the consignment: