POST
/api/v1/shipments/{shipment_id}/cancel
Auth: Bearer token
Cancel Shipment
Cancels a shipment that has not reached final delivery state.
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
| shipment_id | string | Yes | Shipment identifier. |
Body parameters
| Name | Type | Required | Description |
|---|---|---|---|
| reason_code | string | Yes | Predefined cancellation reason code. |
| reason_note | string | No | Optional free-text note for the cancellation. |
Example response
<?php
return [
'success' => true,
'data' => [
'shipment_id' => 'shp_101',
'status' => 'cancelled',
'cancellation_reason_code' => 'customer_request',
'cancellation_reason_note' => 'Customer requested cancellation before pickup.'
]
];
Request examples
curl -X POST \
"https://api.spaces.za.com/api/v1/shipments/shp_101/cancel" \
-H "Authorization: Bearer <token>" \\
-H "Content-Type: application/json" \\
--data '{
"reason_code": "customer_request",
"reason_note": "Customer requested cancellation before pickup."
}'