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

# Cancelar todas as ordens de uma liga

> Cancela de forma assíncrona todas as ordens abertas de uma liga

Programa o cancelamento de todas as ordens abertas de uma liga. Este endpoint **é despachado de forma assíncrona**: confirma imediatamente com `{ ordersReceived: true }` e os cancelamentos ocorrem em segundo plano.

Se você precisar saber quais ordens foram canceladas, prossiga com [Obter ordens não casadas](https://docs.4casters.io/pt-BR/pages/rest/user/get-unmatched-orders.md) ou inscreva-se no feed de usuário na [API de streaming WebSocket](https://docs.4casters.io/pt-BR/pages/streaming/user-feed.md).

## Requisição

`POST /session/cancelAllForLeague`

**league** `string` *required*

Código de liga. Obtenha a lista com `GET /exchange/getLeagues`. Não diferencia maiúsculas.

```bash curl theme={null}
curl -X POST https://api.4casters.io/session/cancelAllForLeague \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "league": "NBA" }'
```

## Resposta

**data.ordersReceived** `boolean`

Sempre `true` em caso de sucesso. Os cancelamentos são processados de forma assíncrona.

### Exemplo

```json JSON theme={null}
{ "data": { "ordersReceived": true } }
```

## Erros

| Status | Significado |
| - | - |
| `400` | Falta `league`, não é uma string ou é desconhecida. |


## OpenAPI

````yaml POST /session/cancelAllForLeague
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/cancelAllForLeague:
    post:
      tags:
        - Orders
      summary: Cancel all orders for a league
      description: >-
        Schedule cancellation of every open order in a league. This endpoint
        **dispatches asynchronously** — it acknowledges with `{ ordersReceived:
        true }` immediately and the cancels happen in the background.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - league
              properties:
                league:
                  type: string
                  description: >-
                    League code from `GET /exchange/getLeagues`.
                    Case-insensitive.
            example:
              league: NBA
      responses:
        '200':
          description: Cancellation request accepted
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      ordersReceived:
                        type: boolean
                        example: true
        '400':
          description: League missing or invalid
        '401':
          $ref: '#/components/responses/Unauthorized'
components:
  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.