Back to siteAPI Documentation
POST

/api/v1/shipments/{shipment_id}/cancel

Auth: Bearer token

Cancel Shipment

Cancels a shipment that has not reached final delivery state.

Path parameters

NameTypeRequiredDescription
shipment_idstringYesShipment identifier.

Body parameters

NameTypeRequiredDescription
reason_codestringYesPredefined cancellation reason code.
reason_notestringNoOptional 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."
}'