openapi: 3.1.0
info:
  title: TheRundown Sports API
  version: 2.0.0
  description: |
    **Resolve the event first.** Ambiguous date, team, player, or timezone? The agent asks instead of guessing.

    **Every price carries evidence.** Event, market, affiliate ID, line, and the price update time. A fetch time is not freshness.

    **Missing stays missing.** No remembered odds, no synthetic prices, no filled gaps.

    **IDs come from the API.** Sports, markets, and affiliates are discovered at runtime. Retired affiliates stay out.

    Real-time and historical sports data API: odds, lines, scores and statistics across major North American and international sports leagues.

    ## Authentication
    All endpoints (except `/sports` and `/affiliates`) require authentication. Send your API key from a private server-side environment variable in the `X-TheRundown-Key` header.
    The query-key security scheme is retained for compatibility with existing integrations and deprecated for new integrations; do not put keys in URLs, prompts, browser bundles, or public code.
    ## Off-the-Board Sentinel Value
    The value **0.0001** indicates a line is "off the board": the sportsbook has temporarily removed pricing (e.g., pending injury news). This is NOT an error. Display as "Off Board" or "N/A" in your UI.

    ## Rate Limiting
    Requests are rate-limited per API key tier. Check response headers for current limits.

    ## Data Updates
    - Live odds update in real-time during games
    - Use delta endpoints for efficient polling of changes
    - WebSocket connections available for streaming updates

    ## V1 vs V2
    V2 endpoints use market-based data structures (market_id, participants, line prices). V1 endpoints use legacy line-based structures (moneyline, spread, total objects). V2 is recommended for new integrations.
  contact:
    name: TheRundown API Support
    url: https://therundown.io
    email: support@therundown.io
  termsOfService: https://therundown.io/terms

externalDocs:
  description: Build with AI guide
  url: https://therundown.io/build-with-ai

servers:
  - url: https://therundown.io
    description: Production

security:
  - ApiKeyHeader: []

tags:
  - name: V2 Sports
    description: Sport listings, dates, and teams (V2)
  - name: V2 Events
    description: Events with market-based odds (V2)
  - name: V2 Markets
    description: Market definitions, odds, deltas, and history (V2)
  - name: V2 Futures
    description: "Futures/outright competition events: championship and tournament-winner boards (V2, early access)"
  - name: V2 Teams
    description: Team data, players, and stats (V2)
  - name: V2 Players
    description: Player data (V2)
  - name: V2 Stats
    description: Team and player statistics (V2)
  - name: V2 WebSocket
    description: Real-time streaming via WebSocket (V2)
  - name: V2 Reference
    description: "Reference data: affiliates, sportsbooks, season types (V2)"
  - name: V1 Events
    description: Events with line-based odds (V1 legacy)
  - name: V1 Lines
    description: Moneyline, spread, total, best-line endpoints (V1 legacy)
  - name: V1 Sports
    description: Sport listings, dates, events, schedules (V1 legacy)
  - name: V1 Delta
    description: Delta/change feeds (V1 legacy)
  - name: V1 Reference
    description: Reference data (V1 legacy)
  - name: V1 WebSocket
    description: Real-time streaming via WebSocket (V1 legacy)

