Provides an easy way to get started with the Clash of Clans API
For more information about the responses please check Official Clash of Clans Dev Website . Not releated to Supercell.
Created By: Philippe Smeets
npm install clash-of-clans-node
All fetches return a promise using request-promise
In order to get started with Clash of Clans API, you need to create an account at developer.clashofclans.com . Then go "My Account" and press on "Create New Key". Fill in the name, description and IP address and copy the key. This is the key that we are later going to use to authenticate you.
Once you get your token and have installed the module. Require the package into you file using require()
and call the login function.
Example:
const client = require ( 'clash-of-clans-node' ) ;
await client . login ( 'YOUR-TOKEN-HERE' ) ;
Remember that the client.login()
is an asynchronised function.
Function
Parameter
Description
#login
auth
Logs the user in
await client . login ( 'YOUR-TOKEN-HERE' ) ;
Function
Parameter
Description
#getClan
clanTag
Retrieves clan information by clanTag
await client . getClan ( 'CLAN-TAG-HERE' ) ;
Get Clan Capital Raid Season by Tag
Function
Parameters
Description
#getClanCapitalRaidSeason
clanTag, limit
Retrieves clan capital raid season by clanTag
await client . getClanCapitalRaidSeason ( 'CLAN-TAG-HERE' , limit )
Get Clan Current War by Tag
Function
Parameter
Description
#getClanCurrentWar
clanTag
Retrieves clan current war by clanTag
await client . getClanCurrentWar ( 'CLAN-TAG-HERE' ) ;
Get Clan Current War League Group by Tag
Function
Parameter
Description
#getClanCurrentWarLeagueGroup
clanTag
Retrieves clan current war league group by clanTag
await client . getClanCurrentWarLeagueGroup ( 'CLAN-TAG-HERE' ) ;
Function
Parameters
Description
#getClanMembers
clanTag, limit
Retrieves clan members by clanTag
await client . getClanMembers ( 'CLAN-TAG-HERE' , limit ) ;
Get Clan War League by War Tag
Function
Parameter
Description
#getClanWarLeagueByWarTag
warTag
Retrieves information about individual clan war league war
await client . getClanWarLeagueByWarTag ( 'WAR-TAG-HERE' ) ;
Function
Parameters
Description
#getClanWarLog
clanTag, limit
Retrieves clan war log by clanTag
await client . getClanWarLog ( 'CLAN-TAG-HERE' , limit ) ;
Function
Parameters
Description
#searchClan
name, warFrequency, locationId, minMembers, maxMembers, minClanPoints, minClanLevel, limit
Retrieves clans based on search results
await client . searchClan ( name , warFrequency , locationId , minMembers , maxMembers , minClanPoints , minClanLevel , limit ) ;
Function
Parameter
Description
#getPlayer
playerTag
Retrieves user information by playerTag
await client . getPlayer ( 'PLAYER-TAG-HERE' ) ;
Function
Parameters
Description
#verifyPlayer
playerTag, token
Verifies a player using their playerTag and token
await client . verifyPlayer ( 'PLAYER-TAG-HERE' , 'TOKEN' ) ;
Get Builder Base League by leagueId
Function
Parameter
Description
#getBuilderBaseLeagueById
leagueId
Retrieves builder base league information by leagueId
await client . getBuilderBaseLeagueById ( 'LEAGUE-ID-HERE' ) ;
Function
Parameter
Description
#getBuilderBaseLeagues
limit
Retrieves all Builder base leagues
await client . getBuilderBaseLeagues ( limit ) ;
Get Capital League by leagueId
Function
Parameter
Description
#getCapitalLeagueById
leagueId
Retrieves capital league information by leagueId
await client . getCapitalLeagueById ( 'LEAGUE-ID-HERE' ) ;
Function
Parameter
Description
#getCapitalLeagues
limit
Retrieves all Capital leagues.
await client . getCapitalLeagues ( limit ) ;
Function
Parameter
Description
#getLeagueById
leagueId
Retrieves league information by leagueId
await client . getLeagueById ( 'LEAGUE-ID-HERE' ) ;
Function
Parameter
Description
#getLeagues
limit
Retrieves all leagues
await client . getLeagues ( limit ) ;
Function
Parameters
Description
#getRankingBySeasonId
seasonId, limit (REQUIRED)
Retrieves the ranking of that season by seasonId
await client . getRankingBySeasonId ( 'SEASON-ID-HERE' , limit ) ;
Function
Parameter
Description
#getSeasonId
limit
Retrieves all season id's
await client . getSeasonId ( limit ) ;
Get War League by leagueId
Function
Parameter
Description
#getWarLeagueById
leagueId
Retrieves war league by leagueId
await client . getWarLeagueById ( 'LEAGUE-ID-HERE' ) ;
Function
Parameter
Description
#getWarLeagues
limit
Retrieves all war leagues
await client . getWarLeagues ( limit ) ;
Get Clans Builder Base Rankings by locationId
Function
Parameters
Description
#getClansBuilderBaseRankingsByLocationId
locationId, limit
Retrieves clans builder base rankings by locationId
await client . getClansBuilderBaseRankingsByLocationId ( 'LOCATION-ID-HERE' , limit ) ;
Get Clans Capital Rankings by locationId
Function
Parameters
Description
#getClansCapitalRankingsByLocationId
locationId, limit
Retrieves clans capital rankings by locationId
await client . getClansCapitalRankingsByLocationId ( 'LOCATION-ID-HERE' , limit ) ;
Get Clans Rankings by locationId
Function
Parameters
Description
#getClansRankingsByLocationId
locationId, limit
Retrieves clans rankings by locationId
await client . getClansRankingsByLocationId ( 'LOCATION-ID-HERE' , limit ) ;
Function
Parameter
Description
#getLocationById
locationId
Retrieves location information by locationId
await client . getLocationById ( 'LOCATION-ID-HERE' ) ;
Function
Parameter
Description
#getLocations
limit
Retrieves all ranking locations
await client . getLocations ( limit ) ;
Get Players Builder Base Rankings by locationId
Function
Parameters
Description
#getPlayersRankingsByLocationId
locationId, limit
Retrieves players builder base rankings by locationId
await client . getPlayersBuilderBaseRankingsByLocationId ( 'LOCATION-ID-HERE' , limit ) ;
Get Players Rankings by locationId
Function
Parameters
Description
#getPlayersRankingsByLocationId
locationId, limit
Retrieves players rankings by locationId
await client . getPlayersRankingsByLocationId ( 'LOCATION-ID-HERE' , limit ) ;
Function
Parameter
Description
#getLabelsClan
limit
Retrieves all clan labels
await client . getLabelsClan ( limit ) ;
Function
Parameter
Description
#getLabelsPlayer
limit
Retrieves all player labels
await client . getLabelsPlayer ( limit ) ;
Function
Description
#getGoldpass
Retrieves goldpass information
await client . getGoldpass ( ) ;
Name
Type
Required
Description
auth
string
True
The Authentication Token granted by developer.clashofclans.com
clanTag
string
True
The tag of the clan. Found in clan setting.
playerTag
string
True
The tag of a player. Found in player's profile.
token
string
True
The verification token of the user. Found in setting -> more settings -> API TOKEN.
leagueId
string
True
The id of a league. Can differ from: builder base, warleague, capcapital and standard league (home villige).
seasonId
string
True
The id of that season. client.getSeasonId()
will show all possible id's.
warTag
string
True
The tag of the war. Found with #getClanCurrentWarLeagueGroup
.
locationId
String
True
The id of the location. Found with #getLocations
.
limit
number
False
Limit the number of items returned in the response. #getRankingBySeasonId
limit is required due to many records.
minMembers
number
False
The minimum members that are in the clan.
maxMembers
number
False
The maximum members that are in the clan.
minClanPoints
number
False
The minimum clan points that the clan has.
minClanLevel
number
False
The minimum clan level that the clan is.
Name
Type
Optional
Description
For more output data please check the Official Clash Of Clans Dev Website .
This content is not affiliated with, endorsed, sponsored, or specifically approved by Supercell and Supercell is not responsible for it. For more information see Supercell's Fan Content Policy: <www.supercell.com/en/fan-content-policy/ >