> ## 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.

# Cancel all orders for a game

> Cancel every open order on a single game

Cancel every open order on a single game. Optionally restrict to a single market `type` to leave other markets in place.

## Request

`POST /session/cancelAllOrdersForGame`

<ParamField body="gameID" type="string" required>
  The game whose orders should be cancelled.
</ParamField>

<ParamField body="type" type="string">
  Optional. Cancel only orders of this market type — one of `moneyline`, `spread`, `total`. When omitted, all market types are cancelled.
</ParamField>

<CodeGroup>
  ```bash curl (one market) 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 (all markets) 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>

## Response

<ResponseField name="data" type="array">
  Per-order cancel results. Same shape as [Cancel an order](/pages/rest/orders/cancel-order#response).
</ResponseField>

## Errors

| Status | Meaning                                                                 |
| ------ | ----------------------------------------------------------------------- |
| `400`  | `gameID` missing / invalid, or `type` is not one of the allowed values. |


## 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.

````