Overview
The Match endpoints provide access to player match history and detailed match statistics. These endpoints interact with the Riot Games Match-v5 API to retrieve game data, participant information, and optional AI-generated analysis.Get Match IDs
Retrieves a list of match IDs for a given player PUUID. This endpoint returns an array of match identifiers that can be used to fetch detailed match data.Authentication
Requires valid NextAuth session. Only allows querying the authenticated user’s own PUUID.Query Parameters
Player’s PUUID to retrieve matches for. Defaults to current user’s PUUID if not provided.
Response
Returns an array of match ID strings from the Riot API endpoint:https://americas.api.riotgames.com/lol/match/v5/matches/by-puuid/{puuid}/ids
Array of match IDs in format
NA1_1234567890Example
Get Match Details
Retrieves detailed match information for a specific match ID, including participant data, team statistics, and optional AI-generated match context analysis.Authentication
Requires valid NextAuth session.Query Parameters
Match identifier to retrieve details for (e.g.,
NA1_4873621950)Response
Returns the full Match-v5 data from Riot API:https://americas.api.riotgames.com/lol/match/v5/matches/{matchId}
When AI features are enabled (ENABLE_MATCH_AGENT=true), the response includes an additional analysis field.
Match metadata including match ID, data version, and participant PUUIDs
Detailed match information including game mode, duration, teams, and participants
Array of participant objects with detailed player statistics
AI-generated match analysis (only when
ENABLE_MATCH_AGENT=true and OPENAI_KEY is configured)Match Data Structure
Each participant ininfo.participants contains:
puuid: Player’s unique identifierchampionName: Champion playedkills,deaths,assists: KDA statisticstotalMinionsKilled,neutralMinionsKilled: CS statisticsgoldEarned,totalDamageDealt: Economic and damage metricswin: Boolean indicating victoryteamId: Team number (100 or 200)teamPosition,individualPosition: Lane/role informationitems0-items6: Item buildsummoner1Id,summoner2Id: Summoner spells- And many more detailed statistics
Example
AI Match Context
When AI features are enabled, the/api/riot/match/matchId endpoint uses OpenAI GPT-5.1 to generate a contextual summary of the match:
Enable AI Features
Set environment variables:
ENABLE_MATCH_AGENT=trueOPENAI_KEY=your-openai-api-key
The AI context is generated server-side and focuses on match-level analysis, not individual player coaching. For player-specific coaching, see the Timeline Compare endpoint.
Typical Workflow
- Get match IDs from
/api/riot/match/by-puuid/ids - Iterate through match IDs to fetch detailed data
- Parse participant data to find specific player statistics
- Display match results with optional AI context
- Use match data to feed timeline analysis endpoints
