# Cancel Order

## Cancel an Order

<mark style="color:orange;">`PUT`</mark> `/api/orders/cancel/{orderId}`

Use this API to **cancel an order** before it has been picked up(which is in the pending status)\
It will mark order as **cancelled.**\
OrderId is sent to the customer when the Order is created.\
\
**NOTE** - Order can be cancelled only when it's status is **Pending (New-Order) and Pickup-Failed status**.

#### Path Parameters

| Name                                      | Type   | Description                                             |
| ----------------------------------------- | ------ | ------------------------------------------------------- |
| orderId<mark style="color:red;">\*</mark> | string | AWB Number / Shipment ID received when order is created |

#### Headers

| Name                                       | Type   | Description                       |
| ------------------------------------------ | ------ | --------------------------------- |
| API\_KEY<mark style="color:red;">\*</mark> | string | Contact Blowhorn team for API Key |

{% tabs %}
{% tab title="200 When order is marked as cancelled." %}

```json
{
  "status": "PASS",
  "message": "Order Cancelled Successfully"
}
```

{% endtab %}

{% tab title="400 Bad request / Validation error" %}

```json
{
    "status": "FAIL",
    "message": "The order can't be cancelled now"
}
```

{% endtab %}

{% tab title="401 Unauthorized / Wrong api key" %}

```json
{
  "status": "FAIL",
  "message": "Unauthorized"
}
```

{% endtab %}

{% tab title="500 Unexpected error" %}

```json
{
  "status": "FAIL",
  "message": "Unexpected error"
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://doc.blowhorn.com/api-docs/orders/cancel-order.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
