openapi: 3.1.0
info:
  title: LoL Match Analyzer API
  description: >
    API for analyzing League of Legends games, including latest match data, timeline data, and live game state. All endpoints are described in this schema and can be used as appropriate based on user request.

  version: 1.1.2
servers:
  - url: https://top-frequently-sawfly.ngrok-free.app
paths:
  /riot/match/latest:
    get:
      operationId: getLatestMatch
      summary: Get most recent match
      description: Fetches the latest match data for the user.
      parameters:
        - name: previousMatchId
          in: query
          required: false
          schema:
            type: string
      responses:
        '200':
          description: Latest match information including metadata and participant stats
          content:
            application/json:
              schema:
                type: object
                properties: {}
                additionalProperties: true
  /riot/timeline/chunks/{match_id}:
    get:
      operationId: getMatchTimelineChunks
      summary: Get filtered timeline chunk data
      parameters:
      - name: match_id
        in: path
        required: true
        schema:
          type: string
          description: Unique identifier (matchId) for the match to retrieve timeline data for provided by getLatestMatch operation, unless specified otherwise.
      - name: chunk
        in: query
        required: false
        schema:
          type: integer
          default: 0
          minimum: 0
        description: Index of the timeline chunk to retrieve. Defaults to 0 if not provided.
      - name: includeKills
        in: query
        required: false
        schema:
          type: boolean
          default: true
        description: Whether to include champion kill events.
      - name: includeObjectives
        in: query
        required: false
        schema:
          type: boolean
          default: true
        description: Whether to include objective events like towers, dragons.
      - name: includeItems
        in: query
        required: false
        schema:
          type: boolean
          default: false
        description: Whether to include item purchase/sell events.
      responses:
        '200':
          description: Filtered timeline chunk data
          content:
            application/json:
              schema:
                type: object
                properties: {}
                additionalProperties: true
  /riot/livegame:
    get:
      operationId: getLiveGameStats
      summary: Get current live game stats
      description: |
        Returns live game state for the current match. Data is sourced from the League Client's Live Client Data API via the local Flask proxy. Available only while the user is actively in a game.
      parameters:
        - name: request_id
          in: query
          required: true
          schema:
            type: string
          description: Arbitrary request identifier to ensure endpoint is called. You can pass any string here.
      responses:
        '200':
          description: Live game stats response
          content:
            application/json:
              schema:
                type: object
                properties: {}
                additionalProperties: true
        '503':
          description: Not in game or Riot Live Client Data API unavailable
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
              example:
                error: Not in game or Riot Live Client Data API unavailable