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

# Cancel Orders

> Cancel pending limit, market open, and market close orders with the Ostium Builder SDK.

```ts theme={null}
import { CancelOrderType } from '@ostium/builder-sdk';
```

## Cancel a limit order

```ts theme={null}
await client.cancelOrder({
  type: CancelOrderType.Limit,
  pairId: order.pairId,
  idx: order.idx,
});
```

## Cancel a timed-out market open

```ts theme={null}
await client.cancelOrder({
  type: CancelOrderType.PendingOpen,
  orderId: 123,
});
```

## Cancel a timed-out market close

```ts theme={null}
await client.cancelOrder({
  type: CancelOrderType.PendingClose,
  orderId: 123,
  retry: true,
});
```
