> For the complete documentation index, see [llms.txt](https://docs.sms4sats.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sms4sats.com/api-reference/cancel-order.md).

# Cancel Order

<mark style="color:blue;">`GET`</mark> `https://api2.sms4sats.com/cancelorder`

Cancels a receive order and releases the associated hold invoice. Your funds are automatically returned to your wallet.

{% hint style="info" %}
You can cancel an order after **2 minutes** if no activation code has arrived. All orders without a received code are **automatically canceled after 21 minutes**.
{% endhint %}

#### Query Parameters

| Name      | Type   | Required | Description                                                                    |
| --------- | ------ | -------- | ------------------------------------------------------------------------------ |
| `orderId` | String | Yes      | Order ID returned by [`/createorder`](/api-reference/create-receive-order.md). |

{% tabs %}
{% tab title="200: OK" %}
{% code overflow="wrap" %}

```javascript
{
    status: 'OK'
}
```

{% endcode %}
{% endtab %}

{% tab title="500: Internal Server Error" %}

```javascript
{
    status: 'error',
    reason: 'unable to save data'
}
```

{% endtab %}
{% endtabs %}

### Response Fields

| Field    | Type   | Description                     |
| -------- | ------ | ------------------------------- |
| `status` | String | `OK` on successful cancellation |

{% hint style="warning" %}
Only orders that have **not** yet received an activation code can be canceled. Once a code is delivered, the invoice is settled and cannot be reversed.
{% endhint %}
