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

# 撤单 - 撤销订单的结果

> 撤销 Apexium 订单会对其每笔注单及到期剩余部分产生什么影响，如何读取结果，以及如何一次撤销多个订单。

撤单会停止订单上仍在进行的部分。它无法撤回博彩公司已经接受的内容。

## 撤销单个订单

```bash theme={null}
curl -X POST https://api.apexiumbet.com/v1/orders/4f0c2b1e-8d4a-4f7e-9a51-2c1f0b7e9d10/cancel \
  -H "x-api-key: apx_live_…"
```

响应是撤单之后的订单，并多出两个字段，告诉您发生了什么。

### 剩余部分

`remainder` 针对带 `expiresAt` 的订单持续处理的未成交投注额：

| `remainder` | 含义 |
| - | - |
| `cancelled` | 剩余部分原本正在处理，现已停止 |
| `alreadyTerminal` | 剩余部分此前已经结束：已成交、已到期或已撤销 |
| `none` | 订单没有到期时间，因此没有剩余部分 |

### 每笔注单

每笔注单带有一个 `cancellation`：

| `cancellation` | 含义 |
| - | - |
| `cancelled` | 注单在博彩公司接受之前已被撤销 |
| `alreadyTerminal` | 注单此前已经结束：被拒绝或已结算 |
| `notRecallable` | 博彩公司已接受该注单；它继续有效并将结算 |

撤单之后的 `filledStake` 是您仍承担风险的金额。

### 重复撤单

重复撤单是安全的。对已处于终态的订单撤单，会再次返回相同的结果，且不会改变任何内容。

`409 ORDER_BUSY` 表示该订单此刻正在被处理，例如由其到期剩余部分处理。请稍等片刻后重试。

## 批量撤销订单

`POST /v1/orders/cancel-all` 按以下三种范围之一撤销订单：

| 请求体 | 范围 |
| - | - |
| `{}` | 账户的所有进行中订单（`PENDING`、`PARTIALLY_FILLED`） |
| `{ "fixtureId": "id1000001761300868" }` | 某一场赛事上的进行中订单 |
| `{ "orderIds": ["…", "…"] }` | 所列订单，最多 200 个，不论其状态。已处于终态的订单会原样返回其结果，不作改变。 |

响应包含以下四项：

| 字段 | 含义 |
| - | - |
| `orders` | 已撤销的订单，每个都带有如上所述的 `remainder` 和逐笔注单的 `cancellation` |
| `notFound` | 所列 id 中，在账户下找不到对应订单的（如果您给出了 `fixtureId`，则指不在该赛事上的） |
| `busy` | 正在被处理的订单；请稍后再次撤销 |
| `nextCursor` | 订单超过 200 个时不为 `null`：用 `{ "cursor": "…" }` 再次调用，如果您给出了 `fixtureId`，也要带上同一个 `fixtureId` |

```bash theme={null}
curl -X POST https://api.apexiumbet.com/v1/orders/cancel-all \
  -H "x-api-key: apx_live_…" \
  -H "content-type: application/json" \
  -d '{ "fixtureId": "id1000001761300868" }'
```

`cursor` 不能与 `orderIds` 同时使用。撤单计入您密钥的订单配额；参见[限制](https://docs.apexiumbet.com/zh/api-reference/limits.md)。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.