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

> Lista os eventos ativos de uma liga

Retorna todos os eventos ativos de uma liga. A resposta **não** inclui o livro de ordens nem nenhum preço: chame [Obter livro de ordens](https://docs.4casters.io/pt-BR/pages/rest/markets/get-orderbook.md) para isso.

## Requisição

`GET /exchange/v2/getGames`

**league** `string` *required*

Código de liga de [Obter ligas](https://docs.4casters.io/pt-BR/pages/rest/markets/get-leagues.md). Use o valor especial `upcoming` para obter todos os eventos próximos de todas as ligas.

**sport** `string`

Filtro opcional de esporte.

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

## Resposta

**data.games** `array`

**Game**

**id** `string`

Id do evento.

**parentGameID** `string`

Id do evento pai, se este for um mercado filho (props, períodos alternativos).

**cheapDataUID** `string`

Identificador estável entre sistemas do evento (usado para correlação de linhas).

**league** `string`

**sport** `string`

**start** `string`

Horário de início em ISO 8601.

**ended** `boolean`

**live** `boolean`

**featured** `boolean`

**eventName** `string`

**tournamentName** `string`

**periodName** `string`

p. ex. `Full Time`, `1H`, `Set 1`.

**isSpecials** `boolean`

`true` em mercados de futuros e outros especiais.

**participants** `array`

Array de dois elementos `[away, home]`. Cada participante tem `id`, `longName`, `shortName`, `homeAway`, `mainPitcher`, `rotationNumber`, `futuresSide`.

### Exemplo

```json JSON theme={null}
{
  "data": {
    "games": [
      {
        "id": "6266c12172aefcf0033374ce",
        "parentGameID": null,
        "cheapDataUID": "32620-79238-2022-04-26",
        "league": "NHL",
        "sport": "hockey",
        "start": "2022-04-26T18:00:00.000Z",
        "ended": false,
        "live": false,
        "featured": false,
        "participants": [
          { "id": "60747bc471b5071a80ca0ac8", "longName": "Carolina Hurricanes", "shortName": "CAR", "homeAway": "away", "mainPitcher": null, "rotationNumber": "25", "futuresSide": "" },
          { "id": "607349daf6d3364eb69604f6", "longName": "New York Rangers",    "shortName": "NEW", "homeAway": "home", "mainPitcher": null, "rotationNumber": "26", "futuresSide": "" }
        ]
      }
    ]
  }
}
```

## Erros

| Status | Significado |
| - | - |
| `400` | `league` é obrigatório. |


## OpenAPI

````yaml GET /exchange/v2/getGames
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/v2/getGames:
    get:
      tags:
        - Markets
      summary: Get games
      description: >-
        Return all active games for a league. This response does **not** include
        the orderbook or any prices — call `GET /exchange/v2/getOrderbook` for
        that.
      parameters:
        - name: league
          in: query
          required: true
          schema:
            type: string
          description: >-
            League code from `GET /exchange/getLeagues`. Use `upcoming` for all
            upcoming games across leagues.
        - name: sport
          in: query
          required: false
          schema:
            type: string
          description: Optional sport filter.
      responses:
        '200':
          description: Games list
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      games:
                        type: array
                        items:
                          $ref: '#/components/schemas/Game'
        '400':
          description: '`league` is required'
        '401':
          $ref: '#/components/responses/Unauthorized'
components:
  schemas:
    Game:
      type: object
      description: Game without orderbook data.
      properties:
        id:
          type: string
        parentGameID:
          type: string
          nullable: true
        cheapDataUID:
          type: string
          description: >-
            Stable cross-system identifier for the game (used for line
            correlation).
        league:
          type: string
        sport:
          type: string
        start:
          type: string
          format: date-time
        ended:
          type: boolean
        live:
          type: boolean
        featured:
          type: boolean
        eventName:
          type: string
          nullable: true
        tournamentName:
          type: string
          nullable: true
        periodName:
          type: string
          description: e.g. `Full Time`, `1H`, `Set 1`.
        isSpecials:
          type: boolean
          description: True for futures and other specials markets.
        participants:
          type: array
          items:
            $ref: '#/components/schemas/Participant'
    Participant:
      type: object
      properties:
        id:
          type: string
        longName:
          type: string
        shortName:
          type: string
        homeAway:
          type: string
          enum:
            - home
            - away
        mainPitcher:
          type: string
          nullable: true
        rotationNumber:
          type: string
          nullable: true
        futuresSide:
          type: string
          nullable: true
        score:
          type: number
          description: Final score; only present for ended games.
  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.