This package contains a simple, asynchronous, free, dependency-free node.js library for using the Clash Royale API.
- Install
node.js
using from here. - Install
clashpi
withnpm install clashpi
- You will need a Clash Royale API key to use this library. To obtain a key, create an account here or if you already have one log in here. Afterwards click on
My Account
from where you can access your API keys. Copy the entire key.
Example:
First import the library and create a Client
object.
const { Client } = require('clashpi');
const client = new Client(APIKEY);
Then call functions on the Client
object.
client.getPlayer('#JGJYQ2P2V')
.then(player => client
.getUpcomingChests(player).then(console.log));
// OR
client.getUpcomingChests('#JGJYQ2P2V')
.then(console.log);
client.getPlayerRanks('2023-03')
.then(console.log);
- getCards(rarity = [Rarity.COMMON, Rarity.RARE, Rarity.EPIC, Rarity.LEGENDARY, Rarity.CHAMPION], name = [])
Get a list of all cards in the game, or filter by rarity or name
- getChallenges()
Get a list of all challenges
- getPlayer(tag)
Get all information about a specific player
- getUpcomingChests(tag, index = undefined)
Get all (or a specific) upcoming chests of a specific player
- getBattleLog(tag)
Get the battle log of a specific player
- getLocations(limit = undefined)
Get a list of all locations in the game
- getClanRanks(locationId, clanWars = false, limit = undefined)
Get a ranking of all clans in a certain location, either by clan ranking or by clan-war ranking
- getPlayerRanks(seasonId, pathOfLegends = false, limit = undefined)
Get ranking of all players that played in a specific season, either by trophies or by path of legend rank
- getTournaments(name, limit = undefined)
Get a list of all tournaments containing a specific name
- getTournament(tag)
Get all information of about a specific tournament
- getGlobalTournament()
Get a list of all global tournaments