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

# Obter ligas

> Lista ligas com mercados ativos

Retorna cada liga com mercados ativos na exchange. Use os códigos de liga deste endpoint para obter eventos (`/exchange/v2/getGames`) e livros de ordens (`/exchange/v2/getOrderbook`).

Se a resposta contiver um nome de liga com `LIVE` (além das ligas ao vivo por esporte `NFL-LIVE`, `NBA-LIVE`, `NCAAF-LIVE`, `NCAAB-LIVE`), o valor `"LIVE"` é adicionado como alias de "todos os eventos em andamento".

## Requisição

`GET /exchange/getLeagues`

**sport** `string`

Filtro opcional de esporte (`basketball`, `baseball`, `hockey`, `football`, `soccer`, `golf`, `tennis`, `mma`, etc.). Quando `sport=soccer` ou `sport=golf`, o valor `"all"` é adicionado à lista.

```bash curl theme={null}
curl https://api.4casters.io/exchange/getLeagues \
  -H "Authorization: Bearer YOUR_TOKEN"
```

## Resposta

**data.availableLeagues** `array`

Array de códigos de liga.

### Exemplo

```json JSON theme={null}
{
  "data": {
    "availableLeagues": [
      "CHAMPIONS-LEAGUE",
      "NBA",
      "NHL",
      "BUNDESLIGA",
      "PREMIER-LEAGUE",
      "PGA",
      "LA-LIGA",
      "NON-UFC",
      "SERIE-A",
      "MLS",
      "UFCMMA"
    ]
  }
}
```


## OpenAPI

````yaml GET /exchange/getLeagues
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:
  /exchange/getLeagues:
    get:
      tags:
        - Markets
      summary: Get leagues
      description: >-
        Return every league with active markets on the exchange. If the response
        includes a league containing `LIVE` (other than the per-sport live
        leagues `NFL-LIVE`, `NBA-LIVE`, `NCAAF-LIVE`, `NCAAB-LIVE`), the value
        `LIVE` is appended as an alias for fetching all in-play games.
      parameters:
        - name: sport
          in: query
          required: false
          schema:
            type: string
          description: >-
            Optional sport filter (e.g. `basketball`, `soccer`, `golf`). When
            `sport=soccer` or `sport=golf`, `all` is appended to the list.
      responses:
        '200':
          description: Available leagues
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      availableLeagues:
                        type: array
                        items:
                          type: string
                        example:
                          - NBA
                          - NHL
                          - PREMIER-LEAGUE
                          - PGA
        '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.