lol-riot-api
A wrapper module for League of Legends' official API. In the documentation below there will be references to the official methods used for each method.
All methods can be either used with a callback
method or as a promise
Download
lol-riot-api is installable via:
- GitHub
git clone https://github.com/Pupix/lol-riot-api-module.git
- npm:
npm install lol-riot-api-module
Quick example
const API = ;const api = key: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' region: 'euw' ;
Using callbacks
const options = name: 'Pupix' ; api; //=> { "id": 20920441 "name": "Pupix" "profileIconId": 580 "summonerLevel": 30 "revisionDate": 1431200284000 }
Using promises
const options = name: 'Pupix' ; api; //=> { "id": 20920441 "name": 'Pupix' "profileIconId": 580 "summonerLevel": 30 "revisionDate": 1431200284000 }
Getting started
The API constructor accepts an object with the default key
and region
to be used for the API calls. You can get a key from Riot Games' developer portal.
If no region is passed, the API will default to na (North America).
The possible regions are the following:
- br (Brazil)
- eune (Europe North-East)
- euw (Europe West)
- jp (Japan)
- kr (Korean)
- lan (Latin America North)
- las (Latin America South)
- na (North America)
- oce (Oceania)
- ru (Russia)
- tr (Turkish)
- pbe (Public Beta Environment)
Documentation
Whenever possible, if a configuration object (referred as options
in the documentation) is not required the callback
can be passed directly as first parameter to all methods.
Methods
Account
Champions
Featured games
Leagues
Matches
Static data
- getChampionsStaticData
- getItemsStaticData
- getLanguagesStaticData
- getLanguageStringsStaticData
- getMapsStaticData
- getMasteriesStaticData
- getProfileIconsStaticData
- getRealmsStaticData
- getRunesStaticData
- getSummonerSpellsStaticData
- getVersionsStaticData
Status
Summoner
- getSummoner
- getSummonerActiveGame
- getSummonerChampionMastery
- getSummonerChampionMasteryScore
- getSummonerLeagues
- getSummonerLeaguePositions
- getSummonerMasteries
- getSummonerRunes
getAccountMatchlist(options, callback)
Get matchlist for ranked games played on given account ID and platform ID and filtered using given filter parameters, if any.
Parameters
- options {Object}
- options.accountId {number | string} The account ID.
- [options.beginIndex] {number | string} The begin index to use for filtering matchlist.
- [options.beginTime] {number | string} The begin time to use for filtering matchlist specified as epoch milliseconds.
- [options.champion] {Array | number | string} Set of champion IDs for which to filtering matchlist.
- [options.endIndex] {number | string} The end index to use for filtering matchlist.
- [options.endTime] {number | string} The end time to use for filtering matchlist specified as epoch milliseconds.
- [options.season] {Array | number | string} Set of season IDs for which to filtering matchlist.
- [options.queue] {Array | number | string} Set of queue IDs for which to filtering matchlist.
- [options.region] {string} Optional region to be used instead of the API's region to retrieve data.
- [options.apiKey] {string} Optional key to be used instead of the API's key to retrieve data.
- [callback] {Function} Optional function to be called after the server's response is received, with
(error, data)
as parameters.
getAccountRecentMatchlist(options, callback)
Get matchlist for last 20 matches played on given account ID.
Parameters
- options {Object}
- options.accountId {number | string} The account ID.
- [options.region] {string} Optional region to be used instead of the API's region to retrieve data.
- [options.apiKey] {string} Optional key to be used instead of the API's key to retrieve data.
- [callback] {Function} Optional function to be called after the server's response is received, with
(error, data)
as parameters.
getChampionsStatus(options, callback)
Gets the status of champions.
Parameters
- options {Object}
- [options.id] {boolean} Optional parameter to retrieve only a specific champion.
- [options.freeToPlay] {boolean} Optional filter to retrieve only free to play champions.
- [options.region] {string} Optional region to be used instead of the API's region to retrieve data.
- [options.apiKey] {string} Optional key to be used instead of the API's key to retrieve data.
- [callback] {Function} Optional function to be called after the server's response is received, with
(error, data)
as parameters.
getFeaturedGames(options, callback)
Get list of featured games.
Parameters
- options {Object}
- [options.region] {string} Optional region to be used instead of the API's region to retrieve data.
- [options.apiKey] {string} Optional key to be used instead of the API's key to retrieve data.
- [callback] {Function} Optional function to be called after the server's response is received, with
(error, data)
as parameters.
getChallengerLeague(options, callback)
Get the challenger league for a given queue.
Parameters
- options {Object}
- [options.queue = "RANKED_SOLO_5x5"] {string} Game queue type.
- Possible values: "RANKED_SOLO_5x5" | "RANKED_FLEX_SR" | "RANKED_FLEX_TT"
- [options.region] {string} Optional region to be used instead of the API's region to retrieve data.
- [options.apiKey] {string} Optional key to be used instead of the API's key to retrieve data.
- [callback] {Function} Optional function to be called after the server's response is received, with
(error, data)
as parameters.
getMasterLeague(options, callback)
Get the master league for a given queue.
Parameters
- options {Object}
- [options.queue = "RANKED_SOLO_5x5"] {string} Game queue type.
- Possible values: "RANKED_SOLO_5x5" | "RANKED_FLEX_SR" | "RANKED_FLEX_TT"
- [options.region] {string} Optional region to be used instead of the API's region to retrieve data.
- [options.apiKey] {string} Optional key to be used instead of the API's key to retrieve data.
- [callback] {Function} Optional function to be called after the server's response is received, with
(error, data)
as parameters.
getMatch(options, callback)
Get match by match ID.
Parameters
- options {Object}
- options.id {number | string} The match ID.
- [options.region] {string} Optional region to be used instead of the API's region to retrieve data.
- [options.apiKey] {string} Optional key to be used instead of the API's key to retrieve data.
- [callback] {Function} Optional function to be called after the server's response is received, with
(error, data)
as parameters.
getMatchTimeline(options, callback)
Get match by match ID.
Parameters
- options {Object}
- options.matchId {number | string} The match ID.
- [options.region] {string} Optional region to be used instead of the API's region to retrieve data.
- [options.apiKey] {string} Optional key to be used instead of the API's key to retrieve data.
- [callback] {Function} Optional function to be called after the server's response is received, with
(error, data)
as parameters.
getChampionsStaticData(options, callback)
Gets static data of champions.
Parameters
- [options] {Object}
- [options.id] {number | string} Champion ID to retrieve.
- [options.locale] {string} Locale code for returned data (e.g., en_US, es_ES). If not specified, the default locale for the region is used.
- [options.version] {string} Data dragon version for returned data. If not specified, the latest version for the region is used. List of valid versions can be obtained from the /versions endpoint.
- [options.dataById] {boolean} If specified, the returned data map will use the champions' Id as the keys. If not specified or specified as false, the returned data map will use the champions' keys instead.
- [options.champData] {Array | string} Tags to return additional data. Only id, key, name, and title are returned by default if this parameter isn't specified. To return all additional data, use the tag 'all'.
- Possible values: "all" | "allytips" | "altimages" | "blurb" | "enemytips" | "image" | "info" | "lore" | "partype" | "passive" | "recommended" | "skins" | "spells" | "stats" | "tags"
- [options.region] {string} Optional region to be used instead of the API's region to retrieve data.
- [options.apiKey] {string} Optional key to be used instead of the API's key to retrieve data.
- [callback] {Function} Optional function to be called after the server's response is received, with
(error, data)
as parameters.
getItemsStaticData(options, callback)
Gets static data of items.
Parameters
- [options] {Object}
- [options.id] {number | string} Item ID to retrieve.
- [options.locale] {string} Locale code for returned data (e.g., en_US, es_ES). If not specified, the default locale for the region is used.
- [options.version] {string} Data dragon version for returned data. If not specified, the latest version for the region is used. List of valid versions can be obtained from the /versions endpoint.
- [options.itemData] {Array | string} Tags to return additional data. Only id, name, plaintext, group, and description are returned by default if this parameter isn't specified. To return all additional data, use the tag 'all'.
- Possible values: "all" | "colloq" | "consumeOnFull" | "consumed" | "depth" | "effect" | "from" | "gold" | "hideFromAll" | "image" | "inStore" | "into" | "maps" | "requiredChampion" | "sanitizedDescription" | "specialRecipe" | "stacks" | "stats" | "tags"
- [options.region] {string} Optional region to be used instead of the API's region to retrieve data.
- [options.apiKey] {string} Optional key to be used instead of the API's key to retrieve data.
- [callback] {Function} Optional function to be called after the server's response is received, with
(error, data)
as parameters.
getLanguageStringsStaticData(options, callback)
Gets static data of items.
Parameters
- [options] {Object}
- [options.locale] {string} Locale code for returned data (e.g., en_US, es_ES). If not specified, the default locale for the region is used.
- [options.version] {string} Data dragon version for returned data. If not specified, the latest version for the region is used. List of valid versions can be obtained from the /versions endpoint.
- [options.region] {string} Optional region to be used instead of the API's region to retrieve data.
- [options.apiKey] {string} Optional key to be used instead of the API's key to retrieve data.
- [callback] {Function} Optional function to be called after the server's response is received, with
(error, data)
as parameters.
getLanguagesStaticData(options, callback)
Gets the list of languages.
Parameters
- [options] {Object}
- [options.locale] {string} Locale code for returned data (e.g., en_US, es_ES). If not specified, the default locale for the region is used.
- [options.version] {string} Data dragon version for returned data. If not specified, the latest version for the region is used. List of valid versions can be obtained from the /versions endpoint.
- [options.region] {string} Optional region to be used instead of the API's region to retrieve data.
- [options.apiKey] {string} Optional key to be used instead of the API's key to retrieve data.
- [callback] {Function} Optional function to be called after the server's response is received, with
(error, data)
as parameters.
getMapsStaticData(options, callback)
Gets the list of maps.
Parameters
- [options] {Object}
- [options.locale] {string} Locale code for returned data (e.g., en_US, es_ES). If not specified, the default locale for the region is used.
- [options.version] {string} Data dragon version for returned data. If not specified, the latest version for the region is used. List of valid versions can be obtained from the /versions endpoint.
- [options.region] {string} Optional region to be used instead of the API's region to retrieve data.
- [options.apiKey] {string} Optional key to be used instead of the API's key to retrieve data.
- [callback] {Function} Optional function to be called after the server's response is received, with
(error, data)
as parameters.
getMasteriesStaticData(options, callback)
Gets static data of masteries.
Parameters
- [options] {Object}
- [options.id] {number | string} Mastery ID to retrieve.
- [options.locale] {string} Locale code for returned data (e.g., en_US, es_ES). If not specified, the default locale for the region is used.
- [options.version] {string} Data dragon version for returned data. If not specified, the latest version for the region is used. List of valid versions can be obtained from the /versions endpoint.
- [options.masteryData] {Array | string} Tags to return additional data. Only id, name, and description are returned by default if this parameter isn't specified. To return all additional data, use the tag 'all'.
- Possible values: "all" | "image" | "masteryTree" | "prereq" | "ranks" | "sanitizeDescription"
- [options.region] {string} Optional region to be used instead of the API's region to retrieve data.
- [options.apiKey] {string} Optional key to be used instead of the API's key to retrieve data.
- [callback] {Function} Optional function to be called after the server's response is received, with
(error, data)
as parameters.
getProfileIconsStaticData(options, callback)
Gets the list of profile icons.
Parameters
- [options] {Object}
- [options.locale] {string} Locale code for returned data (e.g., en_US, es_ES). If not specified, the default locale for the region is used.
- [options.version] {string} Data dragon version for returned data. If not specified, the latest version for the region is used. List of valid versions can be obtained from the /versions endpoint.
- [options.region] {string} Optional region to be used instead of the API's region to retrieve data.
- [options.apiKey] {string} Optional key to be used instead of the API's key to retrieve data.
- [callback] {Function} Optional function to be called after the server's response is received, with
(error, data)
as parameters.
getRealmsStaticData(options, callback)
Gets the list of realms.
Parameters
- [options] {Object}
- [options.locale] {string} Locale code for returned data (e.g., en_US, es_ES). If not specified, the default locale for the region is used.
- [options.version] {string} Data dragon version for returned data. If not specified, the latest version for the region is used. List of valid versions can be obtained from the /versions endpoint.
- [options.region] {string} Optional region to be used instead of the API's region to retrieve data.
- [options.apiKey] {string} Optional key to be used instead of the API's key to retrieve data.
- [callback] {Function} Optional function to be called after the server's response is received, with
(error, data)
as parameters.
getRunesStaticData(options, callback)
Gets static data of ruunes.
Parameters
- [options] {Object}
- [options.id] {number | string} Mastery ID to retrieve.
- [options.locale] {string} Locale code for returned data (e.g., en_US, es_ES). If not specified, the default locale for the region is used.
- [options.version] {string} Data dragon version for returned data. If not specified, the latest version for the region is used. List of valid versions can be obtained from the /versions endpoint.
- [options.runeData] {Array | string} Tags to return additional data. Only id, name, rune, and description are returned by default if this parameter isn't specified. To return all additional data, use the tag 'all'.
- Possible values: "all" | "colloq" | "consumeOnFull" | "consumed" | "depth" | "from" | "gold" | "hideFromAll" | "image" | "inStore" | "into" | "maps" | "requiredChampion" | "sanitizedDescription" | "specialRecipe" | "stacks" | "stats" | "tags"
- [options.region] {string} Optional region to be used instead of the API's region to retrieve data.
- [options.apiKey] {string} Optional key to be used instead of the API's key to retrieve data.
- [callback] {Function} Optional function to be called after the server's response is received, with
(error, data)
as parameters.
getSummonerSpellsStaticData(options, callback)
Gets static data of champions.
Parameters
- [options] {Object}
- [options.id] {number | string} SummonerSpell ID to retrieve.
- [options.locale] {string} Locale code for returned data (e.g., en_US, es_ES). If not specified, the default locale for the region is used.
- [options.version] {string} Data dragon version for returned data. If not specified, the latest version for the region is used. List of valid versions can be obtained from the /versions endpoint.
- [options.dataById] {boolean} If specified, the returned data map will use the champions' Id as the keys. If not specified or specified as false, the returned data map will use the champions' keys instead.
- [options.spellData] {Array | string} Tags to return additional data. Only type, version, data, id, key, name, description, and summonerLevel are returned by default if this parameter isn't specified. To return all additional data, use the tag 'all'.
- Possible values: "all" | "cooldown" | "cooldownBurn" | "cost" | "costBurn" | "costType" | "effect" | "effectBurn" | "image" | "key" | "leveltip" | "maxrank" | "modes" | "range" | "rangeBurn" | "resource" | "sanitizedDescription" | "sanitizedTooltip" | "tooltip" | "vars"
- [options.region] {string} Optional region to be used instead of the API's region to retrieve data.
- [options.apiKey] {string} Optional key to be used instead of the API's key to retrieve data.
- [callback] {Function} Optional function to be called after the server's response is received, with
(error, data)
as parameters.
getVersionsStaticData(options, callback)
Gets the list of realms.
Parameters
- [options] {Object}
- [options.region] {string} Optional region to be used instead of the API's region to retrieve data.
- [options.apiKey] {string} Optional key to be used instead of the API's key to retrieve data.
- [callback] {Function} Optional function to be called after the server's response is received, with
(error, data)
as parameters.
getStatus(options, callback)
Get League of Legends status.
Parameters
- options {Object}
- [options.region] {string} Optional region to be used instead of the API's region to retrieve data.
- [options.apiKey] {string} Optional key to be used instead of the API's key to retrieve data.
- [callback] {Function} Optional function to be called after the server's response is received, with
(error, data)
as parameters.
getSummoner(options, callback)
Gets summoner based on id, accountId or name.
Parameters
- options {Object}
- [options.id] {number | string} The ID of the summoner.
- [options.summonerId] {number | string} The ID of the summoner.
- [options.accountId] {number | string} The account ID of the summoner.
- [options.name] {string} The name of the summoner.
- [options.region] {string} Optional region to be used instead of the API's region to retrieve data.
- [options.apiKey] {string} Optional key to be used instead of the API's key to retrieve data.
- [callback] {Function} Optional function to be called after the server's response is received, with
(error, data)
as parameters.
getSummonerActiveGame(options, callback)
Get current game information for the given summoner ID.
Parameters
- options {Object}
- options.summonerId {number | string} The ID of the summoner.
- [options.region] {string} Optional region to be used instead of the API's region to retrieve data.
- [options.apiKey] {string} Optional key to be used instead of the API's key to retrieve data.
- [callback] {Function} Optional function to be called after the server's response is received, with
(error, data)
as parameters.
getSummonerChampionMastery(options, callback)
Get champion mastery entries sorted by number of champion points descending.
Parameters
- options {Object}
- options.summonerId {number | string} Summoner ID associated with the player.
- [options.championId] {number | string} Champion ID to retrieve Champion Mastery for.
- [options.region] {string} Optional region to be used instead of the API's region to retrieve data.
- [options.apiKey] {string} Optional key to be used instead of the API's key to retrieve data.
- [callback] {Function} Optional function to be called after the server's response is received, with
(error, data)
as parameters.
getSummonerChampionMasteryScore(options, callback)
Get a player's total champion mastery score, which is the sum of individual champion mastery levels.
Parameters
- options {Object}
- options.summonerId {number | string} Summoner ID associated with the player.
- [options.region] {string} Optional region to be used instead of the API's region to retrieve data.
- [options.apiKey] {string} Optional key to be used instead of the API's key to retrieve data.
- [callback] {Function} Optional function to be called after the server's response is received, with
(error, data)
as parameters.
getSummonerLeagues(options, callback)
Get leagues in all queues for a given summoner ID.
Parameters
- options {Object}
- options.summonerId {number | string} Summoner ID associated with the player.
- [options.region] {string} Optional region to be used instead of the API's region to retrieve data.
- [options.apiKey] {string} Optional key to be used instead of the API's key to retrieve data.
- [callback] {Function} Optional function to be called after the server's response is received, with
(error, data)
as parameters.
getSummonerLeaguePositions(options, callback)
Get league positions in all queues for a given summoner ID.
Parameters
- options {Object}
- options.summonerId {number | string} Summoner ID associated with the player.
- [options.region] {string} Optional region to be used instead of the API's region to retrieve data.
- [options.apiKey] {string} Optional key to be used instead of the API's key to retrieve data.
- [callback] {Function} Optional function to be called after the server's response is received, with
(error, data)
as parameters.
getSummonerMasteries(options, callback)
Get mastery pages for a given summoner ID.
Parameters
- options {Object}
- options.summonerId {number | string} Summoner ID associated with the player.
- [options.region] {string} Optional region to be used instead of the API's region to retrieve data.
- [options.apiKey] {string} Optional key to be used instead of the API's key to retrieve data.
- [callback] {Function} Optional function to be called after the server's response is received, with
(error, data)
as parameters.
getSummonerRunes(options, callback)
Get rune pages for a given summoner ID.
Parameters
- options {Object}
- options.summonerId {number | string} Summoner ID associated with the player.
- [options.region] {string} Optional region to be used instead of the API's region to retrieve data.
- [options.apiKey] {string} Optional key to be used instead of the API's key to retrieve data.
- [callback] {Function} Optional function to be called after the server's response is received, with
(error, data)
as parameters.