Prerequisites
Before you begin, make sure you have:- Node.js (v14 or higher) installed on your machine
- npm package manager
- A Riot Games Developer API Key (we’ll show you how to get one)
Setup Process
Install Dependencies
Install all required npm packages:This will install:
- express (v5.2.1) - Web server framework
- axios (v1.13.5) - HTTP client for Riot API requests
- cors (v2.8.6) - Enable cross-origin requests
- dotenv (v17.3.1) - Environment variable management
Get Your Riot API Key
To access Riot Games data, you need a developer API key:
- Visit developer.riotgames.com
- Sign in with your Riot Games account
- Navigate to your dashboard
- Copy your Development API Key
Configure Environment Variables
Create a Add your Riot API key to the
.env file in the root directory of the project:.env file:.env
The
.env file is gitignored by default to keep your API key secure. Never commit this file to version control.Making Your First API Calls
Now that your server is running, let’s test the two main endpoints with real API calls.Get Player Information
Retrieve a player’s rank, level, and profile information:Get Match History
Retrieve a player’s recent match history with pagination:| Parameter | Type | Default | Description |
|---|---|---|---|
inicio | number | 0 | Starting index for pagination |
cantidad | number | 10 | Number of matches to retrieve |
Response Field Reference
Player Endpoint (/api/jugador/:nombre/:tag)
| Field | Type | Description |
|---|---|---|
userTier | string | Rank tier (IRON, BRONZE, SILVER, GOLD, PLATINUM, DIAMOND, MASTER, GRANDMASTER, CHALLENGER, or UNRANKED) |
userRank | string | Division within tier (I, II, III, IV) - empty for UNRANKED |
userLps | number | League Points (LP) in current division |
userWins | number | Total ranked wins in current season |
userLosses | number | Total ranked losses in current season |
userLevel | number | Summoner level |
userPic | number | Profile icon ID |
userId | string | Player’s unique PUUID |
Match History Endpoint (/api/historial/:nombre/:tag)
| Field | Type | Description |
|---|---|---|
duracion | string | Match duration in MM:SS format |
cola | string | Queue type (e.g., “Clasificatoria Solo/Dúo”, “ARAM”) |
campeon | string | Champion played by the queried player |
estado | boolean | Whether the queried player won (true) or lost (false) |
k | number | Kills by the queried player |
d | number | Deaths by the queried player |
a | number | Assists by the queried player |
jugadoresPartida | array | Array of all 10 players in the match |
killsRed | number | Total kills by red team |
deathRed | number | Total deaths by red team |
assistsRed | number | Total assists by red team |
killsBlue | number | Total kills by blue team |
deathsBlue | number | Total deaths by blue team |
assistsBlue | number | Total assists by blue team |
Supported Queue Types
The API translates Riot’s queue IDs to human-readable names:| Queue ID | Display Name |
|---|---|
| 420 | Clasificatoria Solo/Dúo |
| 400 | Normal Reclutamiento |
| 430 | Normal Selección Oculta |
| 440 | Clasificatoria Flexible |
| 450 | ARAM |
| 700 | Clash |
| Other | Otro Modo |
Troubleshooting
Error: 403 Forbidden from Riot API
Error: 403 Forbidden from Riot API
This usually means your API key is invalid or expired. Development API keys expire after 24 hours.Solution: Get a fresh API key from developer.riotgames.com and update your
.env file.Error: 404 Player Not Found
Error: 404 Player Not Found
The player name and tag combination doesn’t exist.Solution: Verify the exact spelling and tag. Riot IDs are case-sensitive for the game name but tags are always uppercase.
Error: 429 Rate Limit Exceeded
Error: 429 Rate Limit Exceeded
You’ve made too many requests. Development API keys have strict rate limits:
- 20 requests per second
- 100 requests per 2 minutes
Server won't start / Port 3000 in use
Server won't start / Port 3000 in use
Another application is using port 3000.Solution: Either stop the other application or change the port in
index.js by modifying the PORT constant (line 7).Next Steps
API Overview
Explore detailed documentation for all endpoints
Configuration Guide
Learn about server configuration and environment variables
Authentication
Set up and manage your Riot API key
Rate Limits
Handle Riot API rate limits effectively