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

# Get games

> List active games for a league

Returns all active games for a league. The response does **not** include the orderbook or any prices — call [Get orderbook](/pages/rest/markets/get-orderbook) for that.

## Request

`GET /exchange/v2/getGames`

<ParamField query="league" type="string" required>
  League code from [Get leagues](/pages/rest/markets/get-leagues). Use the special value `upcoming` to get all upcoming games across leagues.
</ParamField>

<ParamField query="sport" type="string">
  Optional sport filter.
</ParamField>

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

## Response

<ResponseField name="data.games" type="array">
  <Expandable title="Game">
    <ResponseField name="id" type="string">Game id.</ResponseField>
    <ResponseField name="parentGameID" type="string">Parent game id, if this is a child market (props, alternate periods).</ResponseField>
    <ResponseField name="cheapDataUID" type="string">Stable cross-system identifier for the game (used for line correlation).</ResponseField>

    <ResponseField name="league" type="string" />

    <ResponseField name="sport" type="string" />

    <ResponseField name="start" type="string">ISO 8601 start time.</ResponseField>

    <ResponseField name="ended" type="boolean" />

    <ResponseField name="live" type="boolean" />

    <ResponseField name="featured" type="boolean" />

    <ResponseField name="eventName" type="string" />

    <ResponseField name="tournamentName" type="string" />

    <ResponseField name="periodName" type="string">e.g. `Full Time`, `1H`, `Set 1`.</ResponseField>
    <ResponseField name="isSpecials" type="boolean">`true` for futures and other specials markets.</ResponseField>
    <ResponseField name="participants" type="array">Two-element `[away, home]` array. Each participant has `id`, `longName`, `shortName`, `homeAway`, `mainPitcher`, `rotationNumber`, `futuresSide`.</ResponseField>
  </Expandable>
</ResponseField>

### Example

<CodeGroup>
  ```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": "" }
          ]
        }
      ]
    }
  }
  ```
</CodeGroup>

## Errors

| Status | Meaning               |
| ------ | --------------------- |
| `400`  | `league` is required. |


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

````