A promise-based Node.js library for the Blizzard Community Platform API.
Return an initialized Blizzard.js instance with default options.
Your Battle.net API key is required for all API calls so it must be passed to Blizzard.js with .initialize() or with each request.
A user access token is only required for account level requests. A default access token can be passed to .initialize() (for a browser environment working with a single user account), or to each request (for a server environment working with multiple user accounts).
Other parameters include origin and locale. When passed to initialize() they are no longer required with each request unless you want to override the default (e.g. when setting US as the default region but you want to request from the EU region instead).
Blizzard.js uses axios internally and requests return fetch promises from axios. The instance argument is an axios-compatible default configuration object.
Parameters
argsObjectargs.apikeyString - Your private Blizzard API keyargs.access_token[String] - A default user access tokenargs.origin[String] - The default API regionargs.locale[String] - The default API locale
instance[Object] - An axios instance configuration object
Example
const blizzard = require('blizzard.js').initialize({ apikey: BATTLENET_API_KEY });Fetch an authenticated user's account id and battletag.
Parameters
argsObjectargs.access_tokenString - The user access tokenargs.origin[String] - The region keyargs.locale[String] - A locale code for this region
instance[Object] - An axios instance configuration object
Example
blizzard.account.user({ access_token: USER_ACCESS_TOKEN, origin: 'us' })
.then(response => {
console.log(response.data);
});Fetch an authenticated user's World of Warcraft character list.
Parameters
argsObjectargs.access_tokenString - The user access tokenargs.origin[String] - The region keyargs.locale[String] - A locale code for this region
instance[Object] - An axios instance configuration object
Example
blizzard.account.wow({ access_token: USER_ACCESS_TOKEN, origin: 'us' })
.then(response => {
console.log(response.data);
});Fetch an authenticated user's Starcraft 2 profile.
Parameters
argsObjectargs.access_tokenString - The user access tokenargs.origin[String] - The region keyargs.locale[String] - A locale code for this region
instance[Object] - An axios instance configuration object
Example
blizzard.account.sc2({ access_token: USER_ACCESS_TOKEN, origin: 'us' })
.then(response => {
console.log(response.data);
});The Blizzard World of Warcraft Game Data APIs provide access to the following resources:
- Connected Realm API
- Realm API
- Region API
- Mythic Keystone Leaderboard API
- WoW Token API
These APIs require a valid application access token which is obtained through the .credentials() method, while an issued access token can be checked through the .validate() method.
Fetch an application access token.
Parameters
argsObjectargs.idString - Your application client IDargs.secretString - Your application client secretargs.originString - The region key
Example
blizzard.data.credentials({id: process.env.BLIZZARD_API_ID, secret: process.env.BLIZZARD_API_SECRET, origin: 'us' })
.then(response => {
console.log(response.data);
});Check the details of an application access token.
Parameters
argsObjectargs.originString - The region keyargs.tokenString - The access token to be checked
Example
blizzard.data.validate({ origin: 'us', token: APPLICATION_ACCESS_TOKEN })
.then(response => {
console.log(response.data);
});Fetch the index of connected realms or a single connected realm by ID.
Parameters
argsObjectargs.access_tokenString - The application access tokenargs.namespaceString - The game data namespaceargs.realm[Number] - The connected realm ID for a single realmargs.origin[String] - The region keyargs.locale[String] - A locale code for this region
instance[Object] - An axios instance configuration object
Example
blizzard.data.connectedRealm({ access_token: APPLICATION_ACCESS_TOKEN, namespace: 'dynamic-us', origin: 'us' })
.then(response => {
console.log(response.data);
});blizzard.data.connectedRealm({ access_token: APPLICATION_ACCESS_TOKEN, namespace: 'dynamic-us', realm: 11, origin: 'us' })
.then(response => {
console.log(response.data);
});Get an index of Mythic Keystone Leaderboards for a connected realm or weekly Mythic Keystone Leaderboard by period.
Parameters
argsObjectargs.access_tokenString - The application access tokenargs.namespaceString - The game data namespaceargs.realm[Number] - The realm IDargs.dungeon[Number] - The dungeon IDargs.period[Number] - The mythic leaderboard periodargs.origin[String] - The region keyargs.locale[String] - A locale code for this region
instance[Object] - An axios instance configuration object
Example
blizzard.data.mythicLeaderboard({ access_token: APPLICATION_ACCESS_TOKEN, namespace: 'dynamic-us', origin: 'us' })
.then(response => {
console.log(response.data);
});blizzard.data.mythicLeaderboard({ access_token: APPLICATION_ACCESS_TOKEN, namespace: 'dynamic-us', relam: 11, dungeon: 197, period: 602 origin: 'us' })
.then(response => {
console.log(response.data);
});Get current period information about the Mythic Challenge Mode relevant to Mythic Keystone Leaderboards.
Parameters
argsObjectargs.access_tokenString - The application access tokenargs.namespaceString - The game data namespaceargs.origin[String] - The region keyargs.locale[String] - A locale code for this region
instance[Object] - An axios instance configuration object
Example
blizzard.data.mythicChallengeMode({ access_token: APPLICATION_ACCESS_TOKEN, namespace: 'dynamic-us', origin: 'us' })
.then(response => {
console.log(response.data);
});Get an index of realms or a single realm by slug or ID.
Parameters
argsObjectargs.access_tokenString - The application access tokenargs.namespaceString - The game data namespaceargs.realm[String|Number] - The connected realm slug or IDargs.origin[String] - The region keyargs.locale[String] - A locale code for this region
instance[Object] - An axios instance configuration object
Example
blizzard.data.realm({ access_token: APPLICATION_ACCESS_TOKEN, namespace: 'dynamic-us', origin: 'us' })
.then(response => {
console.log(response.data);
});blizzard.data.realm({ access_token: APPLICATION_ACCESS_TOKEN, namespace: 'dynamic-us', realm: 11, origin: 'us' })
.then(response => {
console.log(response.data);
});Get an index of regions or a single region by ID.
Parameters
argsObjectargs.access_tokenString - The application access tokenargs.namespaceString - The game data namespaceargs.region[Number] - The region IDargs.origin[String] - The region keyargs.locale[String] - A locale code for this region
instance[Object] - An axios instance configuration object
Example
blizzard.data.region({ access_token: APPLICATION_ACCESS_TOKEN, namespace: 'dynamic-us', origin: 'us' })
.then(response => {
console.log(response.data);
});blizzard.data.region({ access_token: APPLICATION_ACCESS_TOKEN, namespace: 'dynamic-us', region: 1, origin: 'us' })
.then(response => {
console.log(response.data);
});Get the World of Warcraft token index.
Parameters
argsObjectargs.access_tokenString - The application access tokenargs.namespaceString - The game data namespaceargs.origin[String] - The region keyargs.locale[String] - A locale code for this region
instance[Object] - An axios instance configuration object
Example
blizzard.data.token({ access_token: APPLICATION_ACCESS_TOKEN, namespace: 'dynamic-us', origin: 'us' })
.then(response => {
console.log(response.data);
});Fetch a Diablo 3 data resource.
Parameters
keyString - The data resource key:follower,artisan,itemargsObjectargs.idString - The data resource IDargs.origin[String] - The region keyargs.locale[String] - A locale code for this region
instance[Object] - An axios instance configuration object
Example
blizzard.d3.data('follower', { id: 'templar', origin: 'us' })
.then(response => {
console.log(response.data);
});blizzard.d3.data('artisan', { id: 'mystic', origin: 'us' })
.then(response => {
console.log(response.data);
});Fetch a Diablo 3 era.
Parameters
argsObjectargs.id[Number] - The era IDargs.access_token[String] - A user access tokenargs.leaderboard[String] - The era leaderboard keyargs.origin[String] - The region keyargs.locale[String] - A locale code for this region
instance[Object] - An axios instance configuration object
Example
blizzard.d3.era({ origin: 'us' })
.then(response => {
console.log(response.data);
});blizzard.d3.era({ id: 5, origin: 'us' })
.then(response => {
console.log(response.data);
});blizzard.d3.era({ id: 5, leaderboard: 'rift-barbarian', origin: 'us' })
.then(response => {
console.log(response.data);
});Fetch a Diablo 3 profile.
Parameters
argsObjectargs.tagString - The user battletagargs.hero[Number] - The hero IDargs.itemTypes[String] - The hero items to fetch:items,follower-itemsargs.origin[String] - The region keyargs.locale[String] - A locale code for this region
instance[Object] - An axios instance configuration object
Example
blizzard.d3.profile({ tag: 'skt#1884', origin: 'us' })
.then(response => {
console.log(response.data);
});blizzard.d3.profile({ tag: 'skt#1884', hero: 287801, origin: 'us' })
.then(response => {
console.log(response.data);
});Fetch a Diablo 3 season.
Parameters
argsObjectargs.id[String] - The season IDargs.leaderboard[String] - The season leaderboard keyargs.access_token[String] - A user access tokenargs.origin[String] - The region keyargs.locale[String] - A locale code for this region
instance[Object] - An axios instance configuration object
Example
blizzard.d3.season({ origin: 'us' })
.then(response => {
console.log(response.data);
});blizzard.d3.season({ id: 5, origin: 'us' })
.then(response => {
console.log(response.data);
});blizzard.d3.season({ id: 5, leaderboard: 'rift-barbarian', origin: 'us' })
.then(response => {
console.log(response.data);
});Fetch a Starcraft 2 data resource.
Parameters
keyString - The data resource key:achievements,rewardsargsObjectargs.origin[String] - The region keyargs.locale[String] - A locale code for this region
instance[Object] - An axios instance configuration object
Example
blizzard.sc2.data('achievements', { origin: 'us' })
.then(response => {
console.log(response.data);
});blizzard.sc2.data('rewards', { origin: 'us' })
.then(response => {
console.log(response.data);
});Fetch a Starcraft 2 ladder.
Parameters
argsObjectargs.idNumber - The ladder IDargs.origin[String] - The region keyargs.locale[String] - A locale code for this region
instance[Object] - An axios instance configuration object
Example
blizzard.sc2.ladder({ id: 194163, origin: 'us' })
.then(response => {
console.log(response.data);
});Fetch a Starcraft 2 player profile.
Parameters
keyString - The profile resource key:profile,ladders,matchesargsObjectargs.idNumber - The profile IDargs.nameString - The profile nameargs.region[String] - The profile region (optional, default1)args.origin[String] - The region keyargs.locale[String] - A locale code for this region
instance[Object] - An axios instance configuration object
Example
blizzard.sc2.profile('profile', { id: 2137104, name: 'skt', origin: 'us' })
.then(response => {
console.log(response.data);
});blizzard.sc2.profile('ladders', { id: 2137104, name: 'skt', origin: 'us' })
.then(response => {
console.log(response.data);
});blizzard.sc2.profile('matches', { id: 2137104, name: 'skt', origin: 'us' })
.then(response => {
console.log(response.data);
});Fetch an achievement.
Parameters
argsObjectargs.idNumber - The achievement IDargs.origin[String] - The region keyargs.locale[String] - A locale code for this region
instance[Object] - An axios instance configuration object
Example
blizzard.wow.achievement({ id: 2144, origin: 'us' })
.then(response => {
console.log(response.data);
});Fetch auction data.
Parameters
argsObjectargs.realmString - The slugified realm nameargs.origin[String] - The region keyargs.locale[String] - A locale code for this region
instance[Object] - An axios instance configuration object
Example
blizzard.wow.auction({ realm: 'proudmoore', origin: 'us' })
.then(response => {
console.log(response.data);
});Fetch boss data.
Parameters
argsObjectargs.id[Number] - The boss IDargs.origin[String] - The region keyargs.locale[String] - A locale code for this region
instance[Object] - An axios instance configuration object
Example
blizzard.wow.boss({ origin: 'us' })
.then(response => {
console.log(response.data);
});blizzard.wow.boss({ id: 24664, origin: 'us' })
.then(response => {
console.log(response.data);
});Fetch challenge data.
Parameters
argsObjectargs.realm[String] - The slugified realm nameargs.origin[String] - The region keyargs.locale[String] - A locale code for this region
instance[Object] - An axios instance configuration object
Example
blizzard.wow.challenge({ origin: 'us' })
.then(response => {
console.log(response.data);
});blizzard.wow.challenge({ realm: 'medivh', origin: 'us' })
.then(response => {
console.log(response.data);
});Fetch character data.
Parameters
keysString|Array - One or more character resource keys:profile,achievements,appearance,feed,guild,hunterPets,items,mounts,professions,progression,pvp,quests,reputation,statistics,stats,talents,titles,auditargsObjectargs.nameString - The character nameargs.realmString - The slugified realm nameargs.origin[String] - The region keyargs.locale[String] - A locale code for this region
instance[Object] - An axios instance configuration object
Example
blizzard.wow.character(['profile', 'achievements'], { realm: 'proudmoore', name: 'kailee', origin: 'us' })
.then(response => {
console.log(response.data);
});blizzard.wow.character(['pets', 'petSlots'], { realm: 'amanthul', name: 'charni', origin: 'us' })
.then(response => {
console.log(response.data);
});Fetch a WoW data resource.
Parameters
keyString - The data resource key:battlegroups,character-achievements,character-classes,character-races,guild-achievements,guild-perks,guild-rewards,item-classes,pet-types,talents`argsObjectargs.origin[String] - The region keyargs.locale[String] - A locale code for this region
instance[Object] - An axios instance configuration object
Example
blizzard.wow.data('character-races', { origin: 'us' })
.then(response => {
console.log(response.data);
});blizzard.wow.data('character-classes', { origin: 'us' })
.then(response => {
console.log(response.data);
});Fetch guild data.
Parameters
keysString|Array - One or more guild resource keys:profile,achievements,challenge,members,newsargsObjectargs.nameString - The guild nameargs.realmString - The slugified realm nameargs.origin[String] - The region keyargs.locale[String] - A locale code for this region
instance[Object] - An axios instance configuration object
Example
blizzard.wow.guild(['profile', 'members'], { realm: 'amanthul', name: 'blackwolf', origin: 'us' })
.then(response => {
console.log(response.data);
});Fetch item data.
Parameters
argsObjectargs.idNumber - The item or set IDargs.set[Boolean] - Whether this is an item set request or notargs.bonuses[Array] - A list of bonuses to apply to the itemargs.origin[String] - The region keyargs.locale[String] - A locale code for this region
instance[Object] - An axios instance configuration object
Example
blizzard.wow.item({ id: 18803, origin: 'us' })
.then(response => {
console.log(response.data);
});Fetch mount data.
Parameters
argsObjectargs.origin[String] - The region keyargs.locale[String] - A locale code for this region
instance[Object] - An axios instance configuration object
Example
blizzard.wow.mount({ origin: 'us' })
.then(response => {
console.log(response.data);
});Fetch pet data.
Parameters
keyString - The pet resource key:list,ability,species,statsargsObjectargs.id[String] - The pet resource IDargs.origin[String] - The region keyargs.locale[String] - A locale code for this region
instance[Object] - An axios instance configuration object
Example
blizzard.wow.pet('list', { origin: 'us' })
.then(response => {
console.log(response.data);
});blizzard.wow.pet('ability', { id: 640, origin: 'us' })
.then(response => {
console.log(response.data);
});blizzard.wow.pet('species', { id: 258, origin: 'us' })
.then(response => {
console.log(response.data);
});Fetch pvp data.
Parameters
argsObjectargs.bracketString - The pvp bracket keyargs.origin[String] - The region keyargs.locale[String] - A locale code for this region
instance[Object] - An axios instance configuration object
Example
blizzard.wow.pvp({ bracket: '3v3', origin: 'us' })
.then(response => {
console.log(response.data);
});Fetch quest data.
Parameters
argsObjectargs.idNumber - The quest IDargs.origin[String] - The region keyargs.locale[String] - A locale code for this region
instance[Object] - An axios instance configuration object
Example
blizzard.wow.quest({ id: 13146, origin: 'us' })
.then(response => {
console.log(response.data);
});Fetch realm data.
Parameters
argsObjectargs.realms[String|Array] - One or more slugified realm namesargs.origin[String] - The region keyargs.locale[String] - A locale code for this region
instance[Object] - An axios instance configuration object
Example
blizzard.wow.realms({ origin: 'us' })
.then(response => {
console.log(response.data);
});blizzard.wow.realms({ realms: ['blackrock', 'proudmoore'], origin: 'us' })
.then(response => {
console.log(response.data);
});Fetch recipe data.
Parameters
argsObjectargs.idNumber - The recipe IDargs.origin[String] - The region keyargs.locale[String] - A locale code for this region
instance[Object] - An axios instance configuration object
Example
blizzard.wow.recipe({ id: 33994, origin: 'us' })
.then(response => {
console.log(response.data);
});Fetch spell data.
Parameters
argsObjectargs.idNumber - The spell IDargs.origin[String] - The region keyargs.locale[String] - A locale code for this region
instance[Object] - An axios instance configuration object
Example
blizzard.wow.spell({ id: 8056, origin: 'us' })
.then(response => {
console.log(response.data);
});Fetch zone data.
Parameters
argsObjectargs.idNumber - The zone IDargs.origin[String] - The region keyargs.locale[String] - A locale code for this region
instance[Object] - An axios instance configuration object
Example
blizzard.wow.zone({ origin: 'us' })
.then(response => {
console.log(response.data);
});blizzard.wow.zone({ id: 4131, origin: 'us' })
.then(response => {
console.log(response.data);
});