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

# Cancel Order

> Withdraw a resting order from the venue and release its reservation

Cancels an order that is still `OPEN` or `PARTIALLY_FILLED`. Only the wallet that placed it can cancel: `userAddress` must match the order's owner.

This removes the order from the book and releases the reservation behind it. It does **not** invalidate the signature on chain. The trader keeps a signed authorization that any venue holding it could still settle until it expires.

To retire the signature itself, use [Cancel Orders On Chain](/endpoints/external-securities-trading/cancel-on-chain). Cancel here for ordinary order management; cancel on chain when the trader wants the authorization gone.

## Path Parameters

<ParamField path="orderId" type="string" required>The order's `orderId`.</ParamField>

## Body Parameters

<ParamField body="userAddress" type="string" required>Wallet that placed the order.</ParamField>

## Response Fields

Returns the cancelled order, with `status: "CANCELLED"` and `cancelReason: "USER_CANCELLED"`. Same shape as [Get Order](/endpoints/external-securities-trading/get-order), without the trade arrays.

<Note>
  An order the chain has already retired is cancelled automatically the next time an incoming order could have matched it, with a `cancelReason` naming the reason: cancelled on chain, nonce invalidated, or filled on chain. You do not have to clean those up yourself.
</Note>

<RequestExample>
  ```bash cURL theme={null}
  curl -X DELETE "https://api.trusset.org/orderbooks/external-securities/api/orders/c81f4a9e-2d70-4bb3-9f16-08a5c7d1e320" \
    -H "X-API-Key: trusset_your_key_here" \
    -H "Content-Type: application/json" \
    -d '{ "userAddress": "0xabc7f1093d5e26b804a1c3f78de025916b47c0d3" }'
  ```

  ```typescript TypeScript theme={null}
  const res = await fetch(
    `https://api.trusset.org/orderbooks/external-securities/api/orders/${orderId}`,
    {
      method: 'DELETE',
      headers: {
        'X-API-Key': 'trusset_your_key_here',
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({ userAddress: await signer.getAddress() })
    }
  );
  const { data } = await res.json();
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "success": true,
    "data": {
      "orderId": "c81f4a9e-2d70-4bb3-9f16-08a5c7d1e320",
      "orderBookId": "clx_ob_extsec_001",
      "userAddress": "0xabc7f1093d5e26b804a1c3f78de025916b47c0d3",
      "side": "BUY",
      "orderType": "LIMIT",
      "price": "104200000",
      "quantity": "10000000",
      "filledQuantity": "0",
      "remainingQuantity": "10000000",
      "status": "CANCELLED",
      "cancelReason": "USER_CANCELLED",
      "updatedAt": "2025-06-15T12:06:00.000Z"
    }
  }
  ```
</ResponseExample>

## Error Codes

| Code                  | HTTP  | Cause                                                                                       |
| --------------------- | ----- | ------------------------------------------------------------------------------------------- |
| `VALIDATION_ERROR`    | `400` | `userAddress` is missing or not an address                                                  |
| `ORDER_NOT_FOUND`     | `404` | No open order with that ID for this wallet, or the book is not reachable from your instance |
| `SERVICE_NOT_ENABLED` | `403` | The Trading service is not enabled on this instance                                         |
