Skip to main content
GET
/
api
/
historial
/
:nombre
/
:tag
Get Match History
curl --request GET \
  --url https://api.example.com/api/historial/:nombre/:tag
{
  "duracion": "<string>",
  "cola": "<string>",
  "campeon": "<string>",
  "estado": true,
  "k": 123,
  "d": 123,
  "a": 123,
  "killsRed": 123,
  "deathRed": 123,
  "assistsRed": 123,
  "killsBlue": 123,
  "deathsBlue": 123,
  "assistsBlue": 123,
  "jugadoresPartida": [
    {
      "nombre": "<string>",
      "tag": "<string>",
      "equipo": 123,
      "campeon": "<string>",
      "estado": true,
      "k": 123,
      "d": 123,
      "a": 123,
      "items": [
        {}
      ]
    }
  ]
}

Endpoint

GET /api/historial/:nombre/:tag
Retrieves detailed match history for a player, including game duration, queue type, champion played, KDA, and full participant information for all players in each match.

Path Parameters

nombre
string
required
The player’s Riot ID name (game name without the tag)Example: Faker for player “Faker#KR1”
tag
string
required
The player’s Riot ID tagline (without the # symbol)Example: KR1 for player “Faker#KR1”

Query Parameters

inicio
number
default:"0"
The starting index for pagination (0-based). Determines which match to start from in the history.Example: inicio=0 starts from the most recent match
cantidad
number
default:"10"
The number of matches to retrieve. Maximum determined by Riot API limits.Example: cantidad=5 returns 5 matches

Implementation Details

The endpoint performs the following operations (index.js:71-206):
  1. Account Lookup (index.js:76-83): Retrieves PUUID from Riot ID
  2. Match ID List (index.js:89-96): Fetches match IDs with pagination
  3. Match Details (index.js:102-107): For each match ID, retrieves complete match data
  4. Data Processing (index.js:109-196):
    • Formats match duration from seconds to MM:SS
    • Translates queue IDs to readable names
    • Extracts player statistics and item builds
    • Calculates team totals (kills, deaths, assists) for both teams

Queue Type Dictionary

The endpoint translates queue IDs to readable names (index.js:116-123):
const diccionarioColas = {
   420: "Clasificatoria Solo/Dúo",
   400: "Normal Reclutamiento",
   430: "Normal Selección Oculta",
   440: "Clasificatoria Flexible",
   450: "ARAM",
   700: "Clash"
}
Unknown queue types return "Otro Modo".

Team ID System

  • Team Blue: teamId = 100
  • Team Red: teamId = 200

Response

Returns an array of match objects, ordered from most recent to oldest.
duracion
string
Match duration in MM:SS format.Example: "28:45" for a 28 minute, 45 second game
cola
string
Translated queue name. See queue dictionary above.Examples: "Clasificatoria Solo/Dúo", "ARAM", "Otro Modo"
campeon
string
Champion name played by the requested player.Example: "Ahri"
estado
boolean
Whether the requested player won the match.true = Victory, false = Defeat
k
number
Kills by the requested player.
d
number
Deaths by the requested player.
a
number
Assists by the requested player.
killsRed
number
Total kills by the Red team (teamId 200).
deathRed
number
Total deaths by the Red team (teamId 200).
assistsRed
number
Total assists by the Red team (teamId 200).
killsBlue
number
Total kills by the Blue team (teamId 100).
deathsBlue
number
Total deaths by the Blue team (teamId 100).
assistsBlue
number
Total assists by the Blue team (teamId 100).
jugadoresPartida
array
Array containing detailed information for all 10 players in the match.

Examples

Request - Default Pagination

curl http://localhost:3000/api/historial/Faker/KR1
Retrieves the 10 most recent matches (default behavior).

Request - Custom Pagination

curl "http://localhost:3000/api/historial/Faker/KR1?inicio=5&cantidad=3"
Retrieves 3 matches starting from the 6th most recent match.

Request - First 20 Matches

curl "http://localhost:3000/api/historial/Faker/KR1?inicio=0&cantidad=20"

Response Example

[
  {
    "duracion": "28:45",
    "cola": "Clasificatoria Solo/Dúo",
    "campeon": "Ahri",
    "estado": true,
    "k": 12,
    "d": 3,
    "a": 8,
    "killsRed": 15,
    "deathRed": 32,
    "assistsRed": 28,
    "killsBlue": 32,
    "deathsBlue": 15,
    "assistsBlue": 65,
    "jugadoresPartida": [
      {
        "nombre": "Faker",
        "tag": "KR1",
        "equipo": 100,
        "campeon": "Ahri",
        "estado": true,
        "k": 12,
        "d": 3,
        "a": 8,
        "items": [3089, 3020, 3165, 3135, 3157, 0, 3340]
      },
      {
        "nombre": "Player2",
        "tag": "KR1",
        "equipo": 100,
        "campeon": "Lee Sin",
        "estado": true,
        "k": 8,
        "d": 4,
        "a": 15,
        "items": [6630, 3047, 3742, 3071, 3156, 3026, 3340]
      },
      {
        "nombre": "Player3",
        "tag": "NA1",
        "equipo": 200,
        "campeon": "Yasuo",
        "estado": false,
        "k": 5,
        "d": 8,
        "a": 6,
        "items": [6673, 3006, 3031, 3033, 0, 0, 3340]
      }
      // ... 7 more players
    ]
  },
  {
    "duracion": "22:13",
    "cola": "ARAM",
    "campeon": "Zed",
    "estado": false,
    "k": 15,
    "d": 12,
    "a": 9,
    "killsRed": 45,
    "deathRed": 38,
    "assistsRed": 92,
    "killsBlue": 38,
    "deathsBlue": 45,
    "assistsBlue": 78,
    "jugadoresPartida": [
      // ... 10 players
    ]
  }
  // ... more matches based on 'cantidad' parameter
]

Error Responses

Player Not Found / API Error

Status Code: 500
{
  "error": "Hubo un problema al buscar al jugador."
}
Common causes:
  • Invalid Riot ID (nombre/tag combination doesn’t exist)
  • Riot API is down or rate limited
  • Invalid API key
  • Network connectivity issues
  • Match data unavailable

Pagination Examples

Retrieving All Matches (in batches)

# First 20 matches
curl "http://localhost:3000/api/historial/Faker/KR1?inicio=0&cantidad=20"

# Next 20 matches
curl "http://localhost:3000/api/historial/Faker/KR1?inicio=20&cantidad=20"

# Next 20 matches
curl "http://localhost:3000/api/historial/Faker/KR1?inicio=40&cantidad=20"

Retrieving Recent Matches Only

# 5 most recent matches
curl "http://localhost:3000/api/historial/Faker/KR1?inicio=0&cantidad=5"

Code Reference

The complete implementation can be found in index.js:71-206.

Notes

Performance Consideration: Each match requires a separate API call to Riot Games. Requesting a large number of matches (high cantidad value) will increase response time proportionally.
Item IDs: The items array contains Riot item IDs. To display item images, use the Data Dragon URL:
https://ddragon.leagueoflegends.com/cdn/{version}/img/item/{itemId}.png
An item ID of 0 means the slot is empty.
Team Totals Calculation: The killsRed, deathRed, assistsRed, killsBlue, deathsBlue, and assistsBlue fields are calculated by summing individual player statistics from the jugadoresPartida array (see index.js:164-176).
Match Duration Format: Duration is converted from seconds to MM:SS format. Seconds are zero-padded to always show two digits (e.g., "5:03" not "5:3").

Build docs developers (and LLMs) love