Overview
The Timeline endpoints provide granular, frame-by-frame data for match analysis. Each frame represents one minute of game time and includes detailed statistics for all participants. The AI comparison endpoint offers personalized coaching insights by analyzing early-game performance against lane opponents.Understanding Timeline Frames
Timeline data is structured as a series of frames, where each frame represents a snapshot at a specific minute:- Frame 0: Game start (0:00)
- Frame 1: First minute (1:00)
- Frame N: Nth minute of the game
- Frame interval: 60,000 milliseconds (1 minute)
participantFrames: Stats for all 10 playersevents: Game events (kills, objectives, item purchases)timestamp: Milliseconds since game start
Get Timeline
Retrieves the complete frame-by-frame timeline for a specific match, including all participant statistics and game events.Authentication
Requires valid NextAuth session.Query Parameters
Match identifier to retrieve timeline for (e.g.,
NA1_4873621950)Response
Returns the full Match Timeline-v5 data from Riot API:https://americas.api.riotgames.com/lol/match/v5/matches/{matchId}/timeline
Timeline metadata including match ID and data version
Timeline information containing frames and game length
Frame Structure
Each frame ininfo.frames contains:
Object keyed by participant ID (“1” through “10”) with stats:
participantId: Player number (1-10)level: Champion levelcurrentGold,totalGold: Gold statisticsxp: Experience pointsminionsKilled,jungleMinionsKilled: CS countsposition: coordinates on mapchampionStats: Detailed combat stats
Array of game events that occurred in this frame:
CHAMPION_KILL: Champion deathsBUILDING_KILL: Tower/inhibitor destructionELITE_MONSTER_KILL: Dragon/Baron/HeraldITEM_PURCHASED,ITEM_SOLD: Item transactionsWARD_PLACED,WARD_KILL: Vision controlSKILL_LEVEL_UP: Ability upgrades
Milliseconds since game start for this frame
Example
Timeline Compare
Compares the authenticated player’s early-game performance against their lane opponent using AI coaching. This endpoint analyzes minute-by-minute progression data and provides personalized feedback on farming, gold generation, and experience gain.Authentication
Requires valid NextAuth session.Query Parameters
Match identifier to analyze (e.g.,
NA1_4873621950)Player’s Riot ID game name. Defaults to authenticated user’s game name.
Player’s Riot ID tag line. Defaults to authenticated user’s tag line.
Configuration
The comparison timeframe is controlled by theTIMELINE_COMPARE environment variable:
Milliseconds from game start to analyze. Converts to frame index (e.g., 600000ms = 10 minutes = frame 10)
How It Works
Player Identification
Finds the specified player in match participants by matching
gameName and tagLineLane Opponent Detection
Identifies the enemy player in the same role/position using
teamPosition or individualPositionFrame Collection
Collects minute-by-minute statistics from frame 0 to the configured comparison timeframe
Response
Player’s lane/position (e.g., “BOTTOM”, “MIDDLE”, “TOP”, “JUNGLE”, “UTILITY”)
The minute (frame index) used for comparison
Champion played by the queried player
Champion played by the lane opponent
Player’s statistics at the comparison frame, including:
level: Champion levelcurrentGold,totalGold: Gold statsxp: Experience pointsminionsKilled,jungleMinionsKilled: CS countsposition: Map coordinates
Enemy player’s statistics at the comparison frame (same structure as userFrame)
AI-generated coaching feedback in Spanish (4-6 sentences) analyzing:
- Who gained advantages and when
- CS, gold, and XP progression trends
- Moments where one player improved or fell behind
- Actionable advice for improvement
ENABLE_MATCH_AGENT=true and OPENAI_KEY is configuredExample
AI Coaching Features
The Timeline Compare endpoint provides the most detailed AI coaching in Agent LoL:Analysis Scope
- Minute-by-minute progression: Analyzes entire early game, not just final stats
- Trend identification: Detects when advantages were gained or lost
- Role-specific: Compares only against the direct lane opponent
- Actionable feedback: Provides specific improvement suggestions
AI Model Configuration
- Model: OpenAI GPT-4o-mini
- Temperature: 0.4 (balanced between creativity and consistency)
- Language: Spanish (as configured in system prompt)
- Response length: 4-6 sentences
Coaching Focus Areas
- CS Efficiency: Minion kills and jungle camp farming
- Gold Generation: Total and current gold comparison
- Experience Gain: XP and level progression
- Timing Analysis: When advantages/disadvantages occurred
- Improvement Strategy: Specific actionable recommendations
The AI analysis requires both
ENABLE_MATCH_AGENT=true and a valid OPENAI_KEY. If either is missing, the endpoint still returns statistical comparison without the comparison field.Use Cases
Laning Analysis
Compare early-game performance to identify laning phase strengths and weaknesses
CS Training
Track farming efficiency over time against opponents
Coaching Tools
Provide automated coaching feedback for players looking to improve
Performance Tracking
Monitor progression metrics across multiple games
Best Practices
- Use with recent matches: Timeline data is most useful for analyzing recent games while they’re fresh in memory
- Configure comparison timeframe: Adjust
TIMELINE_COMPAREbased on analysis needs (early game: 600000ms = 10 min) - Combine with match details: Use alongside
/api/riot/match/matchIdfor complete context - Handle missing opponents: Not all games have clear lane opponents (especially in non-standard game modes)
- Cache AI results: AI analysis is expensive; consider caching comparison results client-side
