Hypicle v1.1.4
How to get the API Key?
- Visit the Hypixel Developer Dashboard.
- Log in.
- Generate and Copy a new Development Key.
Quick Start
import { Hypicle } from 'hypicle';
const client = new Hypicle('YOUR_API_KEY');
Hypicle Structure
-
- api/boosters - Currently active boosters
- api/counts - Active players count
- api/guild - Guild information
- api/key - API Key information (deprecated)
- api/leaderboards - Global Leaderboards information
- api/player - Player information & statistics
- api/punishments - Punishment statistics
- api/recentgames - Recent games of a player
- api/status - Status of a player
-
client.ts - The Hypicle Client
-
utils.ts - The Hypicle Utils
Hypixel API implementation in Hypicle
This is the Hypixel API implementation.
Below you can find a list of available API endpoints in Hypicle.
All endpoints require the Hypicle
client, and some endpoints require additional information like player uuid.
Implemented API endpoints
- boosters - Currently active boosters
- counts - Active players count
- guild - Guild information
- key - Key information (deprecated)
- leaderboards - Global Leaderboards information
- player - Player information & statistics
- punishments - Punishment statistics
- recentgames - Recent games of a player
- status - Status of a player
Boosters Endpoint implementation
Hypixel API Endpoint: api.hypixel.net/boosters
This endpoint returns all Active Network Boosters
Usage
Example:
const boosters = await getBoosters(client);
// result: 'Boosters' interface with data
Counts Endpoint implementation
Hypixel API Endpoint: api.hypixel.net/counts
This endpoint returns Current Player Count Status.
Usage
Example:
const counts = await getCounts(client);
// result: 'Counts' interface with data
Other functions
This endpoint also implements game/lobby specific getters.
List of all getters:
getCounts
- Get global active players count statisticsgetMainLobby
- Get active players count statistics in Main LobbygetTournamentLobby
- Get active players count statistics in Tournament LobbygetSMP
- Get active players count statistics in SMP ServersgetLegacy
- Get active players count statistics in Legacy GamesgetSkywars
- Get active players count statistics in SkyWarsgetPit
- Get active players count statistics in PitgetBuildBattle
- Get active players count statistics in Build BattlegetReplay
- Get active players count statistics in ReplaysgetWalls
- Get active players count statistics in WallsgetSuperSmash
- Get active players count statistics in Smash HeroesgetBedwars
- Get active players count statistics in BedWarsgetArcade
- Get active players count statistics in Arcade GamesgetMurderMystery
- Get active players count statistics in Murder MysterygetUhc
- Get active players count statistics in UHCgetWoolGames
- Get active players count statistics in Wool WarsgetSpeedUhc
- Get active players count statistics in Speed UHCgetHousing
- Get active players count statistics in HousinggetDuels
- Get active players count statistics in DuelsgetTntGames
- Get active players count statistics in TNT GamesgetBattleground
- Get active players count statistics in WarlordsgetSurvivalGames
- Get active players count statistics in Survival GamesgetSkyblock
- Get active players count statistics in SkyBlockgetPrototype
- Get active players count statistics in Prototype GamesgetMCGO
- Get active players count statistics in Cops and CrimsgetLimbo
- Get active players count statistics in LimbogetIdle
- Get active Idle players count statisticsgetQueue
- Get active players count statistics in Queue
Guild Endpoint implementation
Hypixel API Endpoint: api.hypixel.net/guild
This endpoint returns Guild data by a player, name or id
Usage
Create a new Guild
object with client, id and guild type.
Example:
const guild = new Guild(client, 'guild name', 'name');
Other functions
List of all Guild
methods:
getGuildData
- Get the guild data and cache it to a variableget
- Get the guildgetID
- Get the ID of the guildgetName
- Get the guild namegetNameLower
- Get the guild name in lower casegetDescription
- Get the description of the guildgetCreatedAt
- Get the guild creation timestampisJoinable
- Check if the guild is joinableisPubliclyListed
- Check if the guild is publicly listedgetExperience
- Get experience of the guildgetLevel
- Get the level of the guild (see Leveling)getTag
- Get the guild taggetTagColor
- Get the guild tag colorgetLegacyRanking
- Get the guild legacy rankinggetCoins
- Get guild coins amountgetCoinsEver
- Get the guild coins ever amountgetMembersCount
- Get the members count of the guildgetMembers
- Get the members list of the guildgetAchievements
- Get the achievements of the guildgetPreferredGames
- Get preferred games of the guildgetExpByGame
- Get the guild experience by game type
Leveling
Guild has its own leveling system.
See Guild Leveling system implementation by Plancke.
You can use GuildLeveling
in your project.
List of all GuildLeveling
methods:
getLevel
- Get guild level by provided experience
Key Endpoint implementation
This endpoint is no longer available
Hypixel API Endpoint: api.hypixel.net/key
This endpoint returns the API key data.
Usage
Example:
const key = await getKey(client);
// result: 'Key' interface with data
Leaderboards Endpoint implementation
Hypixel API Endpoint: api.hypixel.net/leaderboards
This endpoint returns Current Leaderboards
Usage
Example:
const leaderboards = await getLeaderboards(client);
// result: 'Leaderboards' interface with data
Other functions
This endpoint also implements game/lobby specific getters.
Game/Lobby specific getter returns Leaderboard[]
.
List of all getters:
getLeaderboards
- Get global Leaderboards statisticsgetLeaderboardsDuels
- Get global Duels Leaderboards statisticsgetLeaderboardsTrueCombat
- Get global Crazy Walls Leaderboards statisticsgetLeaderboardsSpeedUhc
- Get global SpeedUHC Leaderboards statisticsgetLeaderboardsPaintball
- Get global Paintball Leaderboards statisticsgetLeaderboardsMurderMystery
- Get global Murder Mystery Leaderboards statisticsgetLeaderboardsSkywars
- Get global SkyWars Leaderboards statisticsgetLeaderboardsBedwars
- Get global BedWars Leaderboards statisticsgetLeaderboardsPrototype
- Get global Prototype Leaderboards statisticsgetLeaderboardsGingerbread
- Get global Turbo Kart Racers Leaderboards statisticsgetLeaderboardsWoolGames
- Get global Wool Wars Leaderboards statisticsgetLeaderboardsTntGames
- Get global TNT Games Leaderboards statisticsgetLeaderboardsUhc
- Get global UHC Leaderboards statisticsgetLeaderboardsBuildBattle
- Get global Build Battle Leaderboards statisticsgetLeaderboardsWalls3
- Get global Mega Walls Leaderboards statisticsgetLeaderboardsVampirez
- Get global VampireZ Leaderboards statisticsgetLeaderboardsArcade
- Get global Arcade Leaderboards statisticsgetLeaderboardsWalls
- Get global Walls Leaderboards statisticsgetLeaderboardsSurvivalGames
- Get global Survival Games Leaderboards statisticsgetLeaderboardsSuperSmash
- Get global Smash Heroes Leaderboards statisticsgetLeaderboardsSkyclash
- Get global SkyClash Leaderboards statisticsgetLeaderboardsQuakecraft
- Get global Quake Leaderboards statisticsgetLeaderboardsMCGO
- Get global Cops and Crims Leaderboards statisticsgetLeaderboardsBattleground
- Get global Warlords Leaderboards statisticsgetLeaderboardsArena
- Get global Arena Leaderboards statistics
Player Endpoint implementation
Hypixel API Endpoint: api.hypixel.net/player
This endpoint returns the player data by uuid
Usage
Create a new Player
object with client and uuid.
const player = new Player(client, 'uuid');
Other functions
List of all Player
methods:
getPlayerData
- Get the player data and cache it to a variableget
- Get the playergetUUID
- Get the UUID of the playergetStatus
- Get the status of the playergetKarma
- Get the karma of the playergetNetworkExp
- Get the network experience of the playergetLevel
- Get the network level of the playergetExactLevel
- Get exact network level of the playergetGuild
- Get the guild membership of the player or nullisStaff
- Check if the player is in the staff teamgetHighestRank
- Get the highest rank of the playergetPlusColor
- Get the rank plus colorgetName
- Get the display name of the playergetRecentGameType
- Get recently played games by the playergetSocialMedia
- Get player connected social mediagetStats
- Get the playerStats
Get stats of the player:
const stats = player.getStats();
Get any minigame stats
const minigame = stats.getByName('name');
List of all Stats
methods:
get
- Get all minigame statsgetByName
- Get one minigame stats by the namegetBedwars
- Get BedWars-specific statsgetSkyWars
- Get SkyWars-specific stats
BedWars & SkyWars
Due to the complexity of both minigames, you can get specific stats.
Examples:
-
BedWars
const bedwars = stats.getBedwars();
-
SkyWars
const skywars = stats.getSkyWars();
List of all BedwarsMinigame
methods:
get
- Get all the BedWars statsgetCoins
- Get BedWars coinsgetLevel
- Get BedWars level (see Leveling)getIronCollected
- Get collected IrongetGoldCollected
- Get collected GoldgetDiamondsCollected
- Get collected DiamondsgetEmeraldsCollected
- Get collected EmeraldsgetWinstreak
- Get the current winstreakgetKills
- Get BedWars KillsgetFinalKills
- Get BedWars final KillsgetDeaths
- Get BedWars DeathsgetFinalDeaths
- Get BedWars final DeathsgetWins
- Get BedWars winsgetLosses
- Get BedWars lossesgetBedsBroken
- Get broken beds amount
List of all SkyWarsMinigame
methods:
get
- Get all the SkyWars statsgetCoins
- Get SkyWars coinsgetLevel
- Get SkyWars level (see Leveling)getSouls
- Get all soulsgetSoulsGathered
- Get souls gatheredgetSoulWellUses
- Get uses of the soul wellgetSoullWellLegendaries
- Get the legendary drops from the soul wellgetSoulWellRares
- Get the rare drops from the soul wellgetChestsOpened
- Get the amount of opened chestsgetBlocksBroken
- Get the amount of broken blocksgetBlocksPlaced
- Get the amount of placed blocksgetEggs
- Get the amount of thrown EggsgetEnderpearls
- Get the amount of thrown EnderpearlsgetArrowsShot
- Get the amount of shot arrowsgetArrowsHit
- Get the amount of arrows that hitgetWinstreak
- Get the current winstreakgetKills
- Get SkyWars KillsgetVoidKills
- Get SkyWars void KillsgetAssists
- Get SkyWars AssistsgetDeaths
- Get SkyWars DeathsgetWins
- Get SkyWars winsgetLosses
- Get SkyWars lossesgetHeads
- Get the amount of collected headsgetHeadCollection
- Get the head collection
Leveling
Player has its own leveling system.
See Player Leveling system implementation by Plancke.
You can use PlayerLeveling
in your project.
List of all PlayerLeveling
methods:
getExactLevel
- Get exact network level by provided experiencegetLevel
- Get network level by provided experiencegetPercentageToNextLevel
- Get percentage to the next levelgetTotalExpToLevel
- Get the experience needed to reach provided levelgetTotalExpToFullLevel
- Get the total experience needed to reach provided level
Both BedWars and SkyWars also have their own leveling system.
See SkyWars & BedWars Leveling system implementation by Plancke.
You can also use both BedwarsLeveling
& SkyWarsLeveling
in your project.
List of all BedwarsLeveling
methods:
getLevelByExp
- Get BedWars Level by provided experiencegetExpByLevel
- Get BedWars Experience by provided Level
List of all SkyWarsLeveling
methods:
getProgressCurrentLevel
- Get the progress of the current levelgetLevelByExp
- Get SkyWars Level by provided experiencegetExpByLevel
- Get SkyWars Experience by provided Level
Punishments Endpoint implementation
Hypixel API Endpoint: api.hypixel.net/punishmentstats
This endpoint returns global Punishment Statistics
Usage
Example:
const punishments = await getPunishments(client);
// result: 'Punishments' interface with data
Recent Games Endpoint implementation
Hypixel API Endpoint: api.hypixel.net/recentgames
This endpoint returns Recently played games of a specific player by uuid
Usage
Example:
const recentgames = await getRecentgames(client, 'uuid');
// result: 'Recentgames' interface with data
Status Endpoint implementation
Hypixel API Endpoint: api.hypixel.net/status
This endpoint returns the Current Online status of a player by uuid
Usage
Example:
const status = await getStatus(client, 'uuid');
// result: 'Status' interface with data
Hypicle Client
The Hypicle
Client is the main entry point to interact with the Hypixel API.
To use the client, you need to construct it with your API Key.
Constructing the Client
To create a new Hypicle
Client instance, you can follow the steps below:
import { Hypicle } from 'hypicle';
const client = new Hypicle('YOUR_API_KEY');
Fetching an endpoint
Hypicle already provides implementation for some endpoints, see Hypicle Structure.
The Hypicle
Client implements two fetching methods.
-
fetch
method:The
fetch
method fetches data from the Hypixel API without applying any mappings, it also checks for any errors and then returns the fetched data.Parameters:
endpoint
(string
, required) - The endpoint to fetch data from.options
(Options
, optional) - Optional URL parameters for the request.
-
fetchMapping
method:The
fetchMapping
method uses thefetch
method, it takes aFieldMap<R>
as one of the parameters, then maps the API response to the provided mapping.Parameters:
endpoint
(string
, required) - The endpoint to fetch data from.mapping
(FieldMap<R>
, required) - The map to apply to the fetched data.options
(Options
, optional) - Optional URL parameters for the request.
Both methods are async and use Promises.
Example:
async function callEndpoint<R extends unknown>(client: Client): Promise<R> {
return await client.fetch<R>('endpoint');
}
Error handling
When Hypixel API fails then Hypicle catches it and throws a custom error interface.
The HypicleError
interface provides useful information about the error like a message, status code, throttle, and if the throttle is global.
Example error throw:
throw new HypicleError('Invalid API Key', 403, false);
Hypicle Utils
This is an internal extension for the Hypicle Client.
You don't need to use any of the utils functions in your code.
Functions
-
searchParamsFromObj
function:This utility function converts an object with query params to a URLSearchParams object.
Parameters:
- obj (
T extends Record<String, QueryParam>
) - The object with query params to convert
Returns URLSearchParams object with the query params.
Example:
const query: QueryParams = { uuid: '12345', name: 'john' }; const result = searchParamsFromObj(query); // result: URLSearchParams { 'uuid' => '12345', 'name' => 'john' }
- obj (
-
convertKeysToLowerCase
function:This utility function converts all keys in an object to lowercase.
Parameters:
- data (
any
) - The source object to convert.
Returns a new object with all keys converted to lowercase.
Example:
const src = { Name: 'john', Age: 30 }; const result = convertKeysToLowerCase(src); // result: { name: 'john', age: 30 }
- data (
-
mapObjectFields
function:This utility function applies provided
FieldMap
to an object.Parameters:
- data (
any
) - The source object to be mapped. - mapping (
FieldMap<R extends unknown>
) - The object mapping.
Returns a new object with all properties transformed based on the mapping.
Example:
interface SomeType { uuid: string, username: string, age: number, } const obj = {_userid: 123, nickname: 'johndoe1', yearsold: 30}; const mapping: FieldMap<SomeType> = { _userid: 'uuid', nickname: 'username', yearsold: 'age' }; const result = mapObjectFields(obj, mapping); // result: { uuid: 123, username: 'johndoe1', age: 30 }
- data (