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

# 取消单场赛事的全部订单

> 取消单场赛事上的每一笔未成交订单

取消单场赛事上的每一笔未成交订单。可选择限定到单一市场 `type`，以保留其他市场的订单。

<h2 id="request">
  请求
</h2>

`POST /session/cancelAllOrdersForGame`

<ParamField body="gameID" type="string" required>
  应取消订单的赛事。
</ParamField>

<ParamField body="type" type="string">
  可选。仅取消该市场类型的订单 — 取值为 `moneyline`、`spread`、`total` 之一。省略时取消所有市场类型。
</ParamField>

<CodeGroup>
  ```bash curl（单个市场） theme={null}
  curl -X POST https://api.4casters.io/session/cancelAllOrdersForGame \
    -H "Authorization: Bearer YOUR_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{
      "gameID": "688c0516fbc14da0c202d426",
      "type": "spread"
    }'
  ```

  ```bash curl（全部市场） theme={null}
  curl -X POST https://api.4casters.io/session/cancelAllOrdersForGame \
    -H "Authorization: Bearer YOUR_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{ "gameID": "688c0516fbc14da0c202d426" }'
  ```
</CodeGroup>

<h2 id="response">
  响应
</h2>

<ResponseField name="data" type="array">
  按单取消结果。形态与 [取消一笔订单](/zh-Hans/pages/rest/orders/cancel-order#response) 相同。
</ResponseField>

<h2 id="errors">
  错误
</h2>

| 状态 | 含义 |
| - | - |
| `400` | `gameID` 缺失 / 无效，或 `type` 不是允许的取值之一。 |


## OpenAPI

````yaml POST /session/cancelAllOrdersForGame
openapi: 3.1.0
info:
  title: 4casters REST API
  version: 1.0.0
  description: >-
    Public REST API for the 4casters peer-to-peer betting exchange. Use this API
    to manage your account, query the orderbook and games, and place / edit /
    cancel orders.


    All responses (unless noted otherwise) are JSON envelopes of the form `{
    "data": ... }`.
  contact:
    name: 4casters
    url: https://4casters.io
servers:
  - url: https://api.4casters.io
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Authentication
    description: Login and account session management
  - name: User
    description: Read account info, bets, and orders
  - name: Orders
    description: Place, edit, look up, and cancel orders
  - name: Markets
    description: Browse leagues, games, participants, and orderbooks
  - name: Affiliate
    description: Affiliate / referral commission
paths:
  /session/cancelAllOrdersForGame:
    post:
      tags:
        - Orders
      summary: Cancel all orders for a game
      description: >-
        Cancel every open order on a single game. Optionally restrict to a
        single market `type`.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - gameID
              properties:
                gameID:
                  type: string
                  description: The game whose orders to cancel.
                type:
                  type: string
                  enum:
                    - moneyline
                    - spread
                    - total
                  description: Optional. Cancel only orders of this market type.
            example:
              gameID: 688c0516fbc14da0c202d426
              type: spread
      responses:
        '200':
          description: Per-order cancel results
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/CancelResult'
        '400':
          description: '`gameID` missing or invalid; or `type` invalid'
        '401':
          $ref: '#/components/responses/Unauthorized'
components:
  schemas:
    CancelResult:
      type: object
      properties:
        success:
          type: boolean
        reason:
          type: string
          description: Failure reason. Present only when `success` is `false`.
        sessionID:
          type: string
          description: Order id.
        description:
          type: string
          description: Human-readable order description (e.g. `Lakers -3.5 -110`).
        odds:
          type: integer
          description: American odds of the cancelled order.
        filled:
          type: number
        offered:
          type: number
        remaining:
          type: number
        gameID:
          type: string
        userReference:
          type: string
  responses:
    Unauthorized:
      description: Missing or invalid auth token
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Pass your auth token in the `Authorization` header. The `Bearer` prefix
        is optional; the server also accepts a signed `auth` cookie or a `token`
        field in the request body.

````

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