---
title: "🧹 Cancel All Orders by Market"
description: >-
  Cancel all open orders by outcome, market, or event using the Forkast SDK with
  a single required identifier parameter.
---

> **For AI agents:** the complete documentation index is at [llms.txt](/llms.txt). Append `.md` to any page URL for its markdown version.

Cancels all open orders by outcome, market, or event. Provide one of `outcomeId`, `marketId`, or `eventId`. If `eventId`is used, it cancels for all markets in that event.

```typescript
import {
  ForkastSDK,
  Network,
  CancelAllOrderParams,
  CancelAllOrderResponse,
} from "@forkastgg/client";

const sdk = new ForkastSDK(Network.TESTNET, "YOUR_API_KEY");
const accountService = sdk.getAccountService();
const orderService = sdk.getOrderService();

const { accessToken } = await accountService.loginWithPrivateKey(
  "YOUR_PRIVATE_KEY"
);

// By marketId
const params: CancelAllOrderParams = { marketId: 123 };

const result: CancelAllOrderResponse = await orderService.cancelAllOrder(
  params,
  accessToken
);
```

**Parameters**

| **Field** | **Type** | **Required** | **Description** |
| ------------- | -------------------- | ------------ | ------------------------------------------------------------------------- |
| `params`      | CancelAllOrderParams | Yes          | Send one of the below in the object:<br />• `outcomeId`<br />• `marketId`<br />• `eventId` |
| `accessToken` | string               | Yes          | Access Token received from login response                                 |