paths:
  # ─── V2 SPORTS ────────────────────────────────────────────────────────
  /api/v2/sports:
    get:
      operationId: v2GetSports
      tags: [V2 Sports]
      summary: List all sports
      description: Returns all available sports with their IDs. No authentication required.
      security: []
      responses:
        '200':
          description: List of sports
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SportsResponse'
              example:
                sports:
                  - sport_id: 1
                    sport_name: "NCAA Football"
                  - sport_id: 2
                    sport_name: "NFL"
                  - sport_id: 3
                    sport_name: "MLB"
                  - sport_id: 4
                    sport_name: "NBA"
                  - sport_id: 5
                    sport_name: "NCAA Men's Basketball"
                  - sport_id: 6
                    sport_name: "NHL"
                  - sport_id: 7
                    sport_name: "UFC/MMA"
                  - sport_id: 8
                    sport_name: "WNBA"
                  - sport_id: 10
                    sport_name: "MLS"
                  - sport_id: 11
                    sport_name: "EPL"
                  - sport_id: 12
                    sport_name: "FRA1"
                  - sport_id: 13
                    sport_name: "GER1"
                  - sport_id: 14
                    sport_name: "ESP1"
                  - sport_id: 15
                    sport_name: "ITA1"
                  - sport_id: 16
                    sport_name: "UEFACHAMP"
                  - sport_id: 17
                    sport_name: "UEFAEURO"
                  - sport_id: 18
                    sport_name: "FIFA"
                  - sport_id: 19
                    sport_name: "JPN1"
                  - sport_id: 20
                    sport_name: "IPL"
                  - sport_id: 21
                    sport_name: "T20"
                  - sport_id: 22
                    sport_name: "Politics"
                  - sport_id: 23
                    sport_name: "NBA Preseason"
                  - sport_id: 24
                    sport_name: "NBA Playoffs"
                  - sport_id: 25
                    sport_name: "NFL Preseason"
                  - sport_id: 26
                    sport_name: "NFL Playoffs"
                  - sport_id: 27
                    sport_name: "NHL Preseason"
                  - sport_id: 28
                    sport_name: "NHL Playoffs"
                  - sport_id: 30
                    sport_name: "MLB Spring Training"
                  - sport_id: 31
                    sport_name: "MLB Playoffs"
                  - sport_id: 32
                    sport_name: "NBA Summer League"
                  - sport_id: 33
                    sport_name: "UEFA Europa League"
                  - sport_id: 34
                    sport_name: "Liga MX"
                  - sport_id: 38
                    sport_name: "ATP"
                  - sport_id: 39
                    sport_name: "WTA"

  /api/v2/sports/dates:
    get:
      operationId: v2GetDatesBySportIDs
      tags: [V2 Sports]
      summary: Get available dates for multiple sports
      description: Returns dates with events for the specified sport IDs.
      parameters:
        - name: sport_ids
          in: query
          required: true
          schema:
            type: string
          description: Comma-separated sport IDs. Whitespace is trimmed, blank entries are ignored and duplicates are removed. Omitting the parameter or leaving it empty returns HTTP 400.
        - $ref: '#/components/parameters/OffsetQuery'
        - $ref: '#/components/parameters/DateFormatQuery'
        - $ref: '#/components/parameters/ExcludeCanceledQuery'
      responses:
        '200':
          description: Dates keyed by sport ID
          content:
            application/json:
              schema:
                type: object
                additionalProperties:
                  type: object
                  properties:
                    dates:
                      type: array
                      description: One entry per caller-local day with events, in ascending order. Lists today and later days, plus the previous day while one of its events is still unfinished.
                      items:
                        oneOf:
                          - type: string
                            description: "Default `format=iso8601`: the earliest event start on that day, shifted by `offset` minutes and written as `YYYY-MM-DDTHH:MM:SS+0000`. The first 10 characters are the caller-local date."
                          - type: integer
                            description: "With `format=epoch`: the same shifted value in Unix seconds."
              example:
                "2":
                  dates: []
                "3":
                  dates: []
                "4":
                  dates:
                    - "2026-02-13T00:30:00+0000"
                "6":
                  dates:
                    - "2026-02-13T00:00:00+0000"
        '400':
          description: "`sport_ids` is missing or empty"
          content:
            application/json:
              example:
                error: "sport_ids query parameter is required"

  /api/v2/sports/events/{date}:
    get:
      operationId: v2GetEventsByDate
      tags: [V2 Sports]
      summary: Get events across sports for a date
      description: Returns schedule listing dates grouped by sport (`sport_id` → date strings) for the given date.
      parameters:
        - name: date
          in: path
          required: true
          schema:
            type: string
            format: date
            example: '2026-01-15'
        - $ref: '#/components/parameters/SportIDsQuery'
        - $ref: '#/components/parameters/OffsetQuery'
      responses:
        '200':
          description: Schedule listing dates by sport
          content:
            application/json:
              schema:
                type: object
                additionalProperties:
                  type: array
                  items:
                    type: string
              example:
                "4":
                  - "2026-02-12"

  /api/v2/sports/markets/{date}:
    get:
      operationId: v2GetMarketsByDate
      tags: [V2 Sports]
      summary: Get available markets by date
      description: Returns available market definitions for each sport on the given date. Accepts the same filters as the single-sport `/api/v2/sports/{sportID}/markets/{date}` route.
      parameters:
        - name: date
          in: path
          required: true
          schema:
            type: string
            format: date
        - name: market_ids
          in: query
          schema:
            type: string
          description: Comma-separated market IDs to filter. Omit or leave blank to return all otherwise available market definitions. Limit 12 nonblank, trimmed entries per request; duplicates count toward this limit. More than 12 returns HTTP 400.
        - name: affiliate_ids
          in: query
          schema:
            type: string
          description: Comma-separated sportsbook/affiliate IDs to filter.
        - name: participant_ids
          in: query
          schema:
            type: string
          description: Comma-separated participant IDs to filter. Only the first 99 nonblank, trimmed entries are used; additional entries are ignored. Duplicates count toward this limit.
        - $ref: '#/components/parameters/ParticipantTypeQuery'
        - name: hide_closed_markets
          in: query
          schema:
            type: string
            enum: ['1']
          description: Set to `1` to hide closed markets
        - name: include_counts
          in: query
          description: Set to `1` to include `event_count` and `open_event_count` on each market definition after the request's filters. These fields are omitted unless `include_counts=1`.
          schema:
            type: integer
            enum: [0, 1]
        - $ref: '#/components/parameters/OffsetQuery'
      responses:
        '200':
          description: Markets keyed by sport ID
          content:
            application/json:
              schema:
                type: object
                additionalProperties:
                  type: array
                  items:
                    allOf:
                      - $ref: '#/components/schemas/Market'
                      - type: object
                        properties:
                          event_count:
                            type: integer
                            description: Present only with `include_counts=1`. Number of distinct games in the requested date window with at least one price for this market after the request's filters.
                          open_event_count:
                            type: integer
                            description: Present only with `include_counts=1`. Number of those games with at least one currently open price after the request's filters.
              example:
                "4":
                  - id: 1
                    name: "moneyline"
                    line_value_is_participant: true
                    proposition: true
                    description: "Moneyline: To win outright"
                    short_description: "Moneyline"
                    period_id: 0
                    live_variant_id: 41
                    updated_at: "2026-01-23T20:38:12Z"
                  - id: 2
                    name: "handicap"
                    line_value_is_participant: false
                    proposition: true
                    description: "Spread: Win or lose by margin of points"
                    short_description: "Spread"
                    period_id: 0
                    live_variant_id: 42
                    updated_at: "2026-01-23T20:42:13Z"
                  - id: 3
                    name: "totals"
                    line_value_is_participant: false
                    proposition: true
                    description: "Totals: Total points"
                    short_description: "Totals"
                    period_id: 0
                    live_variant_id: 43
                    updated_at: "2026-01-23T20:38:12Z"

  /api/v2/sports/{sportID}/teams:
    get:
      operationId: v2GetTeamsBySport
      tags: [V2 Sports]
      summary: Get teams for a sport
      parameters:
        - $ref: '#/components/parameters/SportIDPath'
      responses:
        '200':
          description: List of teams
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TeamsResponse'
              example:
                teams:
                  - team_id: 11
                    name: "Atlanta"
                    mascot: "Hawks"
                    abbreviation: "ATL"
                    record: "26-30"
                    conference:
                      conference_id: 39
                      sport_id: 4
                      name: "Eastern Conference"
                    division:
                      division_id: 17
                      conference_id: 39
                      sport_id: 4
                      name: "Southeast"
                  - team_id: 1
                    name: "Boston"
                    mascot: "Celtics"
                    abbreviation: "BOS"
                    record: "35-19"
                    conference:
                      conference_id: 39
                      sport_id: 4
                      name: "Eastern Conference"
                    division:
                      division_id: 15
                      conference_id: 39
                      sport_id: 4
                      name: "Atlantic"

  /api/v2/sports/{sportID}/events/{date}:
    get:
      operationId: v2GetEventsBySportAndDate
      tags: [V2 Events]
      summary: Get events with markets for a sport and date
      description: |
        Returns events with full market/odds data for the specified sport and date. This is the primary endpoint for building odds screens.

        `main_line=true` also excludes closed prices while selecting main lines.

        For known zero-delay access, this response's positive whole-integer `meta.delta_last_id` can bootstrap `/api/v2/markets/delta` only when this response explicitly reports `X-Data-Delay-Seconds: 0`. If that header is positive, absent, or invalid, use scoped snapshots instead; do not start market-delta polling with `0`.
      parameters:
        - $ref: '#/components/parameters/SportIDPath'
        - name: date
          in: path
          required: true
          schema:
            type: string
            format: date
            example: '2026-01-15'
        - $ref: '#/components/parameters/OffsetQuery'
        - $ref: '#/components/parameters/MarketIDsQuery'
        - $ref: '#/components/parameters/ParticipantIDsQuery'
        - $ref: '#/components/parameters/ParticipantTypeQuery'
        - $ref: '#/components/parameters/AffiliateIDsQuery'
        - $ref: '#/components/parameters/MainLineQuery'
        - $ref: '#/components/parameters/HideClosedQuery'
        - name: hide_no_markets
          in: query
          schema:
            type: string
            enum: ['true', 'false']
            default: 'false'
          description: Hide events with no market data
        - $ref: '#/components/parameters/EventStatusQuery'
        - name: exclude_status
          in: query
          schema:
            type: string
          description: Comma-separated event status strings to exclude
      responses:
        '200':
          description: Events with markets
          headers:
            X-Data-Delay-Seconds:
              description: >-
                Optional data-delay entitlement value in whole seconds. Only an
                explicit value of `0` confirms zero-delay access for
                market-delta bootstrap; a positive or missing value means use
                scoped snapshots.
              schema:
                type: integer
                minimum: 0
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EventsV2Response'
              example:
                meta:
                  delta_last_id: "193500000"
                events:
                  - event_id: "ada1bad2588972bb0f0e4debf9ed92b5"
                    sport_id: 4
                    event_uuid: "11f2-1f6d-22f0a800-8cca-2165a45d5e4a"
                    event_date: "2027-02-03T01:00:00Z"
                    score:
                      event_status: "STATUS_SCHEDULED"
                      score_away: 0
                      score_home: 0
                      game_period: 0
                      game_clock: 0
                    teams:
                      - team_id: 23
                        name: "Los Angeles"
                        mascot: "Lakers"
                        abbreviation: "LAL"
                        record: "38-18"
                        is_away: true
                        is_home: false
                      - team_id: 1
                        name: "Boston"
                        mascot: "Celtics"
                        abbreviation: "BOS"
                        record: "42-14"
                        is_away: false
                        is_home: true
                    schedule:
                      event_name: "Los Angeles Lakers at Boston Celtics"
                      season_type: "Regular Season"
                      season_year: 2026
                    markets:
                      - market_id: 1
                        period_id: 0
                        name: "moneyline"
                        participants:
                          - id: 23
                            type: "TYPE_TEAM"
                            name: "Los Angeles Lakers"
                            lines:
                              - value: ""
                                prices:
                                  "19":
                                    price: 150
                                    is_main_line: true
                                    updated_at: "2027-02-02T23:30:00Z"
                                  "23":
                                    price: 155
                                    is_main_line: true
                                    updated_at: "2027-02-02T23:28:00Z"
                          - id: 1
                            type: "TYPE_TEAM"
                            name: "Boston Celtics"
                            lines:
                              - value: ""
                                prices:
                                  "19":
                                    price: -180
                                    is_main_line: true
                                    updated_at: "2027-02-02T23:30:00Z"
                                  "23":
                                    price: -185
                                    is_main_line: true
                                    updated_at: "2027-02-02T23:28:00Z"
                      - market_id: 2
                        period_id: 0
                        name: "handicap"
                        participants:
                          - id: 23
                            type: "TYPE_TEAM"
                            name: "Los Angeles Lakers"
                            lines:
                              - value: "4.5"
                                prices:
                                  "19":
                                    price: -110
                                    is_main_line: true
                                    updated_at: "2027-02-02T23:30:00Z"
                                  "23":
                                    price: -108
                                    is_main_line: true
                                    updated_at: "2027-02-02T23:28:00Z"
                          - id: 1
                            type: "TYPE_TEAM"
                            name: "Boston Celtics"
                            lines:
                              - value: "-4.5"
                                prices:
                                  "19":
                                    price: -110
                                    is_main_line: true
                                    updated_at: "2027-02-02T23:30:00Z"
                                  "23":
                                    price: -112
                                    is_main_line: true
                                    updated_at: "2027-02-02T23:28:00Z"
                      - market_id: 3
                        period_id: 0
                        name: "totals"
                        participants:
                          - id: 1001
                            type: "TYPE_RESULT"
                            name: "Over"
                            lines:
                              - value: "224.5"
                                prices:
                                  "19":
                                    price: -110
                                    is_main_line: true
                                    updated_at: "2027-02-02T23:30:00Z"
                          - id: 1002
                            type: "TYPE_RESULT"
                            name: "Under"
                            lines:
                              - value: "224.5"
                                prices:
                                  "19":
                                    price: -110
                                    is_main_line: true
                                    updated_at: "2027-02-02T23:30:00Z"

  /api/v2/sports/{sportID}/dates:
    get:
      operationId: v2GetDatesBySportID
      tags: [V2 Sports]
      summary: Get available dates for a sport
      parameters:
        - $ref: '#/components/parameters/SportIDPath'
        - $ref: '#/components/parameters/OffsetQuery'
        - $ref: '#/components/parameters/DateFormatQuery'
        - $ref: '#/components/parameters/ExcludeCanceledQuery'
      responses:
        '200':
          description: List of dates
          content:
            application/json:
              schema:
                type: object
                properties:
                  dates:
                    type: array
                    description: One entry per caller-local day with events, in ascending order. Lists today and later days, plus the previous day while one of its events is still unfinished.
                    items:
                      oneOf:
                        - type: string
                          description: "Default `format=iso8601`: the earliest event start on that day, shifted by `offset` minutes and written as `YYYY-MM-DDTHH:MM:SS+0000`. The first 10 characters are the caller-local date."
                        - type: integer
                          description: "With `format=epoch`: the same shifted value in Unix seconds."
              example:
                dates:
                  - "2026-02-13T00:30:00+0000"
                  - "2026-02-14T00:00:00+0000"
                  - "2026-02-15T00:00:00+0000"

  /api/v2/sports/{sportID}/divisions:
    get:
      operationId: v2GetDivisionsBySport
      tags: [V2 Sports]
      summary: Get divisions for a sport
      parameters:
        - $ref: '#/components/parameters/SportIDPath'
      responses:
        '200':
          description: List of divisions
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DivisionsResponse'
              example:
                divisions:
                  - division_id: 15
                    conference_id: 39
                    sport_id: 4
                    name: "Atlantic"
                  - division_id: 16
                    conference_id: 39
                    sport_id: 4
                    name: "Central"
                  - division_id: 17
                    conference_id: 39
                    sport_id: 4
                    name: "Southeast"
                  - division_id: 18
                    conference_id: 757
                    sport_id: 4
                    name: "Northwest"
                  - division_id: 19
                    conference_id: 757
                    sport_id: 4
                    name: "Pacific"
                  - division_id: 20
                    conference_id: 757
                    sport_id: 4
                    name: "Southwest"

  /api/v2/sports/{sportID}/conferences:
    get:
      operationId: v2GetConferencesBySport
      tags: [V2 Sports]
      summary: Get conferences for a sport
      parameters:
        - $ref: '#/components/parameters/SportIDPath'
      responses:
        '200':
          description: List of conferences
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConferencesResponse'
              example:
                conferences:
                  - conference_id: 39
                    sport_id: 4
                    name: "Eastern Conference"
                  - conference_id: 757
                    sport_id: 4
                    name: "Western Conference"

  /api/v2/sports/{sportID}/openers/{date}:
    get:
      operationId: v2GetOpenersBySportAndDate
      tags: [V2 Events]
      summary: Get opening lines for a sport and date
      description: Returns events with the earliest recorded price for each available line at each sportsbook. Opening snapshots are available whenever a price has been recorded, including before, during, or after an event.
      parameters:
        - $ref: '#/components/parameters/SportIDPath'
        - name: date
          in: path
          required: true
          schema:
            type: string
            format: date
        - $ref: '#/components/parameters/OffsetQuery'
        - $ref: '#/components/parameters/MarketIDsQuery'
        - $ref: '#/components/parameters/AffiliateIDsQuery'
        - $ref: '#/components/parameters/MainLineQuery'
        - $ref: '#/components/parameters/EventStatusQuery'
        - $ref: '#/components/parameters/ExcludeStatusQuery'
        - $ref: '#/components/parameters/HideClosedQuery'
      responses:
        '200':
          description: Events with opening market prices
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EventsV2Response'
              example:
                meta: {}
                events:
                  - event_id: "09bfa53f8484a63e584398545c035932"
                    sport_id: 4
                    event_date: "2026-02-12T00:00:00Z"
                    teams:
                      - team_id: 11
                        name: "Atlanta"
                        mascot: "Hawks"
                        abbreviation: "ATL"
                        is_away: true
                        is_home: false
                      - team_id: 12
                        name: "Charlotte"
                        mascot: "Hornets"
                        abbreviation: "CHA"
                        is_away: false
                        is_home: true
                    markets:
                      - market_id: 1
                        name: "moneyline"
                        participants:
                          - name: "Atlanta Hawks"
                            type: "TYPE_TEAM"
                            lines:
                              - value: "0"
                                prices:
                                  "19":
                                    price: -105
                                    is_main_line: true
                                    updated_at: "2026-02-11T22:00:00Z"

  /api/v2/sports/{sportID}/closing/{date}:
    get:
      operationId: v2GetClosingBySportAndDate
      tags: [V2 Events]
      summary: Get closing lines for a sport and date
      description: |
        Returns events with the latest recorded price for each available line and sportsbook at or before each event's scheduled start time. Before an event starts, the snapshot is provisional. Period markets use the event start time as their closing cutoff.

        Historical-data access and the event-date lookback depend on your plan. Omit `hide_closed` or use `false` to include currently closed prices in completed-event snapshots. Events can be returned without prices when no recorded lines match the filters. Use market history for price changes over time; see the [Historical Odds guide](/guides/historical-odds).
      parameters:
        - $ref: '#/components/parameters/SportIDPath'
        - name: date
          in: path
          required: true
          schema:
            type: string
            format: date
        - $ref: '#/components/parameters/OffsetQuery'
        - $ref: '#/components/parameters/MarketIDsQuery'
        - $ref: '#/components/parameters/AffiliateIDsQuery'
        - $ref: '#/components/parameters/MainLineQuery'
        - $ref: '#/components/parameters/EventStatusQuery'
        - $ref: '#/components/parameters/ExcludeStatusQuery'
        - $ref: '#/components/parameters/HideClosedQuery'
      responses:
        '200':
          description: Events with closing market prices
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EventsV2Response'
        '400':
          description: Invalid request parameters
        '401':
          description: Missing or invalid API key
        '403':
          description: The requested historical data is not available for this plan

  /api/v2/sports/{sportID}/markets/{date}:
    get:
      operationId: v2GetMarketsBySportAndDate
      tags: [V2 Markets]
      summary: Get available markets for a sport and date
      parameters:
        - $ref: '#/components/parameters/SportIDPath'
        - name: date
          in: path
          required: true
          schema:
            type: string
            format: date
        - name: market_ids
          in: query
          schema:
            type: string
          description: Comma-separated market IDs to filter. Omit or leave blank to return all otherwise available market definitions. Limit 12 nonblank, trimmed entries per request; duplicates count toward this limit. More than 12 returns HTTP 400.
        - name: affiliate_ids
          in: query
          schema:
            type: string
          description: Comma-separated sportsbook/affiliate IDs to filter.
        - name: participant_ids
          in: query
          schema:
            type: string
          description: Comma-separated participant IDs to filter. Only the first 99 nonblank, trimmed entries are used; additional entries are ignored. Duplicates count toward this limit.
        - $ref: '#/components/parameters/ParticipantTypeQuery'
        - name: hide_closed_markets
          in: query
          schema:
            type: string
            enum: ['1']
          description: Set to `1` to hide closed markets
        - name: include_counts
          in: query
          description: Set to `1` to include `event_count` and `open_event_count` on each market definition after the request's filters. These fields are omitted unless `include_counts=1`.
          schema:
            type: integer
            enum: [0, 1]
        - $ref: '#/components/parameters/OffsetQuery'
      responses:
        '200':
          description: Markets for this sport
          content:
            application/json:
              schema:
                type: object
                additionalProperties:
                  type: array
                  items:
                    allOf:
                      - $ref: '#/components/schemas/Market'
                      - type: object
                        properties:
                          event_count:
                            type: integer
                            description: Present only with `include_counts=1`. Number of distinct games in the requested date window with at least one price for this market after the request's filters.
                          open_event_count:
                            type: integer
                            description: Present only with `include_counts=1`. Number of those games with at least one currently open price after the request's filters.
              example:
                "4":
                  - id: 29
                    name: "points"
                    line_value_is_participant: false
                    proposition: true
                    description: "Points: How many points will this player score?"
                    short_description: "Points"
                    period_id: 0
                    live_variant_id: 90
                    updated_at: "2026-01-23T20:38:12Z"
                  - id: 35
                    name: "player_rebounds"
                    line_value_is_participant: false
                    proposition: true
                    description: "Rebounds: How many rebounds will this player record?"
                    short_description: "Rebounds"
                    period_id: 0
                    live_variant_id: 982
                    updated_at: "2026-01-23T20:38:12Z"

  # ─── V2 EVENTS ────────────────────────────────────────────────────────
  /api/v2/events/{eventID}:
    get:
      operationId: v2GetEventByID
      tags: [V2 Events]
      summary: Get a single event with markets
      description: '`main_line=true` also excludes closed prices while selecting main lines.'
      parameters:
        - $ref: '#/components/parameters/EventIDPath'
        - $ref: '#/components/parameters/MarketIDsQuery'
        - $ref: '#/components/parameters/ParticipantIDsQuery'
        - $ref: '#/components/parameters/ParticipantTypeQuery'
        - $ref: '#/components/parameters/AffiliateIDsQuery'
        - $ref: '#/components/parameters/MainLineQuery'
        - $ref: '#/components/parameters/HideClosedQuery'
      responses:
        '200':
          description: Event with markets
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EventsV2Response'
              example:
                meta: null
                events:
                  - event_id: "09bfa53f8484a63e584398545c035932"
                    sport_id: 4
                    event_date: "2026-02-12T00:00:00Z"
                    rotation_number_away: 529
                    rotation_number_home: 530
                    score:
                      event_status: "STATUS_FINAL"
                      score_away: 107
                      score_home: 110
                      score_away_by_period: [27, 22, 26, 32]
                      score_home_by_period: [35, 23, 31, 21]
                      venue_name: "Spectrum Center"
                      venue_location: "Charlotte, NC"
                      broadcast: "FanDuel SN SE"
                      event_status_detail: "Final"
                    teams:
                      - team_id: 11
                        name: "Atlanta"
                        mascot: "Hawks"
                        abbreviation: "ATL"
                        record: "26-30"
                        is_away: true
                        is_home: false
                      - team_id: 12
                        name: "Charlotte"
                        mascot: "Hornets"
                        abbreviation: "CHA"
                        record: "26-29"
                        is_away: false
                        is_home: true
                    schedule:
                      league_name: "National Basketball Association"
                      season_type: "Regular Season"
                      season_year: 2026
                    markets:
                      - id: 2518418
                        market_id: 1
                        name: "moneyline"
                        participants:
                          - name: "Atlanta Hawks"
                            type: "TYPE_TEAM"
                            lines:
                              - value: "0"
                                prices:
                                  "19":
                                    price: -105
                                    is_main_line: true
                                    updated_at: "2026-02-11T22:00:00Z"
                      - id: 2518419
                        market_id: 2
                        name: "handicap"
                        participants:
                          - name: "Atlanta Hawks"
                            type: "TYPE_TEAM"
                            lines:
                              - value: "4.5"
                                prices:
                                  "19":
                                    price: -110
                                    is_main_line: true
                                    updated_at: "2026-02-11T22:00:00Z"
                      - id: 2518420
                        market_id: 3
                        name: "totals"
                        participants:
                          - name: "Over"
                            type: "TYPE_RESULT"
                            lines:
                              - value: "235.5"
                                prices:
                                  "19":
                                    price: -110
                                    is_main_line: true
                                    updated_at: "2026-02-12T00:10:43Z"
        '400':
          description: 'No event matches `eventID` (`{"error": "event with event_id=... not found"}`), or another parameter is invalid.'

  /api/v2/events/{eventID}/openers:
    get:
      operationId: v2GetEventOpeners
      tags: [V2 Events]
      summary: Get opening prices for an event
      description: Returns the earliest recorded price for each available line at each sportsbook. Opening snapshots are available whenever a price has been recorded, including before, during, or after an event. The response always uses an `events` array, even for one event ID.
      parameters:
        - $ref: '#/components/parameters/EventIDPath'
        - $ref: '#/components/parameters/MarketIDsQuery'
        - $ref: '#/components/parameters/AffiliateIDsQuery'
        - $ref: '#/components/parameters/MainLineQuery'
        - $ref: '#/components/parameters/HideClosedQuery'
      responses:
        '200':
          description: Event with opening prices
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EventsV2Response'
              example:
                meta: {}
                events:
                  - event_id: "09bfa53f8484a63e584398545c035932"
                    sport_id: 4
                    event_date: "2026-02-12T00:00:00Z"
                    teams:
                      - team_id: 11
                        name: "Atlanta"
                        mascot: "Hawks"
                        abbreviation: "ATL"
                        is_away: true
                        is_home: false
                      - team_id: 12
                        name: "Charlotte"
                        mascot: "Hornets"
                        abbreviation: "CHA"
                        is_away: false
                        is_home: true
                    markets:
                      - market_id: 1
                        name: "moneyline"
                        participants:
                          - name: "Atlanta Hawks"
                            type: "TYPE_TEAM"
                            lines:
                              - value: "0"
                                prices:
                                  "19":
                                    price: -120
                                    is_main_line: true
                                    updated_at: "2026-02-10T15:00:00Z"
        '400':
          description: Invalid request parameters
        '401':
          description: Missing or invalid API key
        '403':
          description: The requested historical data is not available for this plan

  /api/v2/events/{eventID}/closing:
    get:
      operationId: v2GetEventClosing
      tags: [V2 Events]
      summary: Get closing prices for an event
      description: |
        Returns the latest recorded price for each available line and sportsbook at or before the event's scheduled start time. Before the event starts, the snapshot is provisional. Period markets use the event start time as their closing cutoff. The response always uses an `events` array, even for one event ID.

        Historical-data access and the event-date lookback depend on your plan. Omit `hide_closed` or use `false` to include currently closed prices in completed-event snapshots. The event can be returned without prices when no recorded lines match the filters.

        For price changes over time, use `GET /api/v2/events/{eventID}/markets/history` or `GET /api/v2/events/{eventID}/markets/{marketID}/history`. See the [Historical Odds guide](/guides/historical-odds) for examples.
      parameters:
        - $ref: '#/components/parameters/EventIDPath'
        - $ref: '#/components/parameters/MarketIDsQuery'
        - $ref: '#/components/parameters/AffiliateIDsQuery'
        - $ref: '#/components/parameters/MainLineQuery'
        - $ref: '#/components/parameters/HideClosedQuery'
      responses:
        '200':
          description: Event with closing prices
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EventsV2Response'
              example:
                meta: {}
                events:
                - event_id: ebb2dc1a9b7c2e32c4468da5ba60a526
                  sport_id: 3
                  event_date: '2026-09-09T17:10:00Z'
                  markets:
                  - id: 6001161
                    market_id: 11
                    period_id: 0
                    name: bases
                    market_description: Over/under on total bases recorded by a player.
                    participants:
                    - id: 1330
                      type: TYPE_PLAYER
                      name: Kody Clemens
                      lines:
                      - id: 4155be99fb37f9ba2e9fa360e422ea0a
                        value: Under 1.5
                        prices:
                          '19':
                            id: '679182630'
                            price: -149
                            price_delta: -5
                            is_main_line: true
                            updated_at: '2026-09-09T16:27:46Z'
        '400':
          description: Invalid request parameters
        '401':
          description: Missing or invalid API key
        '403':
          description: The requested historical data is not available for this plan

  /api/v2/events/{eventID}/markets:
    get:
      operationId: v2GetAvailableMarketsByEvent
      tags: [V2 Markets]
      summary: Get available markets for an event
      description: Returns the list of market definitions available for this event (not prices; use the event endpoint with market_ids for prices).
      parameters:
        - $ref: '#/components/parameters/EventIDPath'
        - name: market_ids
          in: query
          schema:
            type: string
          description: |
            Optional comma-separated market IDs, trimmed with blank tokens ignored. Omit or leave blank to return all market definitions available for this event; this endpoint does not use the event-price endpoint's default market IDs 1,2,3. At most 12 IDs are accepted; more returns HTTP 400.
        - name: participant_ids
          in: query
          schema:
            type: string
          description: |
            Optional comma-separated participant IDs (up to 99 tokens). Tokens are trimmed and blank tokens ignored; excess tokens after the first 99 are ignored. This filter applies independently of participant_type.
        - name: participant_type
          in: query
          schema:
            type: string
            enum: [TYPE_TEAM, TYPE_PLAYER, TYPE_RESULT]
          description: |
            Optional participant type. Only the exact uppercase values TYPE_TEAM, TYPE_PLAYER, and TYPE_RESULT activate this filter; other values are ignored rather than rejected.
        - name: affiliate_ids
          in: query
          schema:
            type: string
          description: |
            Optional comma-separated affiliate IDs used to filter the price rows that determine which market definitions are returned. On this endpoint, 0 is an ordinary filter value, not the scores-only sentinel used by selected event-odds endpoints.
        - name: hide_closed
          in: query
          schema:
            type: string
          description: |
            Omitted, blank, or the case-insensitive exact value false includes definitions with matching closed-price rows. Any other nonempty value filters to currently open price rows. The value is not whitespace-trimmed. This event endpoint uses hide_closed, not hide_closed_markets.
        - name: class
          in: query
          schema:
            type: string
          description: |
            Optional comma-separated catalog class filter: core, prop, future, special. Values are case-sensitive, trimmed, and blank tokens are ignored. Valid values are OR-combined; class and family filters combine with AND. Unknown tokens are ignored, and an all-unknown or blank filter is absent. Uncatalogued markets use class=special for this filter.
        - name: family
          in: query
          schema:
            type: string
          description: |
            Optional comma-separated catalog family filter: moneyline, spread, total, team_total, player_ou, winning_margin, outright_winner, top_scorer, win_total, top_n_finish, make_cut, exact_result, other. Values are case-sensitive, trimmed, and blank tokens are ignored. Valid values are OR-combined; class and family filters combine with AND. Unknown tokens are ignored, and an all-unknown or blank filter is absent. Uncatalogued markets use family=other for this filter.
      responses:
        '200':
          description: Available markets
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Market'
              example:
                - id: 1
                  name: "moneyline"
                  line_value_is_participant: true
                  proposition: true
                  description: "Moneyline: To win outright"
                  short_description: "Moneyline"
                  period_id: 0
                  live_variant_id: 41
                - id: 2
                  name: "handicap"
                  line_value_is_participant: false
                  proposition: true
                  description: "Spread: Win or lose by margin of points"
                  short_description: "Spread"
                  period_id: 0
                  live_variant_id: 42
                - id: 3
                  name: "totals"
                  line_value_is_participant: false
                  proposition: true
                  description: "Totals: Total points"
                  short_description: "Totals"
                  period_id: 0
                  live_variant_id: 43
                - id: 29
                  name: "points"
                  line_value_is_participant: false
                  proposition: true
                  description: "Points: How many points will this player score?"
                  short_description: "Points"
                  period_id: 0
                  live_variant_id: 90
        '400':
          description: Invalid parameters, including more than 12 market_ids.

  /api/v2/events/{eventID}/markets/history:
    get:
      operationId: v2GetMarketHistoryByEvent
      tags: [V2 Markets]
      summary: Get market price history for an event
      description: |
        Returns recorded price changes for the requested markets and sportsbooks, subject to your plan's historical-data access. Data can be available before, during, or after an event as prices are recorded. Each response is bounded by the requested limit.

        Each market is read on its own. `affiliate_ids` is optional and takes any number of sportsbook ids; omitted means every sportsbook your plan includes. `limit` applies to each market, and one response carries at most 15,000 rows (more than 3 markets lowers each market's limit to 15,000 divided by the number of markets).

        With `main_line=true`, `affiliate_ids` is required and takes 1 to 3 sportsbook ids, for example `19`, `19,23`, or `19,23,22`, and `limit` caps the whole response. Repeated ids count once. Omitting the parameter, a blank value, `0`, or a non-numeric id returns HTTP 400: `affiliate_ids is required with main_line=true; pass 1 to 3 sportsbook ids`. More than 3 distinct ids returns HTTP 400: `with main_line=true, affiliate_ids accepts at most 3 sportsbook ids per request`. These requests are rejected before any history read. `affiliate_ids=0` is not a scores-only sentinel here.
      parameters:
        - $ref: '#/components/parameters/EventIDPath'
        - name: market_ids
          in: query
          schema:
            type: string
          description: Comma-separated market IDs to filter. Defaults to `1,2,3`; maximum 12. Filtered literally, so live IDs are not added automatically; pass `41,42,43,96` for in-play history (for example `1,2,3,41,42,43,96`).
        - name: affiliate_ids
          in: query
          required: false
          schema:
            type: string
          description: |
            Optional comma-separated sportsbook ids, any number. Omitted means every sportsbook your plan includes; ids your plan does not include are left out. Repeated ids count once.

            Required with `main_line=true`, where it takes 1 to 3 ids, for example `19` (DraftKings), `19,23` (DraftKings and FanDuel), or `19,23,22` (DraftKings, FanDuel, and BetMGM). There, missing, blank, `0`, or a non-numeric id returns HTTP 400 with `affiliate_ids is required with main_line=true; pass 1 to 3 sportsbook ids`, and more than 3 distinct ids returns HTTP 400 with `with main_line=true, affiliate_ids accepts at most 3 sportsbook ids per request`. This endpoint does not treat `affiliate_ids=0` as a scores-only sentinel.
        - name: from
          in: query
          schema:
            type: string
            format: date-time
          description: Inclusive start time (RFC3339)
        - name: to
          in: query
          schema:
            type: string
            format: date-time
          description: Inclusive end time (RFC3339)
        - name: limit
          in: query
          schema:
            type: integer
            default: 1000
            maximum: 5000
          description: Maximum rows per requested market. One response carries at most 15,000 rows, so more than 3 markets lowers each market's limit to 15,000 divided by the number of markets. With `main_line=true`, maximum rows across all markets. Invalid or out-of-range values use 1000.
        - $ref: '#/components/parameters/MainLineHistoryQuery'
      responses:
        '200':
          description: Market price history, newest first across markets. There is no paging cursor or truncation flag; narrow the request scope or time window if a market reaches its limit.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MarketHistoryResponse'
              example:
                meta:
                  event_id: "09bfa53f8484a63e584398545c035932"
                  count: 2
                history:
                  - id: 500002
                    market_line_price_id: 192868821
                    event_id: "09bfa53f8484a63e584398545c035932"
                    sport_id: 4
                    affiliate_id: 19
                    market_participant_id: 45001
                    market_id: 1
                    line: ""
                    price: "-110"
                    previous_price: "-105"
                    change_type: "price"
                    updated_at: "2026-02-11T09:30:00Z"
                    is_main_line: true
                  - id: 500001
                    market_line_price_id: 192868821
                    event_id: "09bfa53f8484a63e584398545c035932"
                    sport_id: 4
                    affiliate_id: 19
                    market_participant_id: 45001
                    market_id: 1
                    line: ""
                    price: "-105"
                    change_type: "open"
                    updated_at: "2026-02-10T14:00:00Z"
                    is_main_line: true
        '400':
          description: |
            With `main_line=true`, `affiliate_ids` is missing, blank, zero, non-numeric, or lists more than 3 distinct sportsbooks; no history read runs. Also returned when the request covers more current or closed lines than the per-request limit (20,000 without `main_line`, 2,000 with it), or the reader times out.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
              examples:
                affiliate_required:
                  summary: No usable sportsbook id
                  value:
                    error: "affiliate_ids is required with main_line=true; pass 1 to 3 sportsbook ids"
                affiliate_limit:
                  summary: More than 3 sportsbook ids
                  value:
                    error: "with main_line=true, affiliate_ids accepts at most 3 sportsbook ids per request"
                too_wide:
                  summary: More current or closed lines than the per-request limit
                  value:
                    error: "event market history for this request covers more than 20000 current or closed lines, the per-request limit; pass fewer affiliate_ids and/or a tighter market_ids, from, or to window"

  /api/v2/events/{eventID}/markets/opening:
    get:
      operationId: v2GetOpeningPricesByEvent
      tags: [V2 Markets]
      summary: Get opening prices for an event's markets
      parameters:
        - $ref: '#/components/parameters/EventIDPath'
        - name: market_ids
          in: query
          schema:
            type: string
            default: '1,2,3'
          description: Comma-separated market IDs, up to 12. Omit or leave blank for the default `1,2,3`; this endpoint does not use the sport-aware `1,2,3,563` default of the event price endpoints. More than 12 returns HTTP 400.
        - $ref: '#/components/parameters/AffiliateIDsQuery'
      responses:
        '200':
          description: Opening prices
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OpeningPricesResponse'
              example:
                meta:
                  event_id: "09bfa53f8484a63e584398545c035932"
                  count: 2
                markets:
                  "1":
                    market_id: 1
                    market_name: "moneyline"
                    lines:
                      "45001:":
                        participant_id: 11
                        participant_type: "TYPE_TEAM"
                        participant_name: "Atlanta Hawks"
                        prices:
                          "19":
                            price: "-120"
                            timestamp: "2026-02-10T14:00:00Z"
                          "23":
                            price: "-115"
                            timestamp: "2026-02-10T14:05:00Z"
        '400':
          description: More than 12 `market_ids`
          content:
            application/json:
              example:
                error: "market_ids accepts at most 12 IDs per request; received 13. Split larger requests into batches of 12 or omit market_ids to use the default 1,2,3"

  /api/v2/events/{eventID}/markets/{marketID}/history:
    get:
      operationId: v2GetMarketLineHistoryByEvent
      tags: [V2 Markets]
      summary: Get line price chart data for a specific market
      description: >-
        Returns time-series price data suitable for charting line movement. To
        chart one participant, first discover its public `participant_id` with
        `GET /api/v2/markets/participants` for the same event and market, then
        pass that value here. For totals (market `3`), discover the
        `TYPE_RESULT` Over and Under participants and request each side
        separately. Series are grouped by affiliate and can otherwise contain
        points for more than one participant. `main_line=true` keeps only the
        points that were the main line when written.
      parameters:
        - $ref: '#/components/parameters/EventIDPath'
        - name: marketID
          in: path
          required: true
          schema:
            type: integer
          description: Market ID
        - name: participant_id
          in: query
          schema:
            type: integer
          description: >-
            Filter by the public canonical `participant_id` returned by
            `GET /api/v2/markets/participants` for this event and market. For
            totals (market `3`), use the discovered `TYPE_RESULT` Over or Under
            participant ID; do not substitute the participant record `id`.
        - $ref: '#/components/parameters/AffiliateIDsQuery'
        - name: line
          in: query
          schema:
            type: string
          description: Filter by line value
        - name: from
          in: query
          schema:
            type: string
            format: date-time
          description: Inclusive start time (RFC3339)
        - name: to
          in: query
          schema:
            type: string
            format: date-time
          description: Inclusive end time (RFC3339)
        - name: limit
          in: query
          schema:
            type: integer
            default: 1000
            maximum: 5000
          description: Maximum total points across all returned sportsbooks. Invalid or out-of-range values use 1000.
        - $ref: '#/components/parameters/MainLineHistoryQuery'
      responses:
        '200':
          description: Chart series data, oldest first. The limit applies across all returned sportsbooks; there is no paging cursor or truncation flag.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChartResponse'
              example:
                meta:
                  event_id: "09bfa53f8484a63e584398545c035932"
                  market_id: 3
                  market_name: "totals"
                series:
                  "19":
                    affiliate_name: "Affiliate 19"
                    data:
                      - t: "2026-02-10T14:00:00Z"
                        p: "-110"
                        l: "224.5"
                        m: true
                      - t: "2026-02-11T09:30:00Z"
                        p: "-112"
                        l: "224.5"
                        m: true
                      - t: "2026-02-11T22:00:00Z"
                        p: "-108"
                        l: "225.5"
                        m: true
                  "23":
                    affiliate_name: "Affiliate 23"
                    data:
                      - t: "2026-02-10T14:05:00Z"
                        p: "-108"
                        l: "224.5"
                        m: true
                      - t: "2026-02-11T10:00:00Z"
                        p: "-110"
                        l: "224.5"
                        m: true
        '400':
          description: >-
            With `participant_id`, `line`, or `main_line=true`, the request read
            40,000 recorded prices without filling `limit`, or the history read
            timed out. Pass fewer `affiliate_ids` or a shorter `from`/`to`
            window.
          content:
            application/json:
              example:
                error: "chart history for this request would read more than 40000 history rows to apply participant_id, line, or main_line; pass fewer affiliate_ids or a tighter from/to window"

  /api/v2/events/{eventID}/best-line:
    get:
      operationId: v2GetBestLineByEvent
      tags: [V2 Events]
      summary: Get best available line for an event
      description: Returns the best moneyline, spread, and total across all sportsbooks.
      parameters:
        - $ref: '#/components/parameters/EventIDPath'
        - name: period
          in: query
          schema:
            type: string
            default: period_full_game
            enum:
              - period_full_game
              - period_first_half
              - period_second_half
              - period_first_period
              - period_second_period
              - period_third_period
              - period_fourth_period
              - period_live_full_game
              - period_live_first_half
              - period_live_second_half
              - period_live_first_period
              - period_live_second_period
              - period_live_third_period
              - period_live_fourth_period
          description: Period to get best line for
        - $ref: '#/components/parameters/AffiliateIDsQuery'
      responses:
        '200':
          description: Best lines
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BestLineResponse'
              example:
                event_id: "09bfa53f8484a63e584398545c035932"
                moneyline:
                  moneyline_away: 155
                  moneyline_home: -170
                  best_affiliate_away:
                    affiliate_id: 23
                    affiliate_name: "Fanduel"
                    updated_at: "2026-02-12T00:10:00Z"
                  best_affiliate_home:
                    affiliate_id: 19
                    affiliate_name: "Draftkings"
                    updated_at: "2026-02-12T00:10:00Z"
                spread:
                  point_spread_away: 4.5
                  point_spread_home: -4.5
                  point_spread_away_money: -105
                  point_spread_home_money: -108
                  best_affiliate_away:
                    affiliate_id: 3
                    affiliate_name: "Pinnacle"
                    updated_at: "2026-02-12T00:08:00Z"
                  best_affiliate_home:
                    affiliate_id: 23
                    affiliate_name: "Fanduel"
                    updated_at: "2026-02-12T00:10:00Z"
                total:
                  total_over: 224.5
                  total_under: 224.5
                  total_over_money: -108
                  total_under_money: -105
                  best_affiliate_over:
                    affiliate_id: 19
                    affiliate_name: "Draftkings"
                    updated_at: "2026-02-12T00:10:00Z"
                  best_affiliate_under:
                    affiliate_id: 3
                    affiliate_name: "Pinnacle"
                    updated_at: "2026-02-12T00:08:00Z"

  /api/v2/events/{eventID}/stats:
    get:
      operationId: v2GetStatsByEvent
      tags: [V2 Stats]
      summary: Get team game stats for an event
      parameters:
        - $ref: '#/components/parameters/EventIDPath'
        - name: stats_ids
          in: query
          schema:
            type: string
          description: Comma-separated stat IDs. Only the first 12 nonblank entries are used; additional entries are ignored. `stat_ids` is accepted as an alias when `stats_ids` is absent.
        - name: team_id
          in: query
          schema:
            type: integer
          description: Filter by team ID
      responses:
        '200':
          description: Team game stats
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/TeamGameStatResponse'
              example:
                - team:
                    team_id: 11
                    name: "Atlanta"
                    mascot: "Hawks"
                    abbreviation: "ATL"
                    is_away: true
                    is_home: false
                  meta:
                    complete: true
                    event_id: "5a0c9d5d8d3e2c0001a1b2c3"
                  stats:
                    - team_id: 11
                      stat_id: 1242
                      stat:
                        id: 1242
                        name: "avgRebounds"
                        display_name: "Rebounds Per Game"
                        abbreviation: "REB"
                        sport_id: 4
                      event_id: "5a0c9d5d8d3e2c0001a1b2c3"
                      value: "42"
                    - team_id: 11
                      stat_id: 1243
                      stat:
                        id: 1243
                        name: "assistTurnoverRatio"
                        display_name: "Assist To Turnover Ratio"
                        abbreviation: "AST/TO"
                        sport_id: 4
                      event_id: "5a0c9d5d8d3e2c0001a1b2c3"
                      value: "2.26"

  /api/v2/events/{eventID}/players/stats:
    get:
      operationId: v2GetPlayerStatsByEvent
      tags: [V2 Stats]
      summary: Get player game stats for an event
      parameters:
        - $ref: '#/components/parameters/EventIDPath'
        - name: stats_ids
          in: query
          schema:
            type: string
          description: Comma-separated stat IDs. Only the first 12 nonblank entries are used; additional entries are ignored. `stat_ids` is accepted as an alias when `stats_ids` is absent.
        - name: player_ids
          in: query
          schema:
            type: string
          description: Comma-separated player IDs. Only the first 6 nonblank entries are used; additional entries are ignored.
      responses:
        '200':
          description: Player game stats
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/PlayerGameStatResponse'
              example:
                - player:
                    id: 16566
                    sport_id: 4
                    team_id: 29
                    updated_at: '2026-10-16T08:00:43Z'
                    first_name: Zion
                    last_name: Williamson
                    display_name: Zion Williamson
                    weight: 284
                    height: 78
                    display_weight: 284 lbs
                    display_height: 6' 6"
                    age: 26
                    date_of_birth: 2000-07-06T07:00Z
                    slug: zion-williamson
                    jersey: '1'
                    position: Forward
                    position_abbreviation: F
                    birth_place_city: Salisbury
                    birth_place_country: USA
                    experience_years: 0
                    active: true
                    status: Active
                  meta:
                    complete: true
                    event_id: 4da852b74a096afec78d67f1b938294c
                  stats:
                  - stat:
                      id: 1269
                      name: points
                      category: offensive
                      display_name: Points
                      abbreviation: PTS
                      description: The number of points scored.
                      sport_id: 4
                    value: '23'
                    updated_at: '2026-11-05T04:01:40Z'
                  - stat:
                      id: 1271
                      name: assists
                      category: offensive
                      display_name: Assists
                      abbreviation: AST
                      description: The number of times a player who passes the ball to a teammate in a way that leads to a score by field goal, meaning that he or she was "assisting" in the basket. There is some judgment involved in deciding whether a passer should be credited with an assi
                      sport_id: 4
                    value: '2'
                    updated_at: '2026-11-05T03:13:34Z'

  /api/v2/events/{eventID}/plays:
    get:
      operationId: v2GetPlaysByEvent
      tags: [V2 Events]
      summary: Get play-by-play for an event
      description: >
        Returns the play-by-play timeline for a live or completed event:
        one entry per play with description, period, game clock, running
        score, and (as attribution rolls out) the players involved.
        Live game state and play-by-play require an **Ultra plan or
        higher**; keys on lower tiers receive a `403`. The companion
        `live_game_state` snapshot (current inning/quarter, count, base
        runners, possession, and more) is embedded on live event payloads
        for entitled keys. Also available for streaming via the `plays`
        channel on the V2 WebSocket.
      parameters:
        - $ref: '#/components/parameters/EventIDPath'
        - name: limit
          in: query
          schema:
            type: integer
            default: 50
            maximum: 500
          description: Number of plays to return. The most recent plays are selected (with `after_sequence`, the oldest plays after the cursor), then returned in ascending `sequence` order. Values above 500 are capped.
        - name: before_sequence
          in: query
          schema:
            type: integer
          description: "Pagination cursor: returns plays with `sequence` lower than this value. Use the lowest `sequence` from the previous page to walk backwards through long games. Cannot be combined with `after_sequence`."
        - name: after_sequence
          in: query
          schema:
            type: integer
            minimum: 1
          description: "Catch-up cursor: returns plays with `sequence` higher than this value, oldest first, up to `limit`. Pass the highest `sequence` you already have to fetch newer plays; if a page returns `limit` plays, repeat with the new highest `sequence`. Cannot be combined with `before_sequence` (HTTP 400). `0` or a non-numeric value is ignored."
      responses:
        '200':
          description: Play-by-play timeline
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PlaysResponse'
              example:
                event_id: 57be79dde71db0d68fa95e13cb8b9d3d
                sport_id: 3
                sport: mlb
                plays:
                - play_id: 12040643
                  sequence: 297
                  team_id: 54
                  period: 8
                  half_indicator: bot
                  type: play_result
                  description: Bobby Witt doubles
                  scoring_play: false
                  score_away_after: 7
                  score_home_after: 3
                  occurred_at: '2026-09-27T01:14:09.302Z'
                  participants:
                  - player_id: 1641
                    name: Bobby Witt Jr.
                    team_id: 54
                    role: batter
                    position: SS
                  - player_id: 12925668
                    name: Craig Yoho
                    team_id: 52
                    role: pitcher
                    position: RP
                  mlb:
                    batter:
                      player_id: 1641
                      name: Bobby Witt Jr.
                      team_id: 54
                    pitcher:
                      player_id: 12925668
                      name: Craig Yoho
                      team_id: 52
                latest_sequence: 385
                latest_play_id: 12042886
        '400':
          description: "`before_sequence` and `after_sequence` were both provided"
          content:
            application/json:
              example:
                error: "before_sequence and after_sequence cannot be combined"
        '403':
          description: The API key's plan does not include live game state
          content:
            application/json:
              example:
                error: "Live game state requires Ultra plan or higher"
                upgrade_url: "/pricing/api"

  # ─── V2 MARKETS ───────────────────────────────────────────────────────
  /api/v2/markets:
    get:
      operationId: v2GetAllMarkets
      tags: [V2 Markets]
      summary: List all market definitions
      description: |
        Returns the canonical market catalog with classification, sport
        membership and an in-play-period flag, ordered by market ID. This
        endpoint returns all matching definitions in one array.

        All filters are optional and AND-combined; comma-separated values within
        a filter are OR-combined. Omitting filters returns all definitions.
        Uncatalogued markets use class=special, family=other and settlement=event;
        scope has no default. A sport_id filter selects markets but preserves
        each market's full sorted sports array.
      parameters:
        - name: class
          in: query
          description: >-
            Optional comma-separated class filter. Accepted tokens: core, prop,
            future, special. Tokens are trimmed, case-sensitive and deduplicated;
            blank tokens are ignored. An empty or whitespace-only value is absent.
            Values within this filter combine with OR;
            different filters combine with AND. An unknown token returns 400.
          schema:
            type: string
        - name: family
          in: query
          description: >-
            Optional comma-separated family filter. Accepted tokens: moneyline,
            spread, total, team_total, player_ou, winning_margin, outright_winner,
            top_scorer, win_total, top_n_finish, make_cut, exact_result, other.
            Tokens are trimmed, case-sensitive and deduplicated; blank tokens are
            ignored. An empty or whitespace-only value is absent. Values combine
            with OR, and filters combine with AND.
            An unknown token returns 400.
          schema:
            type: string
        - name: scope
          in: query
          description: >-
            Optional comma-separated scope filter. Accepted tokens: game, team,
            player, competition. Tokens are trimmed, case-sensitive and
            deduplicated; blank tokens are ignored. An empty or whitespace-only
            value is absent. Values combine with OR, and filters combine with AND. An unknown token returns 400. Definitions without a recorded scope are excluded when this filter is active.
          schema:
            type: string
        - name: settlement
          in: query
          description: >-
            Optional comma-separated settlement filter. Accepted tokens: event,
            tournament, season. Tokens are trimmed, case-sensitive and
            deduplicated; blank tokens are ignored. An empty or whitespace-only
            value is absent. Values combine with OR, and filters combine with AND. An unknown token returns 400.
          schema:
            type: string
        - name: sport_id
          in: query
          description: >-
            Optional positive sport ID, from 1 to 4294967295. An empty or
            whitespace-only value is absent. Not checked against
            a sport registry: an unknown valid ID returns an empty array when
            membership is known. Selects markets without trimming each market's
            full sports array. Returns 503 if membership is temporarily unknown
            and no confirmed state is available.
          schema:
            type: integer
            format: int64
            minimum: 1
            maximum: 4294967295
      responses:
        '200':
          description: Market catalog definitions, optionally filtered
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/MarketDefinition'
              example:
                - id: 1
                  name: moneyline
                  line_value_is_participant: true
                  proposition: true
                  description: Win the game outright.
                  short_description: Moneyline
                  period_id: 0
                  live_variant_id: 41
                  updated_at: '2026-04-12T15:56:16Z'
                  class: core
                  family: moneyline
                  scope: game
                  settlement: event
                  live: false
                  sports:
                  - 1
                  - 2
                  - 3
                  - 4
                  - 5
                  - 6
                  - 7
                  - 8
                  - 10
                  - 11
                  - 12
                  - 13
                  - 14
                  - 15
                  - 16
                  - 17
                  - 18
                  - 19
                  - 20
                  - 21
                  - 25
                  - 27
                  - 30
                  - 32
                  - 33
                  - 34
                  - 38
                  - 39
                - id: 2
                  name: handicap
                  line_value_is_participant: false
                  proposition: true
                  description: Win or lose by a specified margin.
                  short_description: Spread
                  period_id: 0
                  live_variant_id: 42
                  updated_at: '2026-04-12T15:56:16Z'
                  class: core
                  family: spread
                  scope: game
                  settlement: event
                  live: false
                  sports:
                  - 1
                  - 2
                  - 3
                  - 4
                  - 5
                  - 6
                  - 7
                  - 8
                  - 10
                  - 11
                  - 12
                  - 13
                  - 14
                  - 15
                  - 16
                  - 17
                  - 18
                  - 19
                  - 20
                  - 21
                  - 25
                  - 27
                  - 30
                  - 32
                  - 33
                  - 34
                  - 38
                  - 39
                - id: 3
                  name: totals
                  line_value_is_participant: false
                  proposition: true
                  description: Over/under on the combined score.
                  short_description: Total
                  period_id: 0
                  live_variant_id: 43
                  updated_at: '2026-04-12T15:56:17Z'
                  class: core
                  family: total
                  scope: game
                  settlement: event
                  live: false
                  sports:
                  - 1
                  - 2
                  - 3
                  - 4
                  - 5
                  - 6
                  - 7
                  - 8
                  - 10
                  - 11
                  - 12
                  - 13
                  - 14
                  - 15
                  - 16
                  - 17
                  - 18
                  - 19
                  - 20
                  - 21
                  - 25
                  - 27
                  - 30
                  - 32
                  - 33
                  - 34
                  - 38
                  - 39
                - id: 4
                  name: moneyline_first_half
                  line_value_is_participant: true
                  proposition: true
                  description: Moneyline for the first half.
                  short_description: 1st Half Moneyline
                  period_id: 1
                  live_variant_id: 1024
                  updated_at: '2026-04-12T15:56:17Z'
                  class: core
                  family: moneyline
                  scope: game
                  settlement: event
                  live: false
                  sports:
                  - 1
                  - 2
                  - 4
                  - 5
                  - 8
                  - 10
                  - 11
                  - 12
                  - 13
                  - 14
                  - 15
                  - 16
                  - 17
                  - 18
                  - 19
                  - 25
                  - 32
                  - 33
        '400':
          description: Invalid catalog filter token or sport_id. An enum-filter error lists its accepted vocabulary.
        '503':
          description: Returned for sport_id-filtered requests only while sport membership is temporarily undeterminable and no confirmed state is available.


  /api/v2/markets/delta:
    get:
      operationId: v2GetMarketsDelta
      tags: [V2 Markets]
      summary: Get market price changes since a given ID
      description: |
        Returns market line price changes (new, updated, closed) since the specified `last_id`. Use for efficient polling.

        **Bootstrap flow:** On known zero-delay access, call `GET /api/v2/sports/{sportID}/events/{date}` with the snapshot scope you need. Use its positive whole-integer `meta.delta_last_id` only when that response explicitly reports `X-Data-Delay-Seconds: 0`, then pass it as `last_id`. If the header is positive, absent, or invalid, keep using scoped snapshots; do not substitute `0`.

        **Cursor age:** The endpoint does not reject a cursor for its age. An older `last_id` pages forward through the changes after it; keep polling while `meta.has_more` is `true`, continuing from each response's `meta.delta_last_id`. A `400` means a missing or malformed parameter, so fix the request instead of re-bootstrapping. If you lose your cursor, take at most one fresh scoped snapshot and resume only when it meets the same zero-delay and valid-cursor conditions. Do not loop bootstrap requests.

        **Core live markets:** Event snapshots expand `market_ids=1,2,3` to include in-play IDs. This delta endpoint filters IDs literally, so poll `1,2,3,41,42,43` to receive full-game core updates before and during play. Returned rows retain their actual market IDs.
      parameters:
        - name: last_id
          in: query
          required: true
          schema:
            type: integer
            format: int64
            minimum: 1
          description: >-
            Return changes with ID greater than this value. On known zero-delay
            access, obtain a positive whole-integer initial cursor from
            `meta.delta_last_id` in a scoped v2 events snapshot that explicitly
            reports `X-Data-Delay-Seconds: 0`. Older cursors are not rejected
            for age; keep polling while `meta.has_more` is `true`. Do not use
            `0` as a fallback.
        - name: sport_id
          in: query
          schema:
            type: integer
          description: Filter by sport ID. A non-integer value returns HTTP 400. With `market_ids` omitted, the sport also selects the default market set.
        - $ref: '#/components/parameters/AffiliateIDsQuery'
        - name: market_ids
          in: query
          schema:
            type: string
          description: >-
            Literal comma-separated market-ID filter, up to 12 IDs; more
            returns HTTP 400. Omit it for the default `1,2,3`, or
            `1,2,3,563` for soccer leagues and NHL when `sport_id` is set;
            the default does not add in-play IDs. To poll full-game core
            updates before and during play, include `1,2,3,41,42,43`; event
            snapshots expand `1,2,3` to include the in-play IDs.
        - name: event_id
          in: query
          schema:
            type: string
          description: Filter by event ID
        - name: limit
          in: query
          schema:
            type: integer
            default: 1000
            maximum: 5000
          description: Maximum deltas per response. Values above 5000 are capped to 5000; values below 1 or non-numeric use 1000.
      responses:
        '200':
          description: Market deltas
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MarketDeltaResponse'
              example:
                meta:
                  delta_last_id: "193500000"
                  count: 2
                  has_more: false
                deltas:
                  - id: 193499998
                    event_id: "09bfa53f8484a63e584398545c035932"
                    sport_id: 4
                    affiliate_id: 19
                    market_id: 1
                    market_name: "moneyline"
                    participant_id: 11
                    participant_type: "TYPE_TEAM"
                    participant_name: "Atlanta Hawks"
                    line: ""
                    price: "-112"
                    previous_price: "-110"
                    change_type: "price"
                    updated_at: "2026-02-12T00:10:43Z"
                    is_main_line: true
                  - id: 193499999
                    event_id: "09bfa53f8484a63e584398545c035932"
                    sport_id: 4
                    affiliate_id: 19
                    market_id: 3
                    market_name: "totals"
                    participant_id: 1001
                    participant_type: "TYPE_RESULT"
                    participant_name: "Over"
                    line: "235.5"
                    price: "-110"
                    previous_price: "-108"
                    change_type: "price"
                    updated_at: "2026-02-12T00:10:43Z"
                    is_main_line: true
        '400':
          description: Missing or invalid parameter
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
              examples:
                missing_cursor:
                  summary: last_id omitted
                  value:
                    error: "last_id is required"
                invalid_cursor:
                  summary: last_id is not an integer
                  value:
                    error: "last_id must be an integer (e.g. 221099670). Use the meta.delta_last_id from a /api/v2/sports/{sport_id}/events/{date} response to bootstrap, then the cursor from each /api/v2/markets/delta response for subsequent polls."
                invalid_sport_id:
                  summary: sport_id is not an integer
                  value:
                    error: "sport_id must be a non-negative integer"
                too_many_market_ids:
                  summary: More than 12 market_ids
                  value:
                    error: "market_ids accepts at most 12 IDs per request; received 13. Split larger requests into batches of 12 or omit market_ids to use the default 1,2,3"

  /api/v2/markets/history:
    get:
      operationId: v2GetMarketLinePriceHistory
      tags: [V2 Markets]
      summary: Get price history for specific market line prices
      parameters:
        - name: market_line_price_ids
          in: query
          required: true
          schema:
            type: string
          description: Comma-separated market line price IDs (max 50). A missing list, more than 50 entries, or any non-numeric or empty entry returns HTTP 400.
        - name: from
          in: query
          schema:
            type: string
            format: date-time
          description: Start time (RFC3339). A value that does not parse is ignored.
        - name: to
          in: query
          schema:
            type: string
            format: date-time
          description: End time (RFC3339). A value that does not parse is ignored.
        - name: limit
          in: query
          schema:
            type: integer
            default: 1000
            maximum: 5000
          description: Maximum rows returned across all requested IDs, newest first. A value below 1, above 5000 or non-numeric falls back to 1000; it is not capped to 5000.
        - $ref: '#/components/parameters/AffiliateIDsQuery'
        - $ref: '#/components/parameters/MainLineHistoryQuery'
      responses:
        '200':
          description: Price history, newest first (`updated_at` descending), up to `limit` rows across all requested IDs.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MarketHistoryResponse'
              example:
                meta:
                  count: 2
                history:
                  - id: 600002
                    market_line_price_id: 192868821
                    event_id: "09bfa53f8484a63e584398545c035932"
                    sport_id: 4
                    affiliate_id: 19
                    market_participant_id: 45001
                    market_id: 1
                    line: ""
                    price: "-110"
                    previous_price: "-105"
                    change_type: "price"
                    updated_at: "2026-02-11T09:30:00Z"
                    is_main_line: true
                  - id: 600001
                    market_line_price_id: 192868821
                    event_id: "09bfa53f8484a63e584398545c035932"
                    sport_id: 4
                    affiliate_id: 19
                    market_participant_id: 45001
                    market_id: 1
                    line: ""
                    price: "-105"
                    change_type: "open"
                    updated_at: "2026-02-10T14:00:00Z"
                    is_main_line: true
        '400':
          description: Missing, too many or invalid `market_line_price_ids`
          content:
            application/json:
              example:
                error: "max 50 market_line_price_ids per request"

  /api/v2/markets/participants:
    get:
      operationId: v2GetMarketsParticipants
      tags: [V2 Markets]
      summary: Get market participants
      description: >-
        Lists teams, players, or result sides for the requested event and
        markets. Use `participant_id` from this response, rather than `id`, to
        filter a participant-specific chart. Market `3` totals use
        `TYPE_RESULT` Over and Under participants, while markets `1` and `2`
        use `TYPE_TEAM` participants. For example, discover totals with
        `GET /api/v2/markets/participants?event_id=733a06aa4f4f2a3af7872c3667a60f22&market_ids=3&participant_type=TYPE_RESULT`,
        then request each discovered side from
        `GET /api/v2/events/{eventID}/markets/{marketID}/history`.
      parameters:
        - name: market_ids
          in: query
          schema:
            type: string
            default: "1,2,3"
            example: "3"
          description: >-
            Comma-separated market IDs. Defaults to `1,2,3` when omitted.
        - name: event_id
          in: query
          required: true
          schema:
            type: string
            example: "733a06aa4f4f2a3af7872c3667a60f22"
          description: Canonical V2 event ID that scopes participant discovery.
        - name: participant_ids
          in: query
          schema:
            type: string
          description: Comma-separated public canonical participant IDs to return.
        - name: participant_type
          in: query
          schema:
            type: string
            enum: [TYPE_TEAM, TYPE_PLAYER, TYPE_RESULT]
            example: TYPE_RESULT
          description: Filter by participant type.
      responses:
        '200':
          description: Market participants
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MarketParticipantsResponse'
              example:
                participants:
                  - id: 70001
                    market_event_id: 28401
                    participant_id: 9
                    participant_type: "TYPE_RESULT"
                    participant_name: "Over"
                    updated_at: "2026-09-09T19:00:00Z"
                  - id: 70002
                    market_event_id: 28401
                    participant_id: 10
                    participant_type: "TYPE_RESULT"
                    participant_name: "Under"
                    updated_at: "2026-09-09T19:00:00Z"

  # ─── V2 FUTURES ───────────────────────────────────────────────────────
  /api/v2/sports/{sportID}/futures:
    get:
      operationId: v2GetFuturesForSport
      tags: [V2 Futures]
      summary: Get futures for a sport
      description: |
        Returns futures/outright **competition events** (e.g. tournament winner) for a sport, with future-class markets in the standard V2 market → participants → lines → prices shape and per-market settlement state. Competition events are excluded from the dated game endpoints and served only here. **Early access: requires an Ultra plan or higher.**

        A competition is an **interval**, not an instant: `event_date` is when it starts and `settle_by` is when it must have graded. Futures events carry no `teams` array and no score: the human-readable identity is `schedule.event_name`.

        **Date filtering uses interval overlap.** An event is returned when its `[event_date, settle_by]` span intersects the requested window: `settle_by >= from` and `event_date <= to`. So the default `from=now` means "in flight right now" and matches a season future that started months ago.

        **Paging is keyset-based** (no skip parameter). When more results exist the response carries `meta.next_cursor`; pass it back verbatim as `cursor`. Ordering is soonest-to-resolve first: `settle_by`, then `event_date`, then `event_id`. `meta.count` is the number of events on the page, `meta.has_more` says whether another page exists, and `meta.total` is the number of events matching your filters across all pages, so a single call tells you the size of the listing.

        **Default visibility:** settled markets are removed per market, an event is hidden once every requested future-class market on it has settled, and terminal (final/canceled/abandoned) events are excluded. `include_settled=true` lifts all of those **and** the default `from=now`, so settled history is reachable.

        **Delta bootstrap:** On known zero-delay access, `meta.delta_last_id` can seed `GET /api/v2/markets/delta` only when this snapshot explicitly reports `X-Data-Delay-Seconds: 0`; it is a positive whole-integer cursor. With a positive, absent, or invalid delay header, keep using scoped snapshots and do not substitute `0`. Futures market IDs are **not** in the delta feed's default set: pass them explicitly (e.g. `market_ids=1141`) when polling. See the [Futures guide](/guides/futures) for the full integration recipe.
      parameters:
        - $ref: '#/components/parameters/SportIDPath'
        - name: from
          in: query
          schema:
            type: string
          description: >-
            Start of the window. A competition is returned when its `settle_by` is at or after this, i.e. it has not finished yet. RFC3339 timestamp or `YYYY-MM-DD`; date-only values use the `offset` timezone. Defaults to **now**, with two exceptions where it is left unbounded instead: when `include_settled=true` (so settled history, whose intervals ended in the past, stays reachable), and when an explicit `to` is itself already in the past (defaulting `from` to now would describe an inverted, always-empty window).
          example: "2026-08-01"
        - name: to
          in: query
          schema:
            type: string
          description: >-
            End of the window. A competition is returned when its `event_date` (start) is at or before this. RFC3339 timestamp or `YYYY-MM-DD`, inclusive; date-only values use the `offset` timezone. Unbounded when omitted.
          example: "2026-08-31"
        - $ref: '#/components/parameters/OffsetQuery'
        - name: limit
          in: query
          schema:
            type: integer
            default: 50
            maximum: 200
          description: Maximum events returned per page (values above 200 are clamped to 200).
        - name: cursor
          in: query
          schema:
            type: string
          description: >-
            Opaque keyset page token. Pass `meta.next_cursor` from the previous response verbatim; omit for the first page. Do not parse or construct the token.
        - name: include_settled
          in: query
          schema:
            type: boolean
            default: false
          description: >-
            Set to `true` to include settled markets (with their graded `settlement` entries) and terminal (finished/canceled) competition events. Also lifts the default `from=now`, so settled history is reachable: add explicit `from`/`to` bounds to scope it.
        - name: market_ids
          in: query
          schema:
            type: string
          description: >-
            Comma-separated market IDs, intersected with the future-class market set (1141 = Tournament Winner on every futures sport; golf adds 1392–1396). When omitted, all future-class markets are returned. Game-market IDs match no markets here (events still return, with empty markets arrays).
          example: "1141"
        - $ref: '#/components/parameters/AffiliateIDsQuery'
      responses:
        '200':
          description: Futures events retrieved successfully
          headers:
            X-Data-Delay-Seconds:
              description: >-
                Optional data-delay entitlement value in whole seconds. Only an
                explicit value of `0` confirms zero-delay access for
                market-delta bootstrap; a positive or missing value means use
                scoped snapshots.
              schema:
                type: integer
                minimum: 0
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FuturesEventsResponse'
              example:
                meta:
                  delta_last_id: "1595215769"
                  next_cursor: "MTc4NTY0MzIwMDAwMDAwMDAwMHwxNzg1Mzg0MDAwMDAwMDAwMDAwfDc2ODVhMzJkYTYyOGM3N2UwMzFhMmQ5NzAxMTI4ODgy"
                  count: 50
                  has_more: true
                  total: 73
                events:
                  - event_id: "a3d1f9f94f220a45cfd944181569cc46"
                    sport_id: 2
                    event_date: "2026-09-10T00:00:00Z"
                    settle_by: "2027-02-21T00:00:00Z"
                    event_status: "STATUS_SCHEDULED"
                    settlement: {}
                    schedule:
                      event_name: "NFL Super Bowl Winner (2026 Season)"
                      season_year: 2026
                    markets:
                      - id: 4967891
                        market_id: 1141
                        period_id: 0
                        name: "tournament_winner"
                        market_description: "Tournament Winner"
                        participants:
                          - id: 61
                            type: "TYPE_TEAM"
                            name: "Buffalo Bills"
                            lines:
                              - id: "8155509548895b87157633c87df81b3e"
                                prices:
                                  "22":
                                    id: "665502535"
                                    price: 1000
                                    is_main_line: true
                                    updated_at: "2026-07-29T17:01:46Z"
                                  "25":
                                    id: "665857721"
                                    price: 1074
                                    is_main_line: true
                                    updated_at: "2026-07-29T18:30:25Z"
                          - id: 63
                            type: "TYPE_TEAM"
                            name: "New England Patriots"
                            lines:
                              - id: "b1d9b8b548f232cc35ea2a3995449d3c"
                                prices:
                                  "22":
                                    id: "665502553"
                                    price: 2000
                                    is_main_line: true
                                    updated_at: "2026-07-29T17:01:46Z"
        '400':
          description: Invalid parameter (malformed date, cursor, or ID list)
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
        '403':
          description: Plan does not include futures markets
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  upgrade_url:
                    type: string
              example:
                error: "Futures markets require Ultra plan or higher"
                upgrade_url: "/pricing/api"

  /api/v2/sports/{sportID}/futures/{eventID}:
    get:
      operationId: v2GetFuturesEventByID
      tags: [V2 Futures]
      summary: Get one futures competition, with progress and leaders
      description: |
        Returns **one** futures/outright competition event, the same envelope and event object shape as `GET /api/v2/sports/{sportID}/futures` (`meta.delta_last_id`, `events` with a single event carrying `event_id`, `sport_id`, `event_date`, `settle_by`, `event_status`, `settlement`, `schedule`, `markets`), plus up to three optional detail-only keys not served on the listing. **Early access: requires an Ultra plan or higher.**

        **`progress`**: the competition's live non-odds state (a golf leaderboard, a team-sport standings table), refreshed on its own cycle independent of the odds board. `entries[].participant_id` is the same participant ID space `markets[].participants[].id` uses, so a progress row joins directly to a price. Omitted entirely (never `null`) when no progress document exists yet for the competition: "priced, no odds-board progress" is the normal state for a fresh team-championship board, not a degraded response. See [Competition Stats (Progress)](/guides/futures#competition-stats-progress) for the full field-by-field breakdown of both kinds live today.

        **`leaders`** / **`player_leaders`**: optional curated season-stats leaderboards, team-grain and player-grain respectively, for a hand-verified set of sports. Both reuse the same `{stat, stat_id, season_year, entries[]}` shape and are omitted entirely (never an empty array) when the sport is not curated or no stat rows exist yet; see [Competition Stats (Progress)](/guides/futures#competition-stats-progress) for the curated sport list and the two distinct entry ID spaces.

        **Settled competitions are always served here.** Unlike the listing (which hides settled markets and terminal events unless `include_settled=true`), this is a deep link to a specific competition you already hold the ID for, and it keeps working after settlement, with the graded results visible in `settlement`. There is no `include_settled` parameter on this endpoint.
      parameters:
        - $ref: '#/components/parameters/SportIDPath'
        - $ref: '#/components/parameters/EventIDPath'
        - name: market_ids
          in: query
          schema:
            type: string
          description: >-
            Comma-separated market IDs, intersected with the future-class market set. When omitted, all future-class markets are returned.
          example: "1141"
        - $ref: '#/components/parameters/AffiliateIDsQuery'
      responses:
        '200':
          description: Futures event retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FuturesEventDetailResponse'
              example:
                meta:
                  delta_last_id: "1595215769"
                events:
                  - event_id: "a3d1f9f94f220a45cfd944181569cc46"
                    sport_id: 2
                    event_date: "2026-09-10T00:00:00Z"
                    settle_by: "2027-02-21T00:00:00Z"
                    event_status: "STATUS_SCHEDULED"
                    settlement: {}
                    schedule:
                      event_name: "NFL Super Bowl Winner (2026 Season)"
                      season_year: 2026
                    markets:
                      - id: 4967891
                        market_id: 1141
                        period_id: 0
                        name: "tournament_winner"
                        market_description: "Tournament Winner"
                        participants:
                          - id: 61
                            type: "TYPE_TEAM"
                            name: "Buffalo Bills"
                            lines:
                              - id: "8155509548895b87157633c87df81b3e"
                                prices:
                                  "22":
                                    id: "665502535"
                                    price: 1000
                                    is_main_line: true
                                    updated_at: "2026-07-29T17:01:46Z"
                    progress:
                      kind: "league_standings"
                      as_of: "2026-08-07T09:05:00Z"
                      phase:
                        status: "STATUS_SCHEDULED"
                        label: "Week 1"
                        unit: "week"
                        current: null
                        total: null
                      context: {}
                      entries:
                        - participant_id: 61
                          name: "Buffalo Bills"
                          rank: 1
                          wins: 0
                          losses: 0
                          ties: 0
                          win_pct: 0.0
                          points: 0
                          conference: "AFC"
                          division: "AFC East"
                        - participant_id: 63
                          name: "New England Patriots"
                          rank: 2
                          wins: 0
                          losses: 0
                          ties: 0
                          win_pct: 0.0
                          points: 0
                          conference: "AFC"
                          division: "AFC East"
                    leaders:
                      - stat: "Total Yards"
                        stat_id: 1120
                        season_year: 2025
                        entries:
                          - participant_id: 61
                            name: "Buffalo Bills"
                            value: 6432
                            rank: 1
                          - participant_id: 63
                            name: "New England Patriots"
                            value: 5211
                            rank: 2
                    player_leaders:
                      - stat: "Passing Yards"
                        stat_id: 1101
                        season_year: 2025
                        entries:
                          - participant_id: 15847
                            name: "Josh Allen"
                            value: 4306
                            rank: 1
        '400':
          description: Invalid parameter
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
        '403':
          description: Plan does not include futures markets
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  upgrade_url:
                    type: string
              example:
                error: "Futures markets require Ultra plan or higher"
                upgrade_url: "/pricing/api"
        '404':
          description: Unknown event ID, event under a different sport, or a non-competition (game) event

  # ─── V2 TEAMS ─────────────────────────────────────────────────────────
  /api/v2/teams/{teamID}/:
    get:
      operationId: v2GetTeamByID
      tags: [V2 Teams]
      summary: Get a team by ID
      parameters:
        - name: teamID
          in: path
          required: true
          schema:
            type: integer
          description: Normalized team ID
      responses:
        '200':
          description: 'Team data. An unknown team ID returns `{"teams": []}`.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TeamsResponse'
              example:
                teams:
                  - team_id: 11
                    name: "Atlanta"
                    mascot: "Hawks"
                    abbreviation: "ATL"
                    record: "26-30"
                    conference:
                      conference_id: 39
                      sport_id: 4
                      name: "Eastern Conference"
                    division:
                      division_id: 17
                      conference_id: 39
                      sport_id: 4
                      name: "Southeast"

  /api/v2/teams/{teamID}/players:
    get:
      operationId: v2GetPlayersByTeam
      tags: [V2 Teams]
      summary: Get players for a team
      parameters:
        - name: teamID
          in: path
          required: true
          schema:
            type: integer
          description: Normalized team ID
      responses:
        '200':
          description: Player list
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PlayersResponse'
              example:
                players:
                - id: 16661
                  sport_id: 4
                  team_id: 11
                  updated_at: '2026-10-15T13:42:53Z'
                  first_name: Aaron
                  last_name: Wiggins
                  display_name: Aaron Wiggins
                  weight: 190
                  height: 77
                  display_weight: 190 lbs
                  display_height: 6' 5"
                  age: 27
                  date_of_birth: 1999-01-02T08:00Z
                  slug: aaron-wiggins
                  jersey: '2'
                  position: Guard
                  position_abbreviation: G
                  birth_place_city: Greensboro
                  birth_place_country: USA
                  experience_years: 0
                  active: true
                  status: Active
                - id: 14673859
                  sport_id: 4
                  team_id: 11
                  updated_at: '2026-10-15T13:42:53Z'
                  first_name: Asa
                  last_name: Newell
                  display_name: Asa Newell
                  weight: 224
                  height: 83
                  display_weight: 224 lbs
                  display_height: 6' 11"
                  age: 21
                  date_of_birth: 2005-10-05T07:00Z
                  slug: asa-newell
                  jersey: '14'
                  position: Forward
                  position_abbreviation: F
                  birth_place_city: Destin
                  birth_place_country: USA
                  experience_years: 0
                  active: true
                  status: Active

  /api/v2/teams/{teamID}/stats:
    get:
      operationId: v2GetTeamStats
      tags: [V2 Teams]
      summary: Get season stats for a team
      parameters:
        - name: teamID
          in: path
          required: true
          schema:
            type: integer
        - name: stats_ids
          in: query
          schema:
            type: string
          description: Comma-separated stat IDs. Only the first 12 nonblank entries are used; additional entries are ignored. `stat_ids` is accepted as an alias when `stats_ids` is absent.
        - name: year
          in: query
          schema:
            type: integer
          description: Season year (defaults to current year). A non-integer value returns HTTP 400 with the plain-text body `Invalid year parameter`.
        - name: season_type
          in: query
          schema:
            type: string
            default: '2'
          description: Season type ID (default 2 = regular season)
      responses:
        '200':
          description: Team season stats
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/TeamStats'
              example:
                - team_id: 11
                  stat_id: 1242
                  stat:
                    id: 1242
                    name: "avgRebounds"
                    category: "general"
                    display_name: "Rebounds Per Game"
                    abbreviation: "REB"
                    description: "The average rebounds per game."
                    sport_id: 4
                  season_year: 2026
                  season_type: 2
                  season_type_name: "Regular Season"
                  value: 42.25
                  display_value: "42.3"
                  updated_at: "2025-05-10T16:51:57Z"
                - team_id: 11
                  stat_id: 1243
                  stat:
                    id: 1243
                    name: "assistTurnoverRatio"
                    category: "general"
                    display_name: "Assist To Turnover Ratio"
                    abbreviation: "AST/TO"
                    description: "The average number of assists per turnover"
                    sport_id: 4
                  season_year: 2026
                  season_type: 2
                  season_type_name: "Regular Season"
                  value: 2.26
                  display_value: "2.3"
                  rank: 1
                  rank_display_value: "1st"
                  updated_at: "2025-05-10T16:51:57Z"

  /api/v2/teams/{teamID}/players/stats:
    get:
      operationId: v2GetPlayerStatsByTeam
      tags: [V2 Teams]
      summary: Get player season stats for a team
      parameters:
        - name: teamID
          in: path
          required: true
          schema:
            type: integer
        - name: stats_ids
          in: query
          schema:
            type: string
          description: Comma-separated stat IDs. Only the first 12 nonblank entries are used; additional entries are ignored. `stat_ids` is accepted as an alias when `stats_ids` is absent.
        - name: player_ids
          in: query
          schema:
            type: string
          description: Comma-separated player IDs. Only the first 6 nonblank entries are used; additional entries are ignored.
        - name: year
          in: query
          schema:
            type: integer
          description: Season year (defaults to current year). A non-integer value returns HTTP 400 with the plain-text body `Invalid year parameter`.
        - name: season_type
          in: query
          schema:
            type: string
            default: '2'
      responses:
        '200':
          description: Player season stats
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/PlayerStatResponse'
              example:
                - player:
                    id: 15954
                    sport_id: 4
                    team_id: 11
                    updated_at: '2026-10-15T13:42:53Z'
                    first_name: Onyeka
                    last_name: Okongwu
                    display_name: Onyeka Okongwu
                    weight: 240
                    height: 82
                    display_weight: 240 lbs
                    display_height: 6' 10"
                    age: 25
                    date_of_birth: 2000-12-11T08:00Z
                    slug: onyeka-okongwu
                    jersey: '17'
                    position: Forward
                    position_abbreviation: F
                    birth_place_city: Chino
                    birth_place_country: USA
                    experience_years: 0
                    active: true
                    status: Active
                  stats:
                  - player_id: 15954
                    stat_id: 1288
                    stat:
                      id: 1288
                      name: avgRebounds
                      category: game
                      display_name: Rebounds Per Game
                      abbreviation: REB
                      description: The average rebounds per game.
                      sport_id: 4
                    season_year: 2026
                    season_type: 2
                    season_type_name: Regular Season
                    value: 7.5946
                    display_value: '7.6'
                    updated_at: '2026-10-15T22:36:47.953537Z'
                  - player_id: 15954
                    stat_id: 1308
                    stat:
                      id: 1308
                      name: avgPoints
                      category: game
                      display_name: Points Per Game
                      abbreviation: PTS
                      description: The average number of points scored per game.
                      sport_id: 4
                    season_year: 2026
                    season_type: 2
                    season_type_name: Regular Season
                    value: 15.1757
                    display_value: '15.2'
                    updated_at: '2026-10-15T22:36:48.061402Z'
                  - player_id: 15954
                    stat_id: 1313
                    stat:
                      id: 1313
                      name: avgAssists
                      category: game
                      display_name: Assists Per Game
                      abbreviation: AST
                      description: The average assists per game.
                      sport_id: 4
                    season_year: 2026
                    season_type: 2
                    season_type_name: Regular Season
                    value: 3.1216
                    display_value: '3.1'
                    updated_at: '2026-10-15T22:36:48.079769Z'

  # ─── V2 PLAYERS ───────────────────────────────────────────────────────
  /api/v2/players/{playerID}:
    get:
      operationId: v2GetPlayerByID
      tags: [V2 Players]
      summary: Get a player by ID
      parameters:
        - name: playerID
          in: path
          required: true
          schema:
            type: integer
      responses:
        '200':
          description: Player data
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PlayersResponse'
              example:
                players:
                - id: 15954
                  sport_id: 4
                  team_id: 11
                  updated_at: '2026-10-15T13:42:53Z'
                  first_name: Onyeka
                  last_name: Okongwu
                  display_name: Onyeka Okongwu
                  weight: 240
                  height: 82
                  display_weight: 240 lbs
                  display_height: 6' 10"
                  age: 25
                  date_of_birth: 2000-12-11T08:00Z
                  slug: onyeka-okongwu
                  jersey: '17'
                  position: Forward
                  position_abbreviation: F
                  birth_place_city: Chino
                  birth_place_country: USA
                  experience_years: 0
                  active: true
                  status: Active

  # ─── V2 STATS ─────────────────────────────────────────────────────────
  /api/v2/stats/sample:
    get:
      operationId: v2GetStatsSample
      tags: [V2 Stats]
      summary: Get a fixed complete-game stats sample
      description: |
        Returns a static, marked sample game box for schema and parsing tests.
        It requires an API key but consumes zero data points. It is not a
        production-data entitlement and must not be polled.
      responses:
        '200':
          description: Fixed sample stats payload
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                description: Marked fixed complete-game sample payload.
  /api/v2/stats:
    get:
      operationId: v2GetAllStats
      tags: [V2 Stats]
      summary: List all stat definitions
      parameters:
        - name: id
          in: query
          schema:
            type: integer
          description: Filter by stat ID
        - name: sport_id
          in: query
          schema:
            type: integer
          description: Filter by sport ID
      responses:
        '200':
          description: Stat definitions
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/StatDefinition'
              example:
                - id: 1
                  name: "completionPct"
                  display_name: "Completion Percentage"
                  abbreviation: "CMP%"
                  description: "The percentage of completed passes."
                  sport_id: 2
                - id: 2
                  name: "completions"
                  display_name: "Completions"
                  abbreviation: "CMP"
                  description: "The times a player completes a pass to another player."
                  sport_id: 2
                - id: 1242
                  name: "avgRebounds"
                  display_name: "Rebounds Per Game"
                  abbreviation: "REB"
                  description: "The average rebounds per game."
                  sport_id: 4

  # ─── V2 DELTA ─────────────────────────────────────────────────────────
  /api/v2/delta:
    get:
      operationId: v2GetDelta
      tags: [V2 Events]
      summary: Get event changes since a delta ID
      description: |
        Returns raw JSON delta payloads for events that changed since `last_id`. Each delta entry is a raw JSON string containing the full event update: the `data` field is a serialized JSON string, not a parsed object.

        The response is wrapped in a `meta` object containing the `delta_last_id` cursor for subsequent polling.
      parameters:
        - name: last_id
          in: query
          required: true
          schema:
            type: string
            minLength: 36
            maxLength: 36
          description: Delta cursor (36-character UUID). Use `00000000-0000-0000-0000-000000000000` for initial fetch, then pass the `delta_last_id` from the previous response.
        - name: sport_id
          in: query
          schema:
            type: integer
          description: Filter by sport ID
        - $ref: '#/components/parameters/AffiliateIDsQuery'
      responses:
        '200':
          description: Delta updates
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeltasResponse'
              example:
                meta:
                  delta_last_id: "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
                deltas:
                  - data: "{\"event_id\":\"09bfa53f8484a63e584398545c035932\",\"sport_id\":4,\"event_date\":\"2026-02-12T00:00:00Z\",\"lines\":{...}}"
                  - data: "{\"event_id\":\"b9c4e2a1f3d5670089ab12cd34ef5678\",\"sport_id\":4,\"event_date\":\"2026-02-12T00:00:00Z\",\"lines\":{...}}"

  # ─── V2 HEDGE ─────────────────────────────────────────────────────────
  # ─── V2 REFERENCE ─────────────────────────────────────────────────────
  /api/v2/affiliates:
    get:
      operationId: v2GetAffiliates
      tags: [V2 Reference]
      summary: List all sportsbooks/affiliates
      description: Returns currently published sportsbook IDs, names, URLs and overall status. With sport_id, status is sport-scoped and status_scope is sport. include=sports adds sport_id, status and since for each stored sport row; combine with include=regions. Responses without parameters are unchanged. Status data is cached for up to 15 seconds. Treat unknown status values as unknown. Health labels do not filter odds. No authentication required.
      security: []
      parameters:
      - name: include
        in: query
        description: Optional regions and/or sports; combine as include=regions,sports or
          repeat the parameter.
        schema:
          type: array
          items:
            type: string
            enum:
            - regions
            - sports
        style: form
        explode: false
      - name: sport_id
        in: query
        description: One positive sport ID. Scopes each affiliate status to that sport and
          adds status_scope=sport. When a successful lookup has no stored row for the requested
          sport, its scoped status defaults to healthy, including for an unknown positive sport ID.
          This fallback does not prove sport coverage. No sport row is synthesized.
          Held books (19, 22, 23) remain healthy except when an explicit unhealthy whole-book
          restriction applies to BetMGM (22). Beta integrations remain beta. Unknown positive IDs are
          accepted. Does not filter affiliates or sports[]. Empty, repeated, non-integer
          or out-of-range IDs return 400. Database read failures return 500 instead of the missing-row fallback.
        schema:
          type: integer
          minimum: 1
          maximum: 4294967295
      responses:
        '400':
          description: Invalid sport_id; supply exactly one positive integer.
        '200':
          description: List of affiliates
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AffiliatesResponse'
              example:
                affiliates:
                  - affiliate_id: 2
                    affiliate_name: "Bovada"
                    affiliate_url: "https://bovada.lv"
                    status: "healthy"
                  - affiliate_id: 3
                    affiliate_name: "Pinnacle"
                    affiliate_url: "https://pinnacle.com"
                    status: "healthy"
                  - affiliate_id: 4
                    affiliate_name: "Sportsbetting"
                    affiliate_url: "https://sportsbetting.ag"
                    status: "healthy"
                  - affiliate_id: 6
                    affiliate_name: "BetOnline"
                    affiliate_url: "https://betonline.ag"
                    status: "healthy"
                  - affiliate_id: 7
                    affiliate_name: "BookMaker"
                    affiliate_url: "https://www.bookmaker.eu/"
                    status: "healthy"
                  - affiliate_id: 9
                    affiliate_name: "BetCRIS"
                    affiliate_url: "https://sportsbook.betcris.com/"
                    status: "healthy"
                  - affiliate_id: 11
                    affiliate_name: "Lowvig"
                    affiliate_url: "https://lowvig.ag"
                    status: "healthy"
                  - affiliate_id: 19
                    affiliate_name: "Draftkings"
                    affiliate_url: "https://sportsbook.draftkings.com"
                    status: "healthy"
                  - affiliate_id: 22
                    affiliate_name: "BetMGM"
                    affiliate_url: "https://sports.betmgm.com"
                    status: "healthy"
                  - affiliate_id: 23
                    affiliate_name: "Fanduel"
                    affiliate_url: "https://sportsbook.fanduel.com"
                    status: "healthy"
                  - affiliate_id: 24
                    affiliate_name: "theScore Bet"
                    affiliate_url: "https://thescore.bet"
                    status: "healthy"
                  - affiliate_id: 25
                    affiliate_name: "Kalshi"
                    affiliate_url: "https://kalshi.com"
                    status: "healthy"
                  - affiliate_id: 26
                    affiliate_name: "Polymarket"
                    affiliate_url: "https://polymarket.com"
                    status: "healthy"
                  - affiliate_id: 28
                    affiliate_name: "HardRock"
                    affiliate_url: "https://app.hardrock.bet"
                    status: "healthy"
                  - affiliate_id: 29
                    affiliate_name: "ProphetX"
                    affiliate_url: "https://prophetx.co/"
                    status: "healthy"
                  - affiliate_id: 30
                    affiliate_name: "Novig"
                    affiliate_url: "https://novig.us/"
                    status: "healthy"
                  - affiliate_id: 31
                    affiliate_name: "Polymarket US"
                    affiliate_url: "https://polymarket.us/"
                    status: "healthy"
                  - affiliate_id: 32
                    affiliate_name: "Circa Sports"
                    affiliate_url: "https://www.circasports.com/"
                    status: "healthy"
                  - affiliate_id: 33
                    affiliate_name: "Bet105"
                    affiliate_url: "https://bet105.ag/"
                    status: "healthy"
                  - affiliate_id: 34
                    affiliate_name: "Heritage Sports"
                    affiliate_url: "https://ppm.heritage.linepros.com/"
                    status: "healthy"
                  - affiliate_id: 35
                    affiliate_name: "Caesars Sportsbook"
                    affiliate_url: "https://sportsbook.caesars.com/"
                    status: "healthy"

  /api/v2/sportsbooks:
    get:
      operationId: v2GetSportsbooks
      tags: [V2 Reference]
      summary: List all sportsbooks (alias for /affiliates)
      description: Returns currently published sportsbook IDs, names, URLs and overall status. With sport_id, status is sport-scoped and status_scope is sport. include=sports adds sport_id, status and since for each stored sport row; combine with include=regions. Responses without parameters are unchanged. Status data is cached for up to 15 seconds. Treat unknown status values as unknown. Health labels do not filter odds. No authentication required.
      security: []
      parameters:
      - name: include
        in: query
        description: Optional regions and/or sports; combine as include=regions,sports or
          repeat the parameter.
        schema:
          type: array
          items:
            type: string
            enum:
            - regions
            - sports
        style: form
        explode: false
      - name: sport_id
        in: query
        description: One positive sport ID. Scopes each affiliate status to that sport and
          adds status_scope=sport. When a successful lookup has no stored row for the requested
          sport, its scoped status defaults to healthy, including for an unknown positive sport ID.
          This fallback does not prove sport coverage. No sport row is synthesized.
          Held books (19, 22, 23) remain healthy except when an explicit unhealthy whole-book
          restriction applies to BetMGM (22). Beta integrations remain beta. Unknown positive IDs are
          accepted. Does not filter affiliates or sports[]. Empty, repeated, non-integer
          or out-of-range IDs return 400. Database read failures return 500 instead of the missing-row fallback.
        schema:
          type: integer
          minimum: 1
          maximum: 4294967295
      responses:
        '400':
          description: Invalid sport_id; supply exactly one positive integer.
        '200':
          description: List of sportsbooks
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AffiliatesResponse'
              example:
                affiliates:
                  - affiliate_id: 3
                    affiliate_name: "Pinnacle"
                    affiliate_url: "https://www.pinnacle.com"
                    status: "healthy"
                  - affiliate_id: 7
                    affiliate_name: "BookMaker"
                    affiliate_url: "https://www.bookmaker.eu/"
                    status: "healthy"
                  - affiliate_id: 9
                    affiliate_name: "BetCRIS"
                    affiliate_url: "https://sportsbook.betcris.com/"
                    status: "healthy"
                  - affiliate_id: 19
                    affiliate_name: "Draftkings"
                    affiliate_url: "https://sportsbook.draftkings.com"
                    status: "healthy"
                  - affiliate_id: 22
                    affiliate_name: "BetMGM"
                    affiliate_url: "https://sports.betmgm.com"
                    status: "healthy"
                  - affiliate_id: 23
                    affiliate_name: "Fanduel"
                    affiliate_url: "https://sportsbook.fanduel.com"
                    status: "healthy"
                  - affiliate_id: 31
                    affiliate_name: "Polymarket US"
                    affiliate_url: "https://polymarket.us/"
                    status: "healthy"
                  - affiliate_id: 32
                    affiliate_name: "Circa Sports"
                    affiliate_url: "https://www.circasports.com/"
                    status: "healthy"
                  - affiliate_id: 33
                    affiliate_name: "Bet105"
                    affiliate_url: "https://bet105.ag/"
                    status: "healthy"
                  - affiliate_id: 34
                    affiliate_name: "Heritage Sports"
                    affiliate_url: "https://ppm.heritage.linepros.com/"
                    status: "healthy"
                  - affiliate_id: 35
                    affiliate_name: "Caesars Sportsbook"
                    affiliate_url: "https://sportsbook.caesars.com/"
                    status: "healthy"

  /api/v2/season_types:
    get:
      operationId: v2GetSeasonTypes
      tags: [V2 Reference]
      summary: List season types per sport
      responses:
        '200':
          description: Season types
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SeasonTypesResponse'
              example:
                season_types:
                  - sport_id: 1
                    sport_name: "NCAA Football"
                    season_type_id: 2
                    season_type_name: "Regular Season"
                  - sport_id: 1
                    sport_name: "NCAA Football"
                    season_type_id: 3
                    season_type_name: "Postseason"
                  - sport_id: 2
                    sport_name: "NFL"
                    season_type_id: 1
                    season_type_name: "Preseason"
                  - sport_id: 2
                    sport_name: "NFL"
                    season_type_id: 2
                    season_type_name: "Regular Season"
                  - sport_id: 2
                    sport_name: "NFL"
                    season_type_id: 3
                    season_type_name: "Postseason"
                  - sport_id: 4
                    sport_name: "NBA"
                    season_type_id: 1
                    season_type_name: "Preseason"
                  - sport_id: 4
                    sport_name: "NBA"
                    season_type_id: 2
                    season_type_name: "Regular Season"
                  - sport_id: 4
                    sport_name: "NBA"
                    season_type_id: 3
                    season_type_name: "Postseason"

  # ─── V2 WEBSOCKET ─────────────────────────────────────────────────────
  /api/v2/ws/markets:
    get:
      operationId: v2WebSocketMarkets
      tags: [V2 WebSocket]
      summary: "Markets WebSocket: stream real-time market price updates"
      description: |
        Establishes a WebSocket connection for streaming V2 market price changes in real-time.

        **Connection**: `wss://therundown.io/api/v2/ws/markets`

        Authenticate the WebSocket upgrade with `X-TheRundown-Key: $THERUNDOWN_API_KEY`
        from a server-side client. Native browser WebSocket clients cannot set custom
        headers; use an authenticated backend relay for browser consumers. WebSocket
        access requires an Ultra plan or higher.

        **Filter parameters** (query string):
        - `affiliate_ids`: comma-separated affiliate IDs
        - `sport_ids`: comma-separated sport IDs
        - `event_ids`: comma-separated event IDs
        - `market_ids`: comma-separated market IDs

        All filters are optional. If none are specified, all messages are received.

        **Heartbeat**: Server sends `{"meta":{"type":"heartbeat"},"data":{"now":"<RFC3339>"}}` every 15 seconds.

        **Message format**:
        ```json
        {
          "meta": {...},
          "data": {
            "affiliate_id": 19,
            "sport_id": 4,
            "event_id": "abc123",
            "market_id": 1,
            ...
          }
        }
        ```

        **Queue**: 1024-message buffer per client. If the client falls behind, messages are dropped.
      parameters:
        - $ref: '#/components/parameters/AffiliateIDsQuery'
        - name: sport_ids
          in: query
          schema:
            type: string
          description: Comma-separated sport IDs to filter
        - name: event_ids
          in: query
          schema:
            type: string
          description: Comma-separated event IDs to filter
        - name: market_ids
          in: query
          schema:
            type: string
          description: Comma-separated market IDs to filter
      responses:
        '101':
          description: WebSocket upgrade successful

  /api/v2/ws:
    get:
      operationId: v2WebSocketMultiplexed
      tags: [V2 WebSocket]
      summary: "Multiplexed WebSocket: subscribe to markets, scores, plays, stats, and live channels"
      description: |
        Establishes a single WebSocket connection carrying multiple logical channels.
        Instead of query-parameter filters, send JSON subscribe messages after connecting.

        **Connection**: `wss://therundown.io/api/v2/ws`

        Authenticate the WebSocket upgrade with `X-TheRundown-Key: $THERUNDOWN_API_KEY`
        from a server-side client. Native browser WebSocket clients cannot set custom
        headers; use an authenticated backend relay for browser consumers. WebSocket
        access requires an Ultra plan or higher.

        **Channels**:
        - `markets`: market price updates (same payloads as `/api/v2/ws/markets`)
        - `scores`: score and event-status updates (no live game state fields)
        - `plays`: play-by-play deltas for live games. **Requires an Ultra plan or higher**
          (the live game state entitlement); a `plays`, `stats`, or `live` subscribe from a
          non-entitled key is rejected with error code `forbidden`.
        - `stats`: changed team and player box-score rows, delivered inline with
          `meta.type=game_stats`. **Requires an Ultra plan or higher**. This is a
          delta-only channel with no snapshot, replay, or resume; bootstrap and recover
          from both event game-stat REST endpoints. Each changed stat row is one stats
          data point.
        - `live`: score/status deltas including `live_game_state`, play-by-play deltas,
          and game-stat deltas, on one subscription. **Requires an Ultra plan or higher**;
          `live_game_state` and `game_state` are accepted aliases.

        **Subscribe** (client → server):
        ```json
        {
          "action": "subscribe",
          "id": "p1",
          "channel": "plays",
          "params": { "sport_ids": [3], "event_ids": ["<eventID>"] }
        }
        ```
        The server acknowledges with `{"type":"subscribed","id":"p1","sequence":N,"message":"subscribed to plays"}`.
        Supported `params` filters: `sport_ids`, `event_ids` (plus `market_ids` and
        `affiliate_ids` on the `markets` channel). `stats` has no stat, team, or player
        filter. Unsubscribe with
        `{"action":"unsubscribe","id":"p1"}`.

        **Delta messages** (server → client) are wrapped in an envelope tagged with your
        subscription `id`:
        ```json
        {
          "type": "delta",
          "id": "p1",
          "sequence": 42,
          "sub_sequence": 7,
          "delta_last_id": "...",
          "data": { "meta": { "type": "play" }, "data": { ... } }
        }
        ```

        A stats delta uses the same outer envelope. Its inner payload has
        `meta.type=game_stats`; `data.team_stats[]` and `data.player_stats[]` contain
        only changed rows, and each row's `value` remains a JSON string. Upsert those
        rows into the REST-bootstrapped box score rather than replacing a whole group.
        If both row arrays are absent and `complete=true`, the frame is the terminal
        completion marker; mark the cached box complete and treat repeats as idempotent.
        If both arrays are absent without `complete=true`, the frame is an invalidation
        fallback: refetch both `GET /api/v2/events/{eventID}/stats` and
        `GET /api/v2/events/{eventID}/players/stats`. Row deltas and completion markers
        use an RFC 3339 `updated_at`; the fallback uses numeric Unix seconds. Do not use
        `delta_last_id` as a game-stat replay cursor. Each changed nested row is one
        stats data point; either zero-row variant costs one stats data point.

        **Snapshots**: add `"snapshot": true` to `params` to receive current state
        (`snapshot` frames, then `snapshot_complete`) before deltas begin; an active
        subscription can request a fresh snapshot at any time with
        `{"action":"snapshot","id":"p1"}`. Snapshot requests need a bounded scope and
        are metered as data points like the equivalent REST reads. Snapshots are not
        supported on `stats`; a request returns `snapshot_error` with code
        `unsupported_snapshot`. A `live` snapshot does not include a game-stat baseline.

        **Errors**: `{"type":"error","id":"...","code":"...","message":"..."}` with codes
        `forbidden` (plays/stats/live without Ultra+), `invalid_channel`, `missing_id`,
        `duplicate_id`, and `subscription_limit` (plan's concurrent subscription cap
        reached). A slow multiplexed client may receive the connection-level error code
        `buffer_overflow` immediately before the connection closes with reason
        `buffer_overflow:reconnect_and_catchup`.

        **Queue and recovery**: each non-market subscription has its own 1024-message
        outbound queue; market subscriptions are sized separately. If a live frame
        cannot be queued, the server closes the connection rather than continue with a
        silent gap. Reconnect, re-send subscriptions, and recover current state before
        applying new deltas. For `stats`, refetch both event game-stat REST resources.

        Concurrent connection and subscription limits vary by tier. See the
        [WebSocket reference](/api-reference/v2/websocket) for full protocol details.
      responses:
        '101':
          description: WebSocket upgrade successful

  # ─── V1 EVENTS ────────────────────────────────────────────────────────
  /api/v1/events/{eventId}:
    get:
      operationId: v1GetEventByID
      tags: [V1 Events]
      summary: Get a single event with lines
      parameters:
        - name: eventId
          in: path
          required: true
          schema:
            type: string
          description: Event ID from the `event_id` field of event responses. An `event_uuid` value returns 404.
        - name: include
          in: query
          schema:
            type: string
            enum: [all_periods]
          description: Set to `all_periods` to include period-specific lines
        - name: affiliate_ids
          in: query
          schema:
            type: string
          description: Comma-separated affiliate IDs
      responses:
        '200':
          description: Event with lines
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V1Event'
              example:
                event_id: "09bfa53f8484a63e584398545c035932"
                sport_id: 4
                event_date: "2026-02-12T00:00:00Z"
                score:
                  event_status: "STATUS_FINAL"
                  score_away: 107
                  score_home: 110
                  venue_name: "Spectrum Center"
                  venue_location: "Charlotte, NC"
                  event_status_detail: "Final"
                teams:
                  - team_id: 178
                    team_normalized_id: 11
                    name: "Atlanta Hawks"
                    is_away: true
                    is_home: false
                  - team_id: 164
                    team_normalized_id: 12
                    name: "Charlotte Hornets"
                    is_away: false
                    is_home: true
                teams_normalized:
                  - team_id: 11
                    name: "Atlanta"
                    mascot: "Hawks"
                    abbreviation: "ATL"
                    record: "26-30"
                    is_away: true
                    is_home: false
                  - team_id: 12
                    name: "Charlotte"
                    mascot: "Hornets"
                    abbreviation: "CHA"
                    record: "26-29"
                    is_away: false
                    is_home: true
                lines:
                  "4":
                    line_id: 17980122
                    moneyline:
                      moneyline_away: -105
                      moneyline_home: -115
                      moneyline_draw: 0.0001
                    spread:
                      point_spread_away: 1.5
                      point_spread_away_money: -110
                      point_spread_home: -1.5
                      point_spread_home_money: -110
                    total:
                      total_over: 235.5
                      total_over_money: -110
                      total_under: 235.5
                      total_under_money: -110

  /api/v1/events/{eventId}/lines/{lineId}:
    get:
      operationId: v1GetByLineID
      tags: [V1 Events]
      summary: Get event by line ID
      parameters:
        - name: eventId
          in: path
          required: true
          schema:
            type: string
        - name: lineId
          in: path
          required: true
          schema:
            type: string
        - name: include
          in: query
          schema:
            type: string
            enum: [all_periods]
      responses:
        '200':
          description: Event for the line
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V1Event'
              example:
                event_id: "09bfa53f8484a63e584398545c035932"
                sport_id: 4
                event_date: "2026-02-12T00:00:00Z"
                teams_normalized:
                  - team_id: 11
                    name: "Atlanta"
                    mascot: "Hawks"
                    abbreviation: "ATL"
                    is_away: true
                    is_home: false

  # ─── V1 LINES ─────────────────────────────────────────────────────────
  /api/v1/lines/best:
    get:
      operationId: v1GetBestLineMulti
      tags: [V1 Lines]
      summary: Get best lines for multiple events
      parameters:
        - name: event_ids
          in: query
          required: true
          schema:
            type: string
          description: Comma-separated event IDs
        - name: period
          in: query
          schema:
            type: string
            default: period_full_game
            enum:
              - period_full_game
              - period_first_half
              - period_second_half
              - period_first_period
              - period_second_period
              - period_third_period
              - period_fourth_period
              - period_live_full_game
              - period_live_first_half
              - period_live_second_half
              - period_live_first_period
              - period_live_second_period
              - period_live_third_period
              - period_live_fourth_period
        - $ref: '#/components/parameters/AffiliateIDsQuery'
      responses:
        '200':
          description: Best lines keyed by event ID
          content:
            application/json:
              schema:
                type: object
                additionalProperties:
                  $ref: '#/components/schemas/BestLineResponse'
              example:
                "09bfa53f8484a63e584398545c035932":
                  event_id: "09bfa53f8484a63e584398545c035932"
                  moneyline:
                    moneyline_away: 155
                    moneyline_home: -170
                    best_affiliate_away:
                      affiliate_id: 23
                      affiliate_name: "Fanduel"
                      updated_at: "2026-02-12T00:10:00Z"
                    best_affiliate_home:
                      affiliate_id: 19
                      affiliate_name: "Draftkings"
                      updated_at: "2026-02-12T00:10:00Z"
                  spread:
                    point_spread_away: 4.5
                    point_spread_home: -4.5
                    point_spread_away_money: -105
                    point_spread_home_money: -108
                    best_affiliate_away:
                      affiliate_id: 3
                      affiliate_name: "Pinnacle"
                      updated_at: "2026-02-12T00:08:00Z"
                    best_affiliate_home:
                      affiliate_id: 23
                      affiliate_name: "Fanduel"
                      updated_at: "2026-02-12T00:10:00Z"
                  total:
                    total_over: 224.5
                    total_under: 224.5
                    total_over_money: -108
                    total_under_money: -105
                    best_affiliate_over:
                      affiliate_id: 19
                      affiliate_name: "Draftkings"
                      updated_at: "2026-02-12T00:10:00Z"
                    best_affiliate_under:
                      affiliate_id: 3
                      affiliate_name: "Pinnacle"
                      updated_at: "2026-02-12T00:08:00Z"

  /api/v1/lines/{id}/moneyline:
    get:
      operationId: v1GetMoneylines
      tags: [V1 Lines]
      summary: Get moneyline price history for a line
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
          description: |
            Line ID (`line_id`), not an event ID. Find it in a V1 event response at `lines.{affiliate_id}.line_id`, or with `include=all_periods` at `line_periods.{affiliate_id}.{period}.moneyline.line_id` (every period of a sportsbook's line shares the same line ID). Each line ID belongs to one sportsbook.
        - name: include
          in: query
          schema:
            type: string
            enum: [all_periods]
          description: |
            Without `include`, only the pregame full-game price history is returned. With `include=all_periods`, rows are grouped by period (`period_full_game`, halves, quarters/periods) and in-play rows are returned under `period_live_full_game` (live full game, halves, and quarters/periods together; tell them apart by `period_id` and `period_description`). Live rows require a subscription with live odds access. Each period returns at most the newest 1,000 rows with no pagination; for full in-play history use `GET /api/v2/events/{eventID}/markets/history?market_ids=41,42,43,96` with `from`/`to` and `limit` up to 5000.
      responses:
        '200':
          description: 'Moneylines. An unknown line ID returns `{"moneylines": []}`.'
          content:
            application/json:
              schema:
                type: object
                properties:
                  moneylines:
                    type: array
                    items:
                      $ref: '#/components/schemas/V1Moneyline'
              example:
                moneylines:
                  - affiliate_id: 4
                    moneyline_away: -105
                    moneyline_away_delta: 5
                    moneyline_home: -115
                    moneyline_home_delta: -5
                    moneyline_draw: 0.0001
                    date_updated: "2026-02-11T22:00:00Z"
                  - affiliate_id: 19
                    moneyline_away: -110
                    moneyline_away_delta: 0
                    moneyline_home: -110
                    moneyline_home_delta: 0
                    moneyline_draw: 0.0001
                    date_updated: "2026-02-11T21:30:00Z"
        '404':
          description: The line ID exists but has no moneyline prices to return.

  /api/v1/lines/{id}/spread:
    get:
      operationId: v1GetSpreads
      tags: [V1 Lines]
      summary: Get spread price history for a line
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
          description: |
            Line ID (`line_id`), not an event ID. Find it in a V1 event response at `lines.{affiliate_id}.line_id`, or with `include=all_periods` at `line_periods.{affiliate_id}.{period}.moneyline.line_id` (every period of a sportsbook's line shares the same line ID). Each line ID belongs to one sportsbook.
        - name: include
          in: query
          schema:
            type: string
            enum: [all_periods]
          description: |
            Without `include`, only the pregame full-game price history is returned. With `include=all_periods`, rows are grouped by period (`period_full_game`, halves, quarters/periods) and in-play rows are returned under `period_live_full_game` (live full game, halves, and quarters/periods together; tell them apart by `period_id` and `period_description`). Live rows require a subscription with live odds access. Each period returns at most the newest 1,000 rows with no pagination; for full in-play history use `GET /api/v2/events/{eventID}/markets/history?market_ids=41,42,43,96` with `from`/`to` and `limit` up to 5000.
      responses:
        '200':
          description: 'Spreads. An unknown line ID returns `{"spreads": []}`.'
          content:
            application/json:
              schema:
                type: object
                properties:
                  spreads:
                    type: array
                    items:
                      $ref: '#/components/schemas/V1Spread'
              example:
                spreads:
                  - affiliate_id: 4
                    point_spread_away: 1.5
                    point_spread_away_money: -110
                    point_spread_home: -1.5
                    point_spread_home_money: -110
                    date_updated: "2026-02-11T22:00:00Z"
                  - affiliate_id: 19
                    point_spread_away: 2.0
                    point_spread_away_money: -108
                    point_spread_home: -2.0
                    point_spread_home_money: -112
                    date_updated: "2026-02-11T21:30:00Z"
        '404':
          description: The line ID exists but has no spread prices to return.

  /api/v1/lines/{id}/total:
    get:
      operationId: v1GetTotals
      tags: [V1 Lines]
      summary: Get total (over/under) price history for a line
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
          description: |
            Line ID (`line_id`), not an event ID. Find it in a V1 event response at `lines.{affiliate_id}.line_id`, or with `include=all_periods` at `line_periods.{affiliate_id}.{period}.moneyline.line_id` (every period of a sportsbook's line shares the same line ID). Each line ID belongs to one sportsbook.
        - name: include
          in: query
          schema:
            type: string
            enum: [all_periods]
          description: |
            Without `include`, only the pregame full-game price history is returned. With `include=all_periods`, rows are grouped by period (`period_full_game`, halves, quarters/periods) and in-play rows are returned under `period_live_full_game` (live full game, halves, and quarters/periods together; tell them apart by `period_id` and `period_description`). Live rows require a subscription with live odds access. Each period returns at most the newest 1,000 rows with no pagination; for full in-play history use `GET /api/v2/events/{eventID}/markets/history?market_ids=41,42,43,96` with `from`/`to` and `limit` up to 5000.
      responses:
        '200':
          description: 'Totals. A line ID with no total prices returns `{"totals": []}`.'
          content:
            application/json:
              schema:
                type: object
                properties:
                  totals:
                    type: array
                    items:
                      $ref: '#/components/schemas/V1Total'
              example:
                totals:
                  - affiliate_id: 4
                    total_over: 235.5
                    total_over_money: -110
                    total_under: 235.5
                    total_under_money: -110
                    date_updated: "2026-02-11T22:00:00Z"
                  - affiliate_id: 19
                    total_over: 234.5
                    total_over_money: -108
                    total_under: 234.5
                    total_under_money: -112
                    date_updated: "2026-02-11T21:30:00Z"
        '404':
          description: No line matches the ID.

  /api/v1/lines/{id}/team_total:
    get:
      operationId: v1GetTeamTotals
      tags: [V1 Lines]
      summary: Get team totals for a line
      description: >-
        V1 team-total rows are not updated for current events, so this route
        currently returns no rows (`{}`, or empty `team_total_periods_away` and
        `team_total_periods_home` objects with `include=all_periods`). For
        current team totals, use V2 market `94` (Team Totals) on the V2 event
        endpoints.
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
          description: |
            Line ID (`line_id`), not an event ID. Find it in a V1 event response at `lines.{affiliate_id}.line_id`, or with `include=all_periods` at `line_periods.{affiliate_id}.{period}.moneyline.line_id` (every period of a sportsbook's line shares the same line ID). Each line ID belongs to one sportsbook.
        - name: include
          in: query
          schema:
            type: string
            enum: [all_periods]
          description: |
            Set to `all_periods` to include period team totals and, with live odds access, in-play team totals (returned under `period_live_full_game`). For full in-play team-total history use `GET /api/v2/events/{eventID}/markets/history?market_ids=96`.
      responses:
        '200':
          description: Team totals
          content:
            application/json:
              schema:
                type: object
                properties:
                  team_totals_away:
                    type: array
                    description: Full-game away team-total rows. Each row has `team_id` plus the fields of a V1 total row, for example `line_id`, `affiliate_id`, `total_over`, `total_over_money`, `total_under`, `total_under_money` and `date_updated`. Omitted when there are no rows.
                    items:
                      type: object
                  team_totals_home:
                    type: array
                    description: Full-game home team-total rows, shaped like `team_totals_away`. Omitted when there are no rows.
                    items:
                      type: object
                  team_total_periods_away:
                    type: object
                    description: With `include=all_periods`, away rows grouped by period key (`period_full_game`, `period_first_half`, `period_second_half`, `period_first_period` through `period_fourth_period`, and `period_live_full_game`). Period keys with no rows are omitted.
                    additionalProperties:
                      type: array
                      items:
                        type: object
                  team_total_periods_home:
                    type: object
                    description: With `include=all_periods`, home rows grouped by period key, shaped like `team_total_periods_away`.
                    additionalProperties:
                      type: array
                      items:
                        type: object
              example: {}

  # ─── V1 SPORTS ────────────────────────────────────────────────────────
  /api/v1/sports:
    get:
      operationId: v1GetSports
      tags: [V1 Sports]
      summary: List all sports
      security: []
      responses:
        '200':
          description: List of sports
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SportsResponse'
              example:
                sports:
                  - sport_id: 1
                    sport_name: "NCAA Football"
                  - sport_id: 2
                    sport_name: "NFL"
                  - sport_id: 3
                    sport_name: "MLB"
                  - sport_id: 4
                    sport_name: "NBA"
                  - sport_id: 5
                    sport_name: "NCAA Men's Basketball"
                  - sport_id: 6
                    sport_name: "NHL"
                  - sport_id: 7
                    sport_name: "UFC/MMA"
                  - sport_id: 8
                    sport_name: "WNBA"
                  - sport_id: 10
                    sport_name: "MLS"
                  - sport_id: 11
                    sport_name: "EPL"
                  - sport_id: 12
                    sport_name: "FRA1"
                  - sport_id: 13
                    sport_name: "GER1"
                  - sport_id: 14
                    sport_name: "ESP1"
                  - sport_id: 15
                    sport_name: "ITA1"
                  - sport_id: 16
                    sport_name: "UEFACHAMP"
                  - sport_id: 17
                    sport_name: "UEFAEURO"
                  - sport_id: 18
                    sport_name: "FIFA"
                  - sport_id: 19
                    sport_name: "JPN1"
                  - sport_id: 20
                    sport_name: "IPL"
                  - sport_id: 21
                    sport_name: "T20"
                  - sport_id: 22
                    sport_name: "Politics"
                  - sport_id: 23
                    sport_name: "NBA Preseason"
                  - sport_id: 24
                    sport_name: "NBA Playoffs"
                  - sport_id: 25
                    sport_name: "NFL Preseason"
                  - sport_id: 26
                    sport_name: "NFL Playoffs"
                  - sport_id: 27
                    sport_name: "NHL Preseason"
                  - sport_id: 28
                    sport_name: "NHL Playoffs"
                  - sport_id: 30
                    sport_name: "MLB Spring Training"
                  - sport_id: 31
                    sport_name: "MLB Playoffs"
                  - sport_id: 32
                    sport_name: "NBA Summer League"
                  - sport_id: 33
                    sport_name: "UEFA Europa League"
                  - sport_id: 34
                    sport_name: "Liga MX"
                  - sport_id: 38
                    sport_name: "ATP"
                  - sport_id: 39
                    sport_name: "WTA"

  /api/v1/sports/{sportID}/teams:
    get:
      operationId: v1GetTeamsBySport
      tags: [V1 Sports]
      summary: Get teams for a sport
      parameters:
        - $ref: '#/components/parameters/SportIDPath'
      responses:
        '200':
          description: Teams
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TeamsResponse'
              example:
                teams:
                  - team_id: 11
                    name: "Atlanta"
                    mascot: "Hawks"
                    abbreviation: "ATL"
                    record: "26-30"
                  - team_id: 1
                    name: "Boston"
                    mascot: "Celtics"
                    abbreviation: "BOS"
                    record: "35-19"

  /api/v1/sports/{sportID}/divisions:
    get:
      operationId: v1GetDivisionsBySport
      tags: [V1 Sports]
      summary: Get divisions for a sport
      parameters:
        - $ref: '#/components/parameters/SportIDPath'
      responses:
        '200':
          description: Divisions
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DivisionsResponse'
              example:
                divisions:
                  - division_id: 15
                    conference_id: 39
                    sport_id: 4
                    name: "Atlantic"
                  - division_id: 16
                    conference_id: 39
                    sport_id: 4
                    name: "Central"

  /api/v1/sports/{sportID}/conferences:
    get:
      operationId: v1GetConferencesBySport
      tags: [V1 Sports]
      summary: Get conferences for a sport
      parameters:
        - $ref: '#/components/parameters/SportIDPath'
      responses:
        '200':
          description: Conferences
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConferencesResponse'
              example:
                conferences:
                  - conference_id: 39
                    sport_id: 4
                    name: "Eastern Conference"
                  - conference_id: 757
                    sport_id: 4
                    name: "Western Conference"

  /api/v1/sports/{sportID}/dates:
    get:
      operationId: v1GetDatesBySport
      tags: [V1 Sports]
      summary: Get available dates for a sport
      parameters:
        - $ref: '#/components/parameters/SportIDPath'
        - $ref: '#/components/parameters/OffsetQuery'
        - $ref: '#/components/parameters/DateFormatQuery'
        - $ref: '#/components/parameters/ExcludeCanceledQuery'
      responses:
        '200':
          description: Dates
          content:
            application/json:
              schema:
                type: object
                properties:
                  dates:
                    type: array
                    items:
                      type: string
              example:
                dates:
                  - "2026-02-13T00:30:00+0000"
                  - "2026-02-14T00:00:00+0000"
                  - "2026-02-15T00:00:00+0000"

  /api/v1/sports/{sportID}/schedule:
    get:
      operationId: v1GetScheduleBySport
      tags: [V1 Sports]
      summary: Get event schedule for a sport
      description: |
        Returns scheduled events for a sport. This endpoint is non-billable:
        every successful response, including nonempty ones, consumes zero data
        points, so `X-Datapoints` is omitted. Usage window headers are still
        returned for keys with an active plan.
      parameters:
        - $ref: '#/components/parameters/SportIDPath'
        - name: limit
          in: query
          schema:
            type: integer
            default: 50
        - name: season_year
          in: query
          schema:
            type: integer
        - name: season_type_id
          in: query
          schema:
            type: integer
        - name: from
          in: query
          schema:
            type: string
            format: date
        - name: team_id
          in: query
          schema:
            type: integer
        - name: last_event_uuid
          in: query
          schema:
            type: string
          description: "Cursor for pagination: pass the last event UUID from previous page"
        - name: sort
          in: query
          schema:
            type: string
            default: asc
            enum: [asc, desc]
        - name: conference_id
          in: query
          schema:
            type: integer
        - name: division_id
          in: query
          schema:
            type: integer
        - name: include
          in: query
          schema:
            type: string
            enum: [teams]
          description: Set to `teams` to add `away_team_detail` and `home_team_detail` objects to each schedule entry.
      responses:
        '200':
          description: Schedule
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ScheduleResponse'
              example:
                schedules:
                  - event_id: "09bfa53f8484a63e584398545c035932"
                    event_uuid: "11f1-07a5-c61d4000-867b-48b2af0d735d"
                    sport_id: 4
                    event_date: "2026-02-12T00:00:00Z"
                    league_name: "National Basketball Association"
                    season_type: "Regular Season"
                    season_year: 2026
                    event_name: "Atlanta at Charlotte"
                    teams_normalized:
                      - team_id: 11
                        name: "Atlanta"
                        mascot: "Hawks"
                        abbreviation: "ATL"
                        is_away: true
                        is_home: false
                      - team_id: 12
                        name: "Charlotte"
                        mascot: "Hornets"
                        abbreviation: "CHA"
                        is_away: false
                        is_home: true

  /api/v1/sports/{sportID}/events/{date}:
    get:
      operationId: v1GetEventsBySportAndDate
      tags: [V1 Events]
      summary: Get events with lines for a sport and date
      parameters:
        - $ref: '#/components/parameters/SportIDPath'
        - name: date
          in: path
          required: true
          schema:
            type: string
            format: date
        - $ref: '#/components/parameters/OffsetQuery'
        - name: conference_id
          in: query
          schema:
            type: integer
        - name: division_id
          in: query
          schema:
            type: integer
        - $ref: '#/components/parameters/AffiliateIDsQuery'
        - $ref: '#/components/parameters/EventStatusQuery'
        - name: exclude_status
          in: query
          schema:
            type: string
          description: Comma-separated event statuses to exclude
        - name: include
          in: query
          schema:
            type: string
            enum: [all_periods]
      responses:
        '200':
          description: Events with lines
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V1EventsResponse'
              example:
                events:
                  - event_id: "09bfa53f8484a63e584398545c035932"
                    sport_id: 4
                    event_date: "2026-02-12T00:00:00Z"
                    teams_normalized:
                      - team_id: 11
                        name: "Atlanta"
                        mascot: "Hawks"
                        abbreviation: "ATL"
                        record: "26-30"
                        is_away: true
                        is_home: false
                      - team_id: 12
                        name: "Charlotte"
                        mascot: "Hornets"
                        abbreviation: "CHA"
                        record: "26-29"
                        is_away: false
                        is_home: true
                    lines:
                      "4":
                        line_id: 17980122
                        moneyline:
                          moneyline_away: -105
                          moneyline_home: -115
                        spread:
                          point_spread_away: 1.5
                          point_spread_away_money: -110
                          point_spread_home: -1.5
                          point_spread_home_money: -110
                        total:
                          total_over: 235.5
                          total_over_money: -110
                          total_under: 235.5
                          total_under_money: -110

  /api/v1/sports/{sportID}/openers/{date}:
    get:
      operationId: v1GetOpenersBySportAndDate
      tags: [V1 Events]
      summary: Get opening lines for a sport and date
      parameters:
        - $ref: '#/components/parameters/SportIDPath'
        - name: date
          in: path
          required: true
          schema:
            type: string
            format: date
        - $ref: '#/components/parameters/OffsetQuery'
        - name: conference_id
          in: query
          schema:
            type: integer
        - name: division_id
          in: query
          schema:
            type: integer
        - $ref: '#/components/parameters/AffiliateIDsQuery'
        - $ref: '#/components/parameters/EventStatusQuery'
        - name: exclude_status
          in: query
          schema:
            type: string
        - name: include
          in: query
          schema:
            type: string
            enum: [all_periods]
      responses:
        '200':
          description: Events with opening lines
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V1EventsResponse'
              example:
                events:
                  - event_id: "09bfa53f8484a63e584398545c035932"
                    sport_id: 4
                    event_date: "2026-02-12T00:00:00Z"
                    teams_normalized:
                      - team_id: 11
                        name: "Atlanta"
                        mascot: "Hawks"
                        abbreviation: "ATL"
                        is_away: true
                        is_home: false
                    lines:
                      "4":
                        moneyline:
                          moneyline_away: -120
                          moneyline_home: 100

  /api/v1/sports/{sportID}/closing/{date}:
    get:
      operationId: v1GetClosingBySportAndDate
      tags: [V1 Events]
      summary: Get closing lines for a sport and date
      parameters:
        - $ref: '#/components/parameters/SportIDPath'
        - name: date
          in: path
          required: true
          schema:
            type: string
            format: date
        - $ref: '#/components/parameters/OffsetQuery'
        - name: conference_id
          in: query
          schema:
            type: integer
        - name: division_id
          in: query
          schema:
            type: integer
        - $ref: '#/components/parameters/AffiliateIDsQuery'
        - $ref: '#/components/parameters/EventStatusQuery'
        - name: exclude_status
          in: query
          schema:
            type: string
        - name: include
          in: query
          schema:
            type: string
            enum: [all_periods]
      responses:
        '200':
          description: Events with closing lines
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V1EventsResponse'
              example:
                events:
                  - event_id: "09bfa53f8484a63e584398545c035932"
                    sport_id: 4
                    event_date: "2026-02-12T00:00:00Z"
                    teams_normalized:
                      - team_id: 11
                        name: "Atlanta"
                        mascot: "Hawks"
                        abbreviation: "ATL"
                        is_away: true
                        is_home: false
                    lines:
                      "4":
                        moneyline:
                          moneyline_away: -105
                          moneyline_home: -115

  # ─── V1 DELTA ──────────────────────────────────────────────────────────
  /api/v1/delta:
    get:
      operationId: v1GetDelta
      tags: [V1 Delta]
      summary: Get event deltas (V1 format)
      parameters:
        - name: last_id
          in: query
          required: true
          schema:
            type: string
            minLength: 36
            maxLength: 36
          description: >-
            Event-delta cursor (36 characters). This route rejects the all-zero
            bootstrap cursor with HTTP 400. Start from the `meta.delta_last_id`
            of a V1 events response, or from the cursor that `/api/v1/deltaV2`
            returns for `last_id=00000000-0000-0000-0000-000000000000`, then pass
            the `meta.delta_last_id` from each response.
        - name: sport_id
          in: query
          schema:
            type: integer
        - $ref: '#/components/parameters/AffiliateIDsQuery'
        - name: include
          in: query
          schema:
            type: string
            enum: [all_periods]
      responses:
        '200':
          description: Events with changes
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V1EventsResponse'
              example:
                meta:
                  delta_last_id: "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
                events:
                  - event_id: "09bfa53f8484a63e584398545c035932"
                    sport_id: 4
                    event_date: "2026-02-12T00:00:00Z"
                    lines:
                      "4":
                        moneyline:
                          moneyline_away: -112
                          moneyline_home: -108

  /api/v1/deltaV2:
    get:
      operationId: v1GetDeltaV2
      tags: [V1 Delta]
      summary: Get event deltas (V2 format via V1 path)
      parameters:
        - name: last_id
          in: query
          required: true
          schema:
            type: string
            minLength: 36
            maxLength: 36
          description: >-
            Event-delta cursor (36 characters). Use
            `00000000-0000-0000-0000-000000000000` to get the current cursor with
            no deltas, then pass the `meta.delta_last_id` from each response.
        - name: sport_id
          in: query
          schema:
            type: integer
        - $ref: '#/components/parameters/AffiliateIDsQuery'
      responses:
        '200':
          description: Delta updates
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeltasResponse'
              example:
                meta:
                  delta_last_id: "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
                deltas:
                  - data: "{\"event_id\":\"09bfa53f8484a63e584398545c035932\",\"sport_id\":4,\"event_date\":\"2026-02-12T00:00:00Z\",\"lines\":{...}}"

  # ─── V1 REFERENCE ─────────────────────────────────────────────────────
  /api/v1/affiliates:
    get:
      operationId: v1GetAffiliates
      tags: [V1 Reference]
      summary: List all sportsbooks/affiliates
      description: Returns currently published sportsbook IDs, names, URLs and overall status. With sport_id, status is sport-scoped and status_scope is sport. include=sports adds sport_id, status and since for each stored sport row; combine with include=regions. Responses without parameters are unchanged. Status data is cached for up to 15 seconds. Treat unknown status values as unknown. Health labels do not filter odds. No authentication required.
      security: []
      parameters:
      - name: include
        in: query
        description: Optional regions and/or sports; combine as include=regions,sports or
          repeat the parameter.
        schema:
          type: array
          items:
            type: string
            enum:
            - regions
            - sports
        style: form
        explode: false
      - name: sport_id
        in: query
        description: One positive sport ID. Scopes each affiliate status to that sport and
          adds status_scope=sport. When a successful lookup has no stored row for the requested
          sport, its scoped status defaults to healthy, including for an unknown positive sport ID.
          This fallback does not prove sport coverage. No sport row is synthesized.
          Held books (19, 22, 23) remain healthy except when an explicit unhealthy whole-book
          restriction applies to BetMGM (22). Beta integrations remain beta. Unknown positive IDs are
          accepted. Does not filter affiliates or sports[]. Empty, repeated, non-integer
          or out-of-range IDs return 400. Database read failures return 500 instead of the missing-row fallback.
        schema:
          type: integer
          minimum: 1
          maximum: 4294967295
      responses:
        '400':
          description: Invalid sport_id; supply exactly one positive integer.
        '200':
          description: List of affiliates
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AffiliatesResponse'
              example:
                affiliates:
                  - affiliate_id: 3
                    affiliate_name: "Pinnacle"
                    affiliate_url: "https://www.pinnacle.com"
                    status: "healthy"
                  - affiliate_id: 7
                    affiliate_name: "BookMaker"
                    affiliate_url: "https://www.bookmaker.eu/"
                    status: "healthy"
                  - affiliate_id: 9
                    affiliate_name: "BetCRIS"
                    affiliate_url: "https://sportsbook.betcris.com/"
                    status: "healthy"
                  - affiliate_id: 19
                    affiliate_name: "Draftkings"
                    affiliate_url: "https://sportsbook.draftkings.com"
                    status: "healthy"
                  - affiliate_id: 23
                    affiliate_name: "Fanduel"
                    affiliate_url: "https://sportsbook.fanduel.com"
                    status: "healthy"
                  - affiliate_id: 31
                    affiliate_name: "Polymarket US"
                    affiliate_url: "https://polymarket.us/"
                    status: "healthy"
                  - affiliate_id: 32
                    affiliate_name: "Circa Sports"
                    affiliate_url: "https://www.circasports.com/"
                    status: "healthy"
                  - affiliate_id: 33
                    affiliate_name: "Bet105"
                    affiliate_url: "https://bet105.ag/"
                    status: "healthy"
                  - affiliate_id: 34
                    affiliate_name: "Heritage Sports"
                    affiliate_url: "https://ppm.heritage.linepros.com/"
                    status: "healthy"
                  - affiliate_id: 35
                    affiliate_name: "Caesars Sportsbook"
                    affiliate_url: "https://sportsbook.caesars.com/"
                    status: "healthy"

  /api/v1/sportsbooks:
    get:
      operationId: v1GetSportsbooks
      tags: [V1 Reference]
      summary: List all sportsbooks (alias)
      description: Returns currently published sportsbook IDs, names, URLs and overall status. With sport_id, status is sport-scoped and status_scope is sport. include=sports adds sport_id, status and since for each stored sport row; combine with include=regions. Responses without parameters are unchanged. Status data is cached for up to 15 seconds. Treat unknown status values as unknown. Health labels do not filter odds. No authentication required.
      security: []
      parameters:
      - name: include
        in: query
        description: Optional regions and/or sports; combine as include=regions,sports or
          repeat the parameter.
        schema:
          type: array
          items:
            type: string
            enum:
            - regions
            - sports
        style: form
        explode: false
      - name: sport_id
        in: query
        description: One positive sport ID. Scopes each affiliate status to that sport and
          adds status_scope=sport. When a successful lookup has no stored row for the requested
          sport, its scoped status defaults to healthy, including for an unknown positive sport ID.
          This fallback does not prove sport coverage. No sport row is synthesized.
          Held books (19, 22, 23) remain healthy except when an explicit unhealthy whole-book
          restriction applies to BetMGM (22). Beta integrations remain beta. Unknown positive IDs are
          accepted. Does not filter affiliates or sports[]. Empty, repeated, non-integer
          or out-of-range IDs return 400. Database read failures return 500 instead of the missing-row fallback.
        schema:
          type: integer
          minimum: 1
          maximum: 4294967295
      responses:
        '400':
          description: Invalid sport_id; supply exactly one positive integer.
        '200':
          description: List of sportsbooks
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AffiliatesResponse'
              example:
                affiliates:
                  - affiliate_id: 3
                    affiliate_name: "Pinnacle"
                    affiliate_url: "https://www.pinnacle.com"
                    status: "healthy"
                  - affiliate_id: 7
                    affiliate_name: "BookMaker"
                    affiliate_url: "https://www.bookmaker.eu/"
                    status: "healthy"
                  - affiliate_id: 9
                    affiliate_name: "BetCRIS"
                    affiliate_url: "https://sportsbook.betcris.com/"
                    status: "healthy"
                  - affiliate_id: 19
                    affiliate_name: "Draftkings"
                    affiliate_url: "https://sportsbook.draftkings.com"
                    status: "healthy"
                  - affiliate_id: 31
                    affiliate_name: "Polymarket US"
                    affiliate_url: "https://polymarket.us/"
                    status: "healthy"
                  - affiliate_id: 32
                    affiliate_name: "Circa Sports"
                    affiliate_url: "https://www.circasports.com/"
                    status: "healthy"
                  - affiliate_id: 33
                    affiliate_name: "Bet105"
                    affiliate_url: "https://bet105.ag/"
                    status: "healthy"
                  - affiliate_id: 34
                    affiliate_name: "Heritage Sports"
                    affiliate_url: "https://ppm.heritage.linepros.com/"
                    status: "healthy"
                  - affiliate_id: 35
                    affiliate_name: "Caesars Sportsbook"
                    affiliate_url: "https://sportsbook.caesars.com/"
                    status: "healthy"

  /api/v1/season_types:
    get:
      operationId: v1GetSeasonTypes
      tags: [V1 Reference]
      summary: List season types per sport
      responses:
        '200':
          description: Season types
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SeasonTypesResponse'
              example:
                season_types:
                  - sport_id: 2
                    sport_name: "NFL"
                    season_type_id: 1
                    season_type_name: "Preseason"
                  - sport_id: 2
                    sport_name: "NFL"
                    season_type_id: 2
                    season_type_name: "Regular Season"
                  - sport_id: 4
                    sport_name: "NBA"
                    season_type_id: 2
                    season_type_name: "Regular Season"

  # ─── V1 WEBSOCKET ─────────────────────────────────────────────────────
  /api/v1/ws:
    get:
      operationId: v1WebSocket
      tags: [V1 WebSocket]
      summary: "V1 WebSocket: stream real-time event and market updates"
      description: |
        Establishes a WebSocket connection for streaming V1 event updates and V2 market price deltas.

        **Connection**: `wss://therundown.io/api/v1/ws`

        This legacy endpoint remains available for existing V1 integrations.
        New streaming integrations should use the V2 endpoints and their
        server-side header authentication.

        **Filter parameters** (query string):
        - `affiliate_ids`: comma-separated affiliate IDs
        - `sport_ids`: comma-separated sport IDs (V1 messages only)
        - `event_ids`: comma-separated event IDs
        - `date`: date filter in YYYY-MM-DD format (V1 messages only)

        **Heartbeat**: Every 15 seconds.

        **Message queue**: 1024-message buffer. Messages dropped if client falls behind.
      parameters:
        - $ref: '#/components/parameters/AffiliateIDsQuery'
        - name: sport_ids
          in: query
          schema:
            type: string
        - name: event_ids
          in: query
          schema:
            type: string
        - name: date
          in: query
          schema:
            type: string
            format: date
      responses:
        '101':
          description: WebSocket upgrade successful

# ═════════════════════════════════════════════════════════════════════════
# COMPONENTS
# ═════════════════════════════════════════════════════════════════════════
components:
  securitySchemes:
    ApiKeyQuery:
      type: apiKey
      in: query
      name: key
      description: API key as query parameter. Deprecated for new integrations; retained for existing integrations.
      x-deprecated: true
    ApiKeyHeader:
      type: apiKey
      in: header
      name: X-TheRundown-Key
      description: Recommended API key request header for new integrations

  parameters:
    SportIDPath:
      name: sportID
      in: path
      required: true
      schema:
        type: integer
      description: |
        Sport ID. Common values: 1=NCAAF, 2=NFL, 3=MLB, 4=NBA, 5=NCAAB, 6=NHL, 7=UFC, 8=WNBA, 9=CFL, 10=MLS, 11=EPL, 16=UEFA Champions League, 17=UEFA Europa League (listed as UEFAEURO; 33 returns no events), 34=Liga MX, 38=ATP Tennis, 39=WTA Tennis, 40=PGA Tour Golf, 41=Formula 1

    EventIDPath:
      name: eventID
      in: path
      required: true
      schema:
        type: string
      description: Canonical V2 event ID from the `event_id` field returned by event endpoints

    AffiliateIDsQuery:
      name: affiliate_ids
      in: query
      schema:
        type: string
      description: |
        Comma-separated sportsbook/affiliate IDs to filter. Common values include DraftKings (19), FanDuel (23), BetMGM (22), BookMaker (7), BetCRIS (9), Pinnacle (3), Polymarket US (31), Circa Sports (32), Bet105 (33), and Heritage Sports (34). Availability varies by sport and market.
        On V2 event endpoints (`/api/v2/sports/{sportID}/events/{date}`, `/api/v2/events/{eventID}`, and their openers/closing siblings), `affiliate_ids=0` is a scores-only sentinel: the response keeps events, scores, and status and omits markets and price objects. Other endpoints that share this parameter treat `affiliate_ids` as a sportsbook filter only.

    MarketIDsQuery:
      name: market_ids
      in: query
      schema:
        type: string
        default: '1,2,3'
      description: |
        Comma-separated market IDs. Defaults to `1,2,3` (Moneyline, Spread, Total); for soccer leagues and NHL the default is `1,2,3,563`. The soccer 3-way moneyline (home/draw/away) is served on market 1 as three participants; market 563 carries the NHL 60-minute regulation-time line.
        **Limit: 12 market IDs per request.** Requests with more than 12 IDs are rejected with a `400`: split larger requests into batches of 12, or omit the parameter to use the default.
        On market-definition endpoints (`/api/v2/events/{eventID}/markets`, `/api/v2/sports/{sportID}/markets/{date}`), omitting `market_ids` returns all available market definitions instead of the default set.
        Common IDs: 1=Moneyline, 2=Spread, 3=Total, 29=Player Points, 35=Player Rebounds, 38=Three Pointers, 39=Player Assists, 93=Player PRA, 94=Team Totals.
        Live variants: 41=Live ML, 42=Live Spread, 43=Live Total.

    ParticipantIDsQuery:
      name: participant_ids
      in: query
      schema:
        type: string
      description: Comma-separated participant IDs to filter (max 99)

    ParticipantTypeQuery:
      name: participant_type
      in: query
      schema:
        type: string
        enum: [TYPE_TEAM, TYPE_PLAYER, TYPE_RESULT]
      description: Filter participants by type

    MainLineQuery:
      name: main_line
      in: query
      schema:
        type: string
        enum: ['true', 'false']
        default: 'false'
      description: Only return main lines (primary odds, not alternates). On opening and closing endpoints, this selects main lines in the snapshot. Use history to follow which line was main at each timestamp.

    MainLineHistoryQuery:
      name: main_line
      in: query
      schema:
        type: string
        enum: ['true', 'false']
        default: 'false'
      description: "When `true`, return only history rows (or chart points) that were the sportsbook's main line when written: `is_main_line` = true on history rows, `m` = true on chart points. Sorted by time, each change of the line value for a participant is a main-line move at that timestamp."

    HideClosedQuery:
      name: hide_closed
      in: query
      schema:
        type: string
        enum: ['true', 'false']
        default: 'false'
      description: Exclude currently closed lines when `true`. Omit or set `false` to retrieve completed historical snapshots; an event can remain when no prices match.

    OffsetQuery:
      name: offset
      in: query
      schema:
        type: integer
        default: 0
        example: 300
      description: UTC offset in **minutes** for the date boundary. US zone values change with daylight saving time (daylight / standard), so use the value in effect on the date you request. Eastern `240` / `300`, Central `300` / `360`, Mountain `360` / `420`, Pacific `420` / `480`. Without this, the API day boundary is midnight UTC.

    DateFormatQuery:
      name: format
      in: query
      schema:
        type: string
        default: iso8601
        enum: [iso8601, epoch]
      description: "Date format: `iso8601` returns date strings, `epoch` returns Unix timestamps"

    ExcludeCanceledQuery:
      name: exclude_canceled
      in: query
      schema:
        type: string
        enum: ['true']
      description: Set to `true` to leave out events whose status is `STATUS_CANCELED` or `STATUS_CANCELLED`, so a day that holds only canceled events is not listed. Any other value is ignored. By default canceled events count toward the listed dates.

    SportIDsQuery:
      name: sport_ids
      in: query
      schema:
        type: string
      description: Comma-separated sport IDs

    EventStatusQuery:
      name: event_status
      in: query
      schema:
        type: string
      description: Comma-separated event status strings to include (e.g. `STATUS_IN_PROGRESS,STATUS_HALFTIME`). Applied before `exclude_status`.

    ExcludeStatusQuery:
      name: exclude_status
      in: query
      schema:
        type: string
      description: Comma-separated event status strings to exclude. Applied after `event_status`.

  schemas:
    # ─── REFERENCE DATA ────────────────────────────────────────────────
    Sport:
      type: object
      properties:
        sport_id:
          type: integer
          example: 4
        sport_name:
          type: string
          example: NBA

    SportsResponse:
      type: object
      properties:
        sports:
          type: array
          items:
            $ref: '#/components/schemas/Sport'

    Affiliate:
      type: object
      properties:
        affiliate_id:
          type: integer
          example: 19
        affiliate_name:
          type: string
          example: Draftkings
        affiliate_url:
          type: string
          example: https://draftkings.com
        status:
          type: string
          description: Overall book health unless status_scope is sport. Current values are healthy, unhealthy and beta; treat unknown values as unknown.
          example: healthy
        status_scope:
          type: string
          enum: [sport]
          description: Present only when sport_id scopes status to one sport.
        sports:
          type: array
          description: Stored per-sport health rows, present only with include=sports. An empty
            array means no stored sport proof, not healthy coverage. Held books (19, 22, 23)
            remain healthy except when an explicit unhealthy whole-book restriction applies
            to BetMGM (22). Beta integrations remain beta.
          items:
            $ref: '#/components/schemas/AffiliateSportStatus'
        regions:
          type: array
          items:
            $ref: '#/components/schemas/Region'

    AffiliateSportStatus:
      type: object
      additionalProperties: false
      required:
      - sport_id
      - status
      - since
      properties:
        sport_id:
          type: integer
          description: Sport identifier.
        status:
          type: string
          description: Sport health / rollout status; treat unrecognized values as unknown.
        since:
          type: string
          nullable: true
          format: date-time
          description: UTC timestamp of the effective status change; null when unavailable.
            During an explicit unhealthy whole-book restriction on BetMGM (22), this is the
            whole-book status-change time.

    Region:
      type: object
      properties:
        id:
          type: integer
        name:
          type: string

    AffiliatesResponse:
      type: object
      properties:
        affiliates:
          type: array
          items:
            $ref: '#/components/schemas/Affiliate'

    SeasonTypeSport:
      type: object
      properties:
        sport_id:
          type: integer
        sport_name:
          type: string
        season_type_id:
          type: integer
        season_type_name:
          type: string

    SeasonTypesResponse:
      type: object
      properties:
        season_types:
          type: array
          items:
            $ref: '#/components/schemas/SeasonTypeSport'

    # ─── TEAMS ──────────────────────────────────────────────────────────
    Team:
      type: object
      properties:
        team_id:
          type: integer
          example: 1
        name:
          type: string
          example: New England
        mascot:
          type: string
          example: Patriots
        abbreviation:
          type: string
          example: NE
        ranking:
          type: integer
          nullable: true
        record:
          type: string
          example: '10-7'
        conference:
          $ref: '#/components/schemas/Conference'
        division:
          $ref: '#/components/schemas/Division'

    Conference:
      type: object
      properties:
        conference_id:
          type: integer
        division_id:
          type: integer
          description: Division the conference belongs to, when set (for example `1`, FBS, in NCAA Football). Omitted otherwise.
        sport_id:
          type: integer
        name:
          type: string

    Division:
      type: object
      properties:
        division_id:
          type: integer
        conference_id:
          type: integer
        sport_id:
          type: integer
        name:
          type: string

    TeamNormalized:
      type: object
      properties:
        conference_id:
          type: integer
          description: Conference ID for the team, when it belongs to one. Omitted otherwise.
        division_id:
          type: integer
          description: Division ID for the team, when it belongs to one. Omitted otherwise.
        team_id:
          type: integer
        name:
          type: string
        mascot:
          type: string
        abbreviation:
          type: string
        record:
          type: string
        is_home:
          type: boolean
        is_away:
          type: boolean
        ranking:
          type: integer
          nullable: true
        conference:
          $ref: '#/components/schemas/Conference'
        division:
          $ref: '#/components/schemas/Division'

    TeamsResponse:
      type: object
      properties:
        teams:
          type: array
          items:
            $ref: '#/components/schemas/Team'

    DivisionsResponse:
      type: object
      properties:
        divisions:
          type: array
          items:
            $ref: '#/components/schemas/Division'

    ConferencesResponse:
      type: object
      properties:
        conferences:
          type: array
          items:
            $ref: '#/components/schemas/Conference'

    # ─── PLAYERS ────────────────────────────────────────────────────────
    PlayerNormalized:
      type: object
      properties:
        id:
          type: integer
        sport_id:
          type: integer
        team_id:
          type: integer
        updated_at:
          type: string
          format: date-time
          nullable: true
        first_name:
          type: string
        last_name:
          type: string
        display_name:
          type: string
        weight:
          type: number
        height:
          type: number
        display_weight:
          type: string
        display_height:
          type: string
        age:
          type: integer
        date_of_birth:
          type: string
        slug:
          type: string
        jersey:
          type: string
        position:
          type: string
        position_abbreviation:
          type: string
        debut_year:
          type: integer
        birth_place_city:
          type: string
        birth_place_country:
          type: string
        experience_years:
          type: integer
        active:
          type: boolean
        status:
          type: string
        bats:
          type: string
          description: "MLB only: batting side"
        throws:
          type: string
          description: "MLB only: throwing arm"

    PlayersResponse:
      type: object
      properties:
        players:
          type: array
          items:
            $ref: '#/components/schemas/PlayerNormalized'

    # ─── STATS ──────────────────────────────────────────────────────────
    StatDefinition:
      type: object
      properties:
        id:
          type: integer
          nullable: true
        name:
          type: string
        category:
          type: string
        display_name:
          type: string
        abbreviation:
          type: string
        description:
          type: string
        sport_id:
          type: integer

    TeamStats:
      type: object
      properties:
        team_id:
          type: integer
          nullable: true
        stat_id:
          type: integer
          nullable: true
        stat:
          $ref: '#/components/schemas/StatDefinition'
        season_year:
          type: integer
        season_type:
          type: integer
        season_type_name:
          type: string
        value:
          type: number
        display_value:
          type: string
        per_game_value:
          type: number
        per_game_display_value:
          type: string
        rank:
          type: integer
        rank_display_value:
          type: string
        updated_at:
          type: string
          format: date-time
          nullable: true

    PlayerStats:
      type: object
      properties:
        player_id:
          type: integer
          nullable: true
        player:
          $ref: '#/components/schemas/PlayerNormalized'
        stat_id:
          type: integer
          nullable: true
        stat:
          $ref: '#/components/schemas/StatDefinition'
        season_year:
          type: integer
        season_type:
          type: integer
        season_type_name:
          type: string
        value:
          type: number
        display_value:
          type: string
        per_game_value:
          type: number
        per_game_display_value:
          type: string
        rank:
          type: integer
        rank_display_value:
          type: string
        updated_at:
          type: string
          format: date-time
          nullable: true

    PlayerStatResponse:
      type: object
      properties:
        player:
          $ref: '#/components/schemas/PlayerNormalized'
        stats:
          type: array
          items:
            $ref: '#/components/schemas/PlayerStats'

    TeamGameStats:
      type: object
      properties:
        team_id:
          type: integer
          nullable: true
        team:
          $ref: '#/components/schemas/TeamNormalized'
        stat_id:
          type: integer
          nullable: true
        stat:
          $ref: '#/components/schemas/StatDefinition'
        event_id:
          type: string
        value:
          type: string

    StatsMeta:
      type: object
      properties:
        complete:
          type: boolean
        event_id:
          type: string

    TeamGameStatResponse:
      type: object
      properties:
        team:
          $ref: '#/components/schemas/TeamNormalized'
        meta:
          $ref: '#/components/schemas/StatsMeta'
        stats:
          type: array
          items:
            $ref: '#/components/schemas/TeamGameStats'

    PlayerGameStats:
      type: object
      properties:
        player_id:
          type: integer
          nullable: true
          description: Present on live WebSocket delta rows; REST responses carry the owner once in the group's player.id.
        player:
          $ref: '#/components/schemas/PlayerNormalized'
        stat_id:
          type: integer
          nullable: true
          description: Present on live WebSocket delta rows; use stat.id as the key when normalizing a REST baseline.
        stat:
          $ref: '#/components/schemas/StatDefinition'
        value:
          type: string
        updated_at:
          type: string
          format: date-time
          nullable: true

    PlayerGameStatResponse:
      type: object
      properties:
        player:
          $ref: '#/components/schemas/PlayerNormalized'
        meta:
          $ref: '#/components/schemas/StatsMeta'
        stats:
          type: array
          items:
            $ref: '#/components/schemas/PlayerGameStats'

    # ─── MARKETS (V2) ──────────────────────────────────────────────────
    Market:
      type: object
      description: |
        Market definition. The `line_value_is_participant` flag indicates whether the market is participant-shaped (`true`) or whether the line value should be surfaced as the meaningful handicap, total, method, round, or threshold (`false`).
      properties:
        id:
          type: integer
          example: 1
        name:
          type: string
          example: Money Line
        description:
          type: string
        short_description:
          type: string
        line_value_is_participant:
          type: boolean
          description: If true, the selection is carried by the participant and line values may be placeholders or labels. If false, the line value is meaningful and should be displayed when present.
        proposition:
          type: boolean
          description: Whether this is a proposition/prop market
        period_id:
          type: integer
          nullable: true
          description: |
            Associated period. 0=Full Game, 1=1st Half, 2=2nd Half, 3-6=Quarters/periods, 7=Live Full Game, 13-18=Live periods. For tennis, 3/4 represent prematch Set 1/Set 2 and 15/16 represent live Set 1/Set 2.
        live_variant_id:
          type: integer
          nullable: true
          description: ID of the live/in-play variant of this market
        updated_at:
          type: string
          format: date-time

    MarketDefinition:
      type: object
      description: >-
        Catalog entry from GET /api/v2/markets. Includes the
        legacy market fields plus classification, sport membership and an
        in-play-period flag. live_variant_id is omitted when no variant exists;
        period_id can be null. Results are ordered by market ID.
      required: [class, family, settlement, live, sports]
      properties:
        id:
          type: integer
          example: 1
        name:
          type: string
          example: Money Line
        description:
          type: string
        short_description:
          type: string
        line_value_is_participant:
          type: boolean
          description: If true, the selection is carried by the participant and line values may be placeholders or labels. If false, the line value is meaningful and should be displayed when present.
        proposition:
          type: boolean
          description: Whether this is a proposition/prop market
        period_id:
          type: integer
          nullable: true
          description: |
            Associated period. 0=Full Game, 1=1st Half, 2=2nd Half, 3-6=Quarters/periods, 7=Live Full Game, 13-18=Live periods. For tennis, 3/4 represent prematch Set 1/Set 2 and 15/16 represent live Set 1/Set 2.
        live_variant_id:
          type: integer
          nullable: true
          description: ID of the live/in-play variant of this market
        updated_at:
          type: string
          format: date-time
        class:
          type: string
          description: Market classification. Defaults to special when no catalog entry exists. The response may contain values outside the current filter vocabulary.
        family:
          type: string
          description: Market family. Defaults to other when no catalog entry exists. The response may contain values outside the current filter vocabulary.
        scope:
          type: string
          description: What the outcome refers to. Omitted when no scope is recorded; no default. The response may contain values outside the current filter vocabulary.
        display_group:
          type: string
          enum: [main, game, team, player]
          description: Optional display-group override. Omitted when absent or outside the listed values.
        settlement:
          type: string
          description: When the market settles. Defaults to event when no catalog entry exists. The response may contain values outside the current filter vocabulary.
        live:
          type: boolean
          description: True for a definition whose period_id is an in-play period.
        sports:
          type: array
          items:
            type: integer
          description: Full sport membership, sorted by sport ID. Always an array, empty when no membership is available. A sport_id filter does not trim it.

    MarketResponse:
      type: object
      description: Market with participants and prices for a specific event
      properties:
        id:
          type: integer
          format: int64
        market_id:
          type: integer
          example: 1
        period_id:
          type: integer
        name:
          type: string
          example: Money Line
        market_description:
          type: string
        participants:
          type: array
          items:
            $ref: '#/components/schemas/MarketParticipantResponse'

    MarketParticipantResponse:
      type: object
      properties:
        id:
          type: integer
          description: >-
            Stable, joinable participant identifier. Join on this field rather
            than name to avoid shared-name collisions. Its meaning depends on
            `type`: for `TYPE_TEAM` it is the normalized team ID (stable across
            seasons, matches `event.teams[].team_id`; full record at
            GET /api/v2/teams/{team_id}); for `TYPE_PLAYER` it is the player ID
            (full record at GET /api/v2/players/{player_id}); for `TYPE_RESULT`
            it is a small outcome index (e.g. 0/1 for Over/Under) and is not a
            team or player resource key.
          example: 51
        type:
          type: string
          description: >-
            Kind of participant. Determines what `id` points to (team, player,
            or result outcome).
          enum: [TYPE_TEAM, TYPE_PLAYER, TYPE_RESULT]
        name:
          type: string
          description: >-
            Display name. Not guaranteed unique across participants: join on
            `id`, not `name`.
          example: New England Patriots
        lines:
          type: array
          items:
            $ref: '#/components/schemas/MarketLinesResponse'

    MarketLinesResponse:
      type: object
      properties:
        id:
          type: string
        value:
          type: string
          description: Line value. For spreads/totals this is numeric; for some prop and special markets it can be a method, round, threshold, or other display value. When `line_value_is_participant` is true, the participant usually carries the selection.
        selection:
          type: string
        handicap:
          type: string
        prices:
          type: object
          description: Prices keyed by affiliate ID
          additionalProperties:
            $ref: '#/components/schemas/MarketLinePriceResponse'

    MarketLinePriceResponse:
      type: object
      properties:
        id:
          type: string
        price:
          type: number
          description: American odds price. Value of 0.0001 means "off the board".
          example: -110
        price_delta:
          type: number
          nullable: true
          description: Change from previous price
        is_main_line:
          type: boolean
          description: Whether this is the primary/main line
        source_id:
          type: string
          description: The sportsbook's own identifier for this price/selection, when available. Omitted when the book does not expose one. For Polymarket (affiliate 26) this encodes `<event-slug>-<gamma-market-id>-<clob-token-id>` (parse from the right; the two trailing fields are numeric); see the Source identifiers section of the Sportsbook reference for the full mapping recipe.
        deep_link:
          type: string
          description: Link to this exact selection on the sportsbook, on books that support it (for example BetMGM and Kalshi). Omitted when no exact link is available.
        liquidity_usd:
          type: number
          description: >-
            USD reading for this price. On Kalshi (affiliate 25) and
            Polymarket (affiliate 26) this is approximate resting
            order-book depth (Polymarket reports its own figure alongside
            the price; Kalshi's is derived from its order book on a
            separate refresh cadence). On Pinnacle (affiliate 3) this is
            the book's max stake. Novig (affiliate 30) and Polymarket US
            (affiliate 31) prices also carry a reading. Omitted entirely,
            never null and never a
            fabricated 0, when a current reading is not available. See the
            docs FAQ for details.
          example: 4210.5
        updated_at:
          type: string
          format: date-time
        closed_at:
          type: string
          format: date-time
          description: Closing timestamp for a closed current price. Omitted while open; when applying a full price object, absence means open and clears any previously stored closure timestamp.

    MarketParticipantsResponse:
      type: object
      properties:
        participants:
          type: array
          items:
            $ref: '#/components/schemas/MarketParticipant'

    MarketParticipant:
      type: object
      properties:
        id:
          type: integer
          format: int64
        market_event_id:
          type: integer
          format: int64
        participant_id:
          type: integer
        participant_type:
          type: string
          enum: [TYPE_TEAM, TYPE_PLAYER, TYPE_RESULT]
        participant_name:
          type: string
        updated_at:
          type: string
          format: date-time

    MarketLinePriceHistory:
      type: object
      properties:
        liquidity_usd:
          type: number
          description: USD liquidity reading stored with this history row, with the same meaning as `liquidity_usd` on the price object for that sportsbook. Omitted when no reading was recorded.
        id:
          type: integer
          format: int64
        market_line_price_id:
          type: integer
          format: int64
        event_id:
          type: string
        sport_id:
          type: integer
        affiliate_id:
          type: integer
        market_participant_id:
          type: integer
          format: int64
        market_id:
          type: integer
          format: int64
        line:
          type: string
        price:
          type: string
        previous_price:
          type: string
          nullable: true
        closed_at:
          type: string
          format: date-time
          description: Closing timestamp for this history row; omitted if no recorded closure.
        change_type:
          type: string
          description: 'Type of change: `price` (odds moved on this line), `open` (line first offered), `close` (line taken down), `reopen` (line offered again), `main_line` (only the main-line flag changed; see `is_main_line`), or `current` (no history rows exist yet for the requested line, so the row reflects the current price). When odds and the main-line flag change together the row is a `price` row, so read `is_main_line` on every row rather than relying on `change_type` alone.'
        is_main_line:
          type: boolean
          description: Whether this line was the sportsbook's main line when the row was written. Always present. To reconstruct main-line moves, keep rows with `is_main_line` = true (or pass `main_line=true`), sort by `updated_at`, and each change of `line` for a participant is a main-line move at that timestamp.
        updated_at:
          type: string
          format: date-time

    MarketDeltaResponse:
      type: object
      properties:
        meta:
          type: object
          properties:
            delta_last_id:
              $ref: '#/components/schemas/MarketDeltaCursor'
            count:
              type: integer
            has_more:
              type: boolean
              description: "If true, there are more results: poll again immediately with the returned delta_last_id"
        deltas:
          type: array
          items:
            $ref: '#/components/schemas/MarketDeltaEntry'

    MarketDeltaEntry:
      type: object
      description: A single market line price change entry from the delta feed
      properties:
        id:
          type: integer
          format: int64
        event_id:
          type: string
        sport_id:
          type: integer
        affiliate_id:
          type: integer
        market_id:
          type: integer
          format: int64
        market_name:
          type: string
        participant_id:
          type: integer
          description: Normalized participant ID (team_id, player_id, or result_id)
        participant_type:
          type: string
          enum: [TYPE_TEAM, TYPE_PLAYER, TYPE_RESULT]
        participant_name:
          type: string
        line:
          type: string
          description: Line value (e.g., "-4.5" for spread, "224.5" for total, "" for moneyline)
        price:
          type: string
          description: American odds price as a string (e.g., "-110", "150")
        previous_price:
          type: string
          nullable: true
          description: Previous price before this change
        change_type:
          type: string
          description: 'Type of change: `price`, `open`, `close`, `reopen`, or `main_line` (only the main-line flag changed).'
        is_main_line:
          type: boolean
          description: Whether this price is on the primary/main line. Always present, so clients can switch main lines from the delta feed alone.
        closed_at:
          type: string
          format: date-time
          description: Closing timestamp for this delta entry; omitted if no recorded closure.
        updated_at:
          type: string
          format: date-time

    MarketHistoryResponse:
      type: object
      properties:
        meta:
          type: object
          properties:
            event_id:
              type: string
            market_id:
              type: integer
              format: int64
            count:
              type: integer
        history:
          type: array
          items:
            $ref: '#/components/schemas/MarketLinePriceHistory'

    ChartResponse:
      type: object
      properties:
        meta:
          type: object
          properties:
            event_id:
              type: string
            market_id:
              type: integer
              format: int64
            market_name:
              type: string
        series:
          type: object
          description: Keyed by affiliate ID
          additionalProperties:
            $ref: '#/components/schemas/ChartSeries'

    ChartSeries:
      type: object
      properties:
        affiliate_name:
          type: string
        data:
          type: array
          items:
            type: object
            properties:
              t:
                type: string
                format: date-time
                description: Timestamp. Points are ordered oldest first.
              p:
                type: string
                description: Price
              c:
                type: string
                format: date-time
                description: Closing timestamp for this history point; omitted if no recorded closure.
              l:
                type: string
                description: Line value the point belongs to (for example "-3.5" or "224.5"; empty for moneylines). Select a participant with `participant_id`, then group on `l` or pass `main_line=true` to follow that participant's main line.
              m:
                type: boolean
                description: Whether this line was the main line when the point was written. Always present. With `participant_id` and `main_line=true`, each change of `l` across the series is a main-line move for that participant.

    OpeningPricesResponse:
      type: object
      properties:
        meta:
          type: object
          properties:
            event_id:
              type: string
            count:
              type: integer
        markets:
          type: object
          description: Keyed by market ID
          additionalProperties:
            type: object
            properties:
              market_id:
                type: integer
                format: int64
              market_name:
                type: string
              lines:
                type: object
                description: Keyed by participant_id:line composite key
                additionalProperties:
                  type: object
                  properties:
                    participant_id:
                      type: integer
                    participant_type:
                      type: string
                      enum: [TYPE_TEAM, TYPE_PLAYER, TYPE_RESULT]
                    participant_name:
                      type: string
                    prices:
                      type: object
                      description: Keyed by affiliate ID
                      additionalProperties:
                        type: object
                        properties:
                          price:
                            type: string
                          timestamp:
                            type: string
                            format: date-time

    # ─── FUTURES (V2) ──────────────────────────────────────────────────
    FuturesSettlement:
      type: object
      description: Per-market settlement state for a competition event.
      properties:
        status:
          type: string
          description: >-
            Settlement state. A market with no `settlement` entry at all has
            not entered grading; entries appear with a pre-grading status
            (e.g. `pending`) as the competition nears resolution, and become
            `settled` once graded. `settled` is the only terminal value:
            treat anything else as grading in progress; the vocabulary may
            grow.
          example: settled
        winning_line:
          type: string
          description: >-
            Canonical name of the winning participant. Present once settled,
            for winner-shaped markets only: entry markets (Top 10, Make The
            Cut) grade per participant and settle without a single winner.
          example: Jackson Koivun
        winning_participant_id:
          type: integer
          format: int64
          description: Participant ID of the winner, matching `markets[].participants[].id`. Present once settled, for winner-shaped markets only.
          example: 139644
        settled_at:
          type: string
          format: date-time
          description: When the market graded. Present once settled.

    FuturesSchedule:
      type: object
      description: Trimmed schedule block for a competition event.
      properties:
        event_name:
          type: string
          description: "Human-readable competition name: the display identity of the event."
          example: "NFL Super Bowl Winner (2026 Season)"
        season_year:
          type: integer
          example: 2026
        league_name:
          type: string
          description: League or tour label, when applicable (e.g. `PGA Tour`). Omitted otherwise.
          example: "PGA Tour"

    FuturesEvent:
      type: object
      description: >-
        One competition event. Competitions are intervals: `event_date` is
        the start and `settle_by` the settlement horizon. Futures events have
        no `teams` array and no score block.
      properties:
        event_id:
          type: string
          description: >-
            Opaque hash identifying the competition. Stable for the life of
            the competition: the public handle across snapshots and the
            delta feed.
          example: "a3d1f9f94f220a45cfd944181569cc46"
        sport_id:
          type: integer
          example: 2
        event_date:
          type: string
          format: date-time
          description: When the competition starts (interval start).
        settle_by:
          type: string
          format: date-time
          description: "Settlement horizon: when the competition must have graded (interval end)."
        event_status:
          type: string
          description: >-
            Event status. Season-long team competitions currently remain
            `STATUS_SCHEDULED` for the life of the board (live in-progress
            status for team seasons is not yet populated); short competitions
            like golf tournaments do transition to `STATUS_IN_PROGRESS` and
            `STATUS_FINAL`.
          example: STATUS_SCHEDULED
        settlement:
          type: object
          description: >-
            Per-market settlement state, keyed by market ID. Empty (`{}`)
            until grading begins: a market with no entry has not entered
            grading.
          additionalProperties:
            $ref: '#/components/schemas/FuturesSettlement'
        schedule:
          $ref: '#/components/schemas/FuturesSchedule'
        markets:
          type: array
          description: Future-class markets in the standard V2 market/participant/line/price shape.
          items:
            $ref: '#/components/schemas/MarketResponse'

    FuturesMeta:
      type: object
      properties:
        delta_last_id:
          $ref: '#/components/schemas/MarketDeltaCursor'
          example: "1595215769"
        next_cursor:
          type: string
          description: >-
            Opaque keyset token for the next page. Present only while more
            rows exist; absent on the last page. Pass back verbatim as
            `cursor`.
        count:
          type: integer
          description: Number of events on this page (the length of `events`). Always present.
          example: 50
        has_more:
          type: boolean
          description: >-
            `true` while more pages exist (the same signal as `next_cursor`,
            as a boolean). `false` on the last page. Always present.
          example: true
        total:
          type: integer
          description: >-
            Number of events matching your filters across ALL pages, so you
            can size a listing without walking every page. Counts events, not
            markets; the keyset cursor does not affect it. Always present.
          example: 73

    FuturesEventsResponse:
      type: object
      properties:
        meta:
          $ref: '#/components/schemas/FuturesMeta'
        events:
          type: array
          items:
            $ref: '#/components/schemas/FuturesEvent'

    FuturesProgressPhase:
      type: object
      description: Where the competition is in its lifecycle right now.
      properties:
        status:
          type: string
          description: Same status vocabulary as `event_status` elsewhere (e.g. `STATUS_IN_PROGRESS`, `STATUS_FINAL`).
          example: STATUS_IN_PROGRESS
        label:
          type: string
          description: Human-readable phase label, synthesized for display (never raw upstream text).
          example: "Round 3 of 4"
        unit:
          type: string
          description: The unit `current`/`total` are counted in (e.g. `round` for golf).
          example: round
        current:
          type: [integer, "null"]
          description: Current position within `unit`. `null` when there is no meaningful "current", for example a standings table between games.
          example: 3
        total:
          type: [integer, "null"]
          description: Total `unit` count for the competition, when known; `null` otherwise.
          example: 4

    FuturesProgress:
      type: object
      description: >-
        The competition's live non-odds state (a leaderboard or a standings
        table), refreshed on its own cycle, independent of the odds board.
        `entries[].participant_id` is the same participant ID space
        `markets[].participants[].id` uses, so a progress row joins directly
        to a price. See [Competition Stats
        (Progress)](/guides/futures#competition-stats-progress) for the full
        field list per `kind`.
      properties:
        kind:
          type: string
          description: "Which document shape `context`/`entries` follow. Live today: `stroke_play_leaderboard` (golf) and `league_standings` (team-sport championships)."
          enum: [stroke_play_leaderboard, league_standings]
          example: league_standings
        as_of:
          type: string
          format: date-time
          description: When the document was last refreshed.
        phase:
          $ref: '#/components/schemas/FuturesProgressPhase'
        context:
          type: object
          description: >-
            Kind-specific competition-wide state. `stroke_play_leaderboard`:
            `cut_score`, `cut_count`, `purse`, `round`, `round_state`.
            `league_standings`: an empty object today; standings context
            lives on each entry, not the shared block.
          additionalProperties: true
        entries:
          type: array
          description: >-
            Kind-specific ranked rows. `stroke_play_leaderboard`:
            `participant_id`, `name`, `position`, `tied`, `score_to_par`,
            `today`, `thru`, `movement`, `country`, `total_strokes`,
            `round_state`. `league_standings`: `participant_id`, `name`,
            `rank`, `wins`, `losses`, `ties`, `win_pct`, `points`, plus
            sport-specific fields such as `conference`, `division`, `seed`,
            `games_behind`, `streak`, and (soccer) `goal_difference`. Every
            field beyond the core set is optional and omitted when the
            source doesn't provide it.
          items:
            type: object
            additionalProperties: true

    FuturesLeaderEntry:
      type: object
      description: One ranked participant within a curated stat.
      properties:
        participant_id:
          type: integer
          format: int64
          description: >-
            In `leaders`, the same team participant ID space
            `markets[].participants[].id` and `progress.entries[]` use. In
            `player_leaders`, the normalized player ID space player-prop
            market participants use, a different space from the team IDs.
          example: 61
        name:
          type: string
          example: "Buffalo Bills"
        value:
          type: number
          description: The stat's value for this participant, in the stat's native unit.
          example: 6432
        rank:
          type: integer
          description: 1-based rank within this stat's top 5. Ascending stats (e.g. ERA) rank the MINIMUM value as 1.
          example: 1

    FuturesLeaderStat:
      type: object
      description: One curated stat's top-5 leaderboard.
      properties:
        stat:
          type: string
          description: House display name (never an upstream stat's raw field name).
          example: "Total Yards"
        stat_id:
          type: integer
          format: int64
          description: Internal stat identifier, exposed the same way `market_id` is elsewhere.
          example: 1120
        season_year:
          type: integer
          description: The most recent season with data for this stat, derived per request (never hardcoded).
          example: 2025
        entries:
          type: array
          description: Top 5 ranked rows for this stat.
          items:
            $ref: '#/components/schemas/FuturesLeaderEntry'

    FuturesEventDetail:
      allOf:
        - $ref: '#/components/schemas/FuturesEvent'
        - type: object
          properties:
            progress:
              $ref: '#/components/schemas/FuturesProgress'
            leaders:
              type: array
              description: >-
                Optional team-grain season-stats leaderboard, omitted
                entirely (never an empty array) when the sport has no
                curated stat set or the competition has no resolvable team
                participant. Curated today for NFL, NCAAF, NBA, WNBA, NCAAB,
                MLB, NHL, MLS, EPL, Ligue 1, Bundesliga, La Liga, and Serie
                A.
              items:
                $ref: '#/components/schemas/FuturesLeaderStat'
            player_leaders:
              type: array
              description: >-
                Optional PLAYER-grain season-stats leaderboard: the same
                `{stat, stat_id, season_year, entries[]}` shape as `leaders`,
                but league-wide rather than competition-scoped (player
                season stats carry no team linkage) and keyed on the
                player ID space. Curated today for NFL, NCAAF, NBA, WNBA,
                NCAAB, MLB, and NHL; omitted entirely when the sport has no
                curated player-stat set or no rows exist yet.
              items:
                $ref: '#/components/schemas/FuturesLeaderStat'

    FuturesEventDetailResponse:
      type: object
      properties:
        meta:
          $ref: '#/components/schemas/FuturesMeta'
        events:
          type: array
          description: "A single-element array: one event per request, no paging."
          items:
            $ref: '#/components/schemas/FuturesEventDetail'

    # ─── V2 EVENTS ─────────────────────────────────────────────────────
    Score:
      type: object
      properties:
        event_id:
          type: string
        event_status:
          type: string
          description: |
            Event status. Common values: STATUS_SCHEDULED, STATUS_IN_PROGRESS, STATUS_FINAL, STATUS_POSTPONED, STATUS_CANCELED, STATUS_SUSPENDED, STATUS_DELAYED, STATUS_RAIN_DELAY, STATUS_HALFTIME, STATUS_END_PERIOD, STATUS_END_OF_REGULATION, STATUS_OVERTIME, STATUS_FIRST_HALF, STATUS_SECOND_HALF
        team_id_away:
          type: integer
          description: Away team ID. Omitted when zero.
        team_id_home:
          type: integer
          description: Home team ID. Omitted when zero.
        score_away:
          type: integer
        score_home:
          type: integer
        winner_away:
          type: integer
        winner_home:
          type: integer
        score_away_by_period:
          type: array
          description: >-
            Away team's per-period scores, not running totals; index `0` is the first period.
            Overtime periods are appended. Read this array by its own length.
            Its sum is not guaranteed to equal `score_away`; verify before using it.
          items:
            type: integer
        score_home_by_period:
          type: array
          description: >-
            Home team's per-period scores, not running totals; index `0` is the first period.
            Overtime periods are appended. Read this array by its own length.
            Its sum is not guaranteed to equal `score_home`; verify before using it.
          items:
            type: integer
        venue_name:
          type: string
          description: Arena or stadium name. May be an empty string when unavailable.
        venue_location:
          type: string
          description: City and state. May be an empty string when unavailable.
        game_clock:
          type: integer
        display_clock:
          type: string
        is_clock_running:
          type: boolean
          description: Clock-running flag when supplied. Omitted when unavailable.
        game_period:
          type: integer
        broadcast:
          type: string
        event_status_detail:
          type: string
        updated_at:
          type: string
          format: date-time

    Schedule:
      type: object
      properties:
        season_type:
          type: string
          example: Regular Season
        season_year:
          type: integer
          example: 2026
        conference_competition:
          type: boolean
          nullable: true
        conference_name:
          type: string
        league_name:
          type: string
          nullable: true
        event_name:
          type: string
        attendance:
          type: string
        event_headline:
          type: string
        game_number:
          type: integer
          enum: [1, 2]
          description: Game number for a true MLB doubleheader. Omitted for ordinary and standalone makeup games.
        game_type:
          type: string
          enum: [doubleheader, makeup, doubleheader_makeup]
          description: Structured MLB doubleheader or makeup classification. Omitted for ordinary games.
        week:
          type: integer
        week_name:
          type: string
        week_detail:
          type: string

    Pitcher:
      type: object
      properties:
        id:
          type: integer
        name:
          type: string
        throws_left_handed:
          type: boolean
          nullable: true
        throws_right_handed:
          type: boolean
          nullable: true
        bats_left_handed:
          type: boolean
          nullable: true
        bats_right_handed:
          type: boolean
          nullable: true

    EventV2:
      type: object
      properties:
        event_id:
          type: string
          description: Canonical event identifier string used by V2 endpoints, filters, and delta feeds.
          example: ada1bad2588972bb0f0e4debf9ed92b5
        event_uuid:
          type: string
          description: Compatibility identifier retained for older integrations. Do not assume it matches `event_id`.
          example: 11f2-1f6d-22f0a800-8cca-2165a45d5e4a
        sport_id:
          type: integer
          example: 4
        event_date:
          type: string
          format: date-time
        rotation_number_away:
          type: integer
        rotation_number_home:
          type: integer
        score:
          $ref: '#/components/schemas/Score'
        teams:
          type: array
          items:
            $ref: '#/components/schemas/TeamNormalized'
        schedule:
          $ref: '#/components/schemas/Schedule'
        pitcher_away:
          $ref: '#/components/schemas/Pitcher'
        pitcher_home:
          $ref: '#/components/schemas/Pitcher'
        markets:
          type: array
          items:
            $ref: '#/components/schemas/MarketResponse'
        live_game_state:
          $ref: '#/components/schemas/LiveGameState'
        affiliate_source_ids:
          type: object
          additionalProperties:
            type: string
          description: Map of affiliate ID (as a string) to that sportsbook's own identifier for this event, when available. Useful for deep-linking or joining against a book's data. For Polymarket (affiliate 26) the value is the Polymarket event slug; see the Source identifiers section of the Sportsbook reference.
          example:
            "19": "31580014"
            "23": "34031-88749503"
        teams_normalized:
          type: array
          description: The same team objects as `teams`, repeated under the V1 field name for V1-to-V2 migration parity.
          items:
            $ref: '#/components/schemas/TeamNormalized'
        affiliate_deep_links:
          type: object
          additionalProperties:
            type: string
          description: Navigation URLs keyed by affiliate ID (as a string). Each URL is the event's page on that sportsbook unless `affiliate_deep_link_types` marks it as a catalog fallback. Omitted when no links are available.
        affiliate_deep_link_types:
          type: object
          additionalProperties:
            type: string
            enum: [catalog]
          description: Route type for entries in `affiliate_deep_links`, keyed by affiliate ID. `catalog` marks a validated sportsbook catalog page used as a fallback; an affiliate ID absent from this map has an event-page URL.

    Meta:
      type: object
      properties:
        delta_last_id:
          type: string

    MarketDeltaCursor:
      description: >-
        Positive whole-integer cursor for `/api/v2/markets/delta`. The API
        may return it as an integer or a numeric string. Use a snapshot value
        to begin market-delta polling only for known zero-delay access when
        that snapshot explicitly reports `X-Data-Delay-Seconds: 0`; otherwise
        use scoped snapshots and never substitute `0`.
      oneOf:
        - type: integer
          format: int64
          minimum: 1
        - type: string
          pattern: '^[1-9][0-9]*$'

    EventsSnapshotMeta:
      type: object
      nullable: true
      properties:
        delta_last_id:
          $ref: '#/components/schemas/MarketDeltaCursor'

    EventsV2Response:
      type: object
      properties:
        meta:
          $ref: '#/components/schemas/EventsSnapshotMeta'
        events:
          type: array
          items:
            $ref: '#/components/schemas/EventV2'

    DeltasResponse:
      type: object
      properties:
        meta:
          $ref: '#/components/schemas/Meta'
        deltas:
          type: array
          items:
            type: object
            properties:
              data:
                type: string
                description: Raw JSON string of the delta payload

    # ─── LIVE GAME STATE & PLAY-BY-PLAY (Ultra plan or higher) ─────────
    LiveGameState:
      type: object
      description: >
        Real-time game-state snapshot embedded on live event payloads.
        Requires the live game state entitlement (Ultra plan or higher);
        keys without it never receive this field. Sport-specific blocks
        (`mlb`, `football`, `basketball`, `hockey`) are present only for
        the relevant sport.
      properties:
        event_id:
          type: string
        sport_id:
          type: integer
        sport:
          type: string
          description: "Sport slug: `mlb`, `nba`, `nba-summer`, `ncaab`, `nfl`, `ncaaf`, `nhl`, `wnba`, or `soccer`"
          example: mlb
        period:
          type: integer
          description: Current period/inning/quarter number
        half_indicator:
          type: string
          description: Half within the period where applicable (`top` or `bot` for MLB innings)
        display_clock:
          type: string
          description: Clock display string. Omitted when inapplicable or not yet known.
        clock_seconds:
          type: integer
          description: The same clock in seconds. Omitted when inapplicable or not yet known.
        clock_running:
          type: boolean
          description: Whether the clock has been observed running. Omitted when inapplicable or not yet known.
        clock_as_of:
          type: string
          format: date-time
          description: When this clock value was observed, separate from the state row's updated_at.
        last_play:
          $ref: '#/components/schemas/LastPlayRef'
        updated_at:
          type: string
          format: date-time
        mlb:
          type: object
          description: Baseball-only snapshot
          properties:
            balls:
              type: integer
            strikes:
              type: integer
            outs:
              type: integer
            on_first:
              $ref: '#/components/schemas/PlayPlayerSummary'
            on_second:
              $ref: '#/components/schemas/PlayPlayerSummary'
            on_third:
              $ref: '#/components/schemas/PlayPlayerSummary'
            current_batter:
              $ref: '#/components/schemas/PlayPlayerSummary'
            current_pitcher:
              $ref: '#/components/schemas/PlayPlayerSummary'
        football:
          type: object
          description: NFL/NCAAF-only snapshot
          properties:
            possession_team_id:
              type: integer
            down:
              type: integer
            distance:
              type: integer
            yard_line:
              type: integer
            down_distance_text:
              type: string
              example: "3rd & 4 at KC 38"
            short_down_distance_text:
              type: string
              example: "3rd & 4"
            possession_text:
              type: string
            is_red_zone:
              type: boolean
            home_timeouts:
              type: integer
            away_timeouts:
              type: integer
        basketball:
          type: object
          description: NBA/WNBA/NCAAB-only snapshot
          properties:
            possession_team_id:
              type: integer
            home_timeouts:
              type: integer
            away_timeouts:
              type: integer
            home_in_bonus:
              type: boolean
            away_in_bonus:
              type: boolean
        hockey:
          type: object
          description: NHL-only snapshot
          properties:
            possession_team_id:
              type: integer
            strength:
              type: string
              description: Skater strength situation (e.g. even strength, power play)
            power_play_team_id:
              type: integer
            home_shots_on_goal:
              type: integer
            away_shots_on_goal:
              type: integer
            home_goalie_pulled:
              type: boolean
            away_goalie_pulled:
              type: boolean

    LastPlayRef:
      type: object
      description: Reference to the most recent play, mirrored from the play-by-play timeline
      properties:
        display_clock:
          type: string
          description: Game clock at the moment of the play, frozen thereafter. The live clock is `display_clock` on `live_game_state`.
        play_id:
          type: integer
          format: int64
        sequence:
          type: integer
        type:
          type: string
        result:
          type: string
        description:
          type: string
        team_id:
          type: integer
        scoring_play:
          type: boolean
        score_value:
          type: integer
        occurred_at:
          type: string
          format: date-time
        participants:
          type: array
          items:
            $ref: '#/components/schemas/PlayParticipant'

    PlaysResponse:
      type: object
      properties:
        event_id:
          type: string
        sport_id:
          type: integer
        sport:
          type: string
          example: mlb
        plays:
          type: array
          description: Plays in ascending sequence order. Always an array, never null.
          items:
            $ref: '#/components/schemas/Play'
        latest_sequence:
          type: integer
          description: Highest `sequence` currently available for this event (`0` when it has no plays). Present on every response, including empty pages. If your `after_sequence` cursor is above this value, lower it to this value so polling resumes.
        latest_play_id:
          type: integer
          format: int64
          description: '`play_id` of the play at `latest_sequence` (`0` when the event has no plays).'

    Play:
      type: object
      properties:
        play_id:
          type: integer
          format: int64
        sequence:
          type: integer
          description: Monotonic ordering key within the event. Use with `before_sequence` to page backwards or `after_sequence` to fetch newer plays.
        team_id:
          type: integer
          description: Possession/acting team. May be omitted while per-play attribution rolls out.
        period:
          type: integer
        half_indicator:
          type: string
        type:
          type: string
          description: Play type slug from the source feed (e.g. `pitch` or `play_result` for MLB, `jump_shot` or `defensive_rebound` for NBA, `shot` or `face_off` for NHL, `rush` or `pass_reception` for NFL)
        result:
          type: string
        description:
          type: string
          example: "Bobby Witt doubles"
        scoring_play:
          type: boolean
          description: Whether this play scored. May be omitted while per-play attribution rolls out.
        score_value:
          type: integer
          description: Points/runs/goals credited by this play
        score_away_after:
          type: integer
          description: Away score after this play
        score_home_after:
          type: integer
          description: Home score after this play
        display_clock:
          type: string
          description: Game clock display at the time of the play, where applicable
        occurred_at:
          type: string
          format: date-time
        participants:
          type: array
          description: Players involved in the play. May be omitted while per-play attribution rolls out; not available for NFL/NCAAF live plays.
          items:
            $ref: '#/components/schemas/PlayParticipant'
        mlb:
          type: object
          description: Baseball-only play details
          properties:
            batter:
              $ref: '#/components/schemas/PlayPlayerSummary'
            pitcher:
              $ref: '#/components/schemas/PlayPlayerSummary'
            scorer:
              $ref: '#/components/schemas/PlayPlayerSummary'
            pitch_speed_mph:
              type: number
            exit_velocity_mph:
              type: number
            hit_distance_ft:
              type: number
            launch_angle_deg:
              type: number
        football:
          type: object
          description: NFL/NCAAF-only play details
          properties:
            start_yard_line:
              type: integer
            end_yard_line:
              type: integer
            stat_yardage:
              type: integer
            drive_description:
              type: string

    PlayParticipant:
      type: object
      properties:
        player_id:
          type: integer
          format: int64
          description: "Normalized player ID: joins to the players endpoints"
        name:
          type: string
        team_id:
          type: integer
        role:
          type: string
          example: batter
        position:
          type: string

    PlayPlayerSummary:
      type: object
      properties:
        player_id:
          type: integer
          format: int64
        name:
          type: string
        team_id:
          type: integer

    # ─── V1 EVENTS & LINES ─────────────────────────────────────────────
    V1Moneyline:
      type: object
      properties:
        line_id:
          type: integer
          description: Line identifier, as used by the V1 line routes.
        event_id:
          type: string
        sport_id:
          type: integer
        affiliate_id:
          type: integer
        moneyline_away:
          type: number
          description: Away team moneyline. 0.0001 = off the board.
          example: 150
        moneyline_away_delta:
          type: number
        moneyline_home:
          type: number
          example: -180
        moneyline_home_delta:
          type: number
        moneyline_draw:
          type: number
          description: Draw moneyline (soccer, UFC)
        moneyline_draw_delta:
          type: number
        date_updated:
          type: string
          format: date-time
          nullable: true
        format:
          type: string
          example: American

    V1Spread:
      type: object
      properties:
        line_id:
          type: integer
          description: Line identifier, as used by the V1 line routes.
        event_id:
          type: string
        sport_id:
          type: integer
        affiliate_id:
          type: integer
        point_spread_away:
          type: number
          example: 3.5
        point_spread_away_delta:
          type: number
        point_spread_home:
          type: number
          example: -3.5
        point_spread_home_delta:
          type: number
        point_spread_away_money:
          type: number
          example: -110
        point_spread_away_money_delta:
          type: number
        point_spread_home_money:
          type: number
          example: -110
        point_spread_home_money_delta:
          type: number
        date_updated:
          type: string
          format: date-time
          nullable: true
        format:
          type: string
        extended_spreads:
          type: array
          items:
            $ref: '#/components/schemas/V1Spread'

    V1Total:
      type: object
      properties:
        line_id:
          type: integer
          description: Line identifier, as used by the V1 line routes.
        event_id:
          type: string
        sport_id:
          type: integer
        affiliate_id:
          type: integer
        total_over:
          type: number
          example: 47.5
        total_over_delta:
          type: number
        total_under:
          type: number
          example: 47.5
        total_under_delta:
          type: number
        total_over_money:
          type: number
          example: -110
        total_over_money_delta:
          type: number
        total_under_money:
          type: number
          example: -110
        total_under_money_delta:
          type: number
        date_updated:
          type: string
          format: date-time
          nullable: true
        format:
          type: string
        extended_totals:
          type: array
          items:
            $ref: '#/components/schemas/V1Total'

    V1Line:
      type: object
      properties:
        line_id:
          type: integer
        moneyline:
          $ref: '#/components/schemas/V1Moneyline'
        spread:
          $ref: '#/components/schemas/V1Spread'
        total:
          $ref: '#/components/schemas/V1Total'
        affiliate:
          $ref: '#/components/schemas/Affiliate'
        teams:
          type: array
          items:
            type: object
            properties:
              team_id:
                type: integer
              team_normalized_id:
                type: integer
              name:
                type: string
              is_home:
                type: boolean
              is_away:
                type: boolean
        period_id:
          type: integer
        period_description:
          type: string

    V1LinePeriods:
      type: object
      properties:
        period_full_game:
          $ref: '#/components/schemas/V1Line'
        period_first_half:
          $ref: '#/components/schemas/V1Line'
        period_second_half:
          $ref: '#/components/schemas/V1Line'
        period_first_period:
          $ref: '#/components/schemas/V1Line'
        period_second_period:
          $ref: '#/components/schemas/V1Line'
        period_third_period:
          $ref: '#/components/schemas/V1Line'
        period_fourth_period:
          $ref: '#/components/schemas/V1Line'
        period_live_full_game:
          $ref: '#/components/schemas/V1Line'
        period_live_first_half:
          $ref: '#/components/schemas/V1Line'
        period_live_second_half:
          $ref: '#/components/schemas/V1Line'
        period_live_first_period:
          $ref: '#/components/schemas/V1Line'
        period_live_second_period:
          $ref: '#/components/schemas/V1Line'
        period_live_third_period:
          $ref: '#/components/schemas/V1Line'
        period_live_fourth_period:
          $ref: '#/components/schemas/V1Line'

    V1Event:
      type: object
      properties:
        affiliate_deep_links:
          type: object
          additionalProperties:
            type: string
          description: Navigation URLs keyed by affiliate ID (as a string). Each URL is the event's page on that sportsbook unless `affiliate_deep_link_types` marks it as a catalog fallback. Omitted when no links are available.
        affiliate_deep_link_types:
          type: object
          additionalProperties:
            type: string
            enum: [catalog]
          description: Route type for entries in `affiliate_deep_links`, keyed by affiliate ID. `catalog` marks a validated sportsbook catalog page used as a fallback; an affiliate ID absent from this map has an event-page URL.
        event_id:
          type: string
        event_uuid:
          type: string
        sport_id:
          type: integer
        event_date:
          type: string
          format: date-time
        rotation_number_away:
          type: integer
        rotation_number_home:
          type: integer
        score:
          $ref: '#/components/schemas/Score'
        teams:
          type: array
          items:
            type: object
            properties:
              team_id:
                type: integer
              team_normalized_id:
                type: integer
              name:
                type: string
              is_home:
                type: boolean
              is_away:
                type: boolean
        teams_normalized:
          type: array
          items:
            $ref: '#/components/schemas/TeamNormalized'
        schedule:
          $ref: '#/components/schemas/Schedule'
        lines:
          type: object
          description: Lines keyed by affiliate ID
          additionalProperties:
            $ref: '#/components/schemas/V1Line'
        line_periods:
          type: object
          description: Period-specific lines keyed by affiliate ID (when `include=all_periods`)
          additionalProperties:
            $ref: '#/components/schemas/V1LinePeriods'
        pitcher_away:
          $ref: '#/components/schemas/Pitcher'
        pitcher_home:
          $ref: '#/components/schemas/Pitcher'

    V1EventsResponse:
      type: object
      properties:
        meta:
          $ref: '#/components/schemas/Meta'
        events:
          type: array
          items:
            $ref: '#/components/schemas/V1Event'

    # ─── BEST LINE ──────────────────────────────────────────────────────
    BestAffiliateInfo:
      type: object
      properties:
        affiliate_id:
          type: integer
        affiliate_name:
          type: string
        updated_at:
          type: string
          format: date-time

    BestMoneyline:
      type: object
      properties:
        moneyline_home:
          type: number
          nullable: true
        moneyline_away:
          type: number
          nullable: true
        moneyline_draw:
          type: number
          nullable: true
        best_affiliate_home:
          $ref: '#/components/schemas/BestAffiliateInfo'
        best_affiliate_away:
          $ref: '#/components/schemas/BestAffiliateInfo'
        best_affiliate_draw:
          $ref: '#/components/schemas/BestAffiliateInfo'

    BestSpread:
      type: object
      properties:
        point_spread_home:
          type: number
          nullable: true
        point_spread_away:
          type: number
          nullable: true
        point_spread_home_money:
          type: number
          nullable: true
        point_spread_away_money:
          type: number
          nullable: true
        best_affiliate_home:
          $ref: '#/components/schemas/BestAffiliateInfo'
        best_affiliate_away:
          $ref: '#/components/schemas/BestAffiliateInfo'

    BestTotal:
      type: object
      properties:
        total_over:
          type: number
          nullable: true
        total_under:
          type: number
          nullable: true
        total_over_money:
          type: number
          nullable: true
        total_under_money:
          type: number
          nullable: true
        best_affiliate_over:
          $ref: '#/components/schemas/BestAffiliateInfo'
        best_affiliate_under:
          $ref: '#/components/schemas/BestAffiliateInfo'

    BestLineResponse:
      type: object
      properties:
        event_id:
          type: string
        moneyline:
          $ref: '#/components/schemas/BestMoneyline'
        spread:
          $ref: '#/components/schemas/BestSpread'
        total:
          $ref: '#/components/schemas/BestTotal'
        periods:
          type: object
          description: Period-specific best lines keyed by period name
          additionalProperties:
            type: object
            properties:
              moneyline:
                $ref: '#/components/schemas/BestMoneyline'
              spread:
                $ref: '#/components/schemas/BestSpread'
              total:
                $ref: '#/components/schemas/BestTotal'

    # ─── SCHEDULE ───────────────────────────────────────────────────────
    ScheduledEvent:
      type: object
      properties:
        id:
          type: string
          description: Schedule row identifier.
        event_id:
          type: string
        event_uuid:
          type: string
        sport_id:
          type: integer
        season_type:
          type: string
        season_year:
          type: integer
        away_team_id:
          type: integer
          description: Normalized team ID of the away team.
        home_team_id:
          type: integer
          description: Normalized team ID of the home team.
        away_team:
          type: string
        home_team:
          type: string
        date_event:
          type: string
          format: date-time
        neutral_site:
          type: boolean
          nullable: true
        conference_competition:
          type: boolean
          nullable: true
        league_name:
          type: string
          nullable: true
        away_score:
          type: integer
          nullable: true
        home_score:
          type: integer
          nullable: true
        winner_away:
          type: integer
          nullable: true
          description: Same as `winner_away` on the score object.
        winner_home:
          type: integer
          nullable: true
          description: Same as `winner_home` on the score object.
        headline:
          type: string
          description: Event headline, when available. Omitted otherwise.
        event_name:
          type: string
          nullable: true
        game_number:
          type: integer
          enum: [1, 2]
          description: Game number for a true MLB doubleheader. Omitted for ordinary and standalone makeup games.
        game_type:
          type: string
          enum: [doubleheader, makeup, doubleheader_makeup]
          description: Structured MLB doubleheader or makeup classification. Omitted for ordinary games.
        broadcast:
          type: string
          nullable: true
        event_location:
          type: string
          nullable: true
        attendance:
          type: integer
          nullable: true
        pitcher_home:
          $ref: '#/components/schemas/Pitcher'
        pitcher_away:
          $ref: '#/components/schemas/Pitcher'
        updated_at:
          type: string
          format: date-time
          description: Last update time of the event record. Omitted when unknown.
        event_status:
          type: string
          description: Event status, for example `STATUS_SCHEDULED`. Omitted when empty.
        event_status_detail:
          type: string
          description: Human-readable status detail. Omitted when empty.
        away_team_detail:
          $ref: '#/components/schemas/TeamNormalized'
        home_team_detail:
          $ref: '#/components/schemas/TeamNormalized'

    ScheduleResponse:
      type: object
      properties:
        schedules:
          type: array
          items:
            $ref: '#/components/schemas/ScheduledEvent'
