> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kasiye.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Cancel a shipment

> Cancel a shipment that has not started delivery.

Sets `status` to `cancelled`. Allowed while the shipment is `pending` or `awaiting_pickup`. In-transit and delivered shipments cannot be cancelled.

<ParamField path="shipment" type="string" required>
  Shipment reference, for example `SHP-12345`.
</ParamField>

<RequestExample>
  ```bash theme={null}
  curl -X POST https://api.kasiye.com/v1/shipments/SHP-12345/cancel \
    -H "Authorization: Bearer shp_your_key"
  ```
</RequestExample>

Returns the cancelled shipment in `data`.

If the shipment cannot be cancelled:

```json theme={null}
{
  "message": "This shipment cannot be cancelled.",
  "errors": {
    "shipment": ["This shipment cannot be cancelled."]
  }
}
```

A reference that belongs to another workspace returns `404`.
