Class: Client


# Class: Client

The main API client, instantiate it with your API key.

# Example

import { Client as HypixelClient } from "@zikeji/hypixel";
const client = new HypixelClient("legit-api-key-heye");
1
2

# Constructors

# new Client()

new Client(key, options?): Client

Create a new instance of the API client.

# Parameters

key: string

Your Hypixel API key.

options?: ClientOptions

Any options and customizations being applied.

# Returns

Client

# API

# guild

guild: Guild

Returns the guild by the requested ID if found.

# Example

const guild = await client.guild.id("553490650cf26f12ae5bac8f");
1

# housing

housing: Housing

Return's housing data, such as active public houses.

# Example

const housingData = await client.housing.active();
console.log(housingData);
1
2

# player

player: Player

Returns a player's data, such as game stats.

# Example

const player = await client.player.uuid("20934ef9488c465180a78f861586b4cf");
console.log(player);
1
2

# recentgames

recentgames: Recentgames

Returns recent games of a player. A maximum of 100 games are returned and recent games are only stored for up to 3 days at this time.

# Example

const response = await client.recentgames.uuid("20934ef9488c465180a78f861586b4cf");
console.log(response);
1
2

# resources

resources: Resources

Relatively static Hypixel resources that don't change often at all.


# skyblock

skyblock: SkyBlock

All SkyBlock related endpoints.


# status

status: Status

Returns online status information for given player, including game, mode and map when available.

# Example

const response = await client.status.uuid("20934ef9488c465180a78f861586b4cf");
console.log(response);
1
2

# boosters()

boosters(): Promise<ResultObject<BoostersResponse, ["success"]>>

Returns list of boosters.

# Returns

Promise<ResultObject<BoostersResponse, ["success"]>>

# Example

const boosters = await client.boosters();
console.log(boosters);
1
2

# counts()

counts(): Promise<ResultObject<CountsResponse, ["success"]>>

Returns the current player count along with the player count of each public game + mode on the server.

# Returns

Promise<ResultObject<CountsResponse, ["success"]>>

# Example

const response = await client.counts();
console.log(response);
1
2

# leaderboards()

leaderboards(): Promise<object>

Returns a list of the official leaderboards and their current standings for games on the network.

# Returns

Promise<object>

# meta

meta: OmitRespectingRemapping<LeaderboardsResponse, "leaderboards"> & DefaultMeta

# Example

const leaderboards = await client.leaderboards();
console.log(leaderboards);
1
2

# punishmentstats()

punishmentstats(): Promise<ResultObject<PunishmentStatsResponse, ["success"]>>

Returns some statistics about punishments.

# Returns

Promise<ResultObject<PunishmentStatsResponse, ["success"]>>

# Example

const response = await client.punishmentstats();
console.log(response);
1
2

# Events

# off()

# off(event, listener)

off(event, listener): this

Remove your function listening to the "limited" event.

# Parameters

event: "limited"

listener

# Returns

this

# off(event, listener)

off(event, listener): this

Remove your function listening to the "reset" event.

# Parameters

event: "reset"

listener

# Returns

this

# off(event, listener)

off<E>(event, listener): this

# Type Parameters

E extends keyof ClientEvents

# Parameters

event: E

listener: ClientEvents[E]

# Returns

this


# on()

# on(event, listener)

on(event, listener): this

Listen to the "limited" event which emits when the client starts limiting your calls due to hitting the rate limit.

# Parameters

event: "limited"

listener

# Returns

this

# on(event, listener)

on(event, listener): this

Listen to the "reset" event which emits when the API rate limit resets.

# Parameters

event: "reset"

listener

# Returns

this

# on(event, listener)

on<E>(event, listener): this

# Type Parameters

E extends keyof ClientEvents

# Parameters

event: E

listener: ClientEvents[E]

# Returns

this


# once()

# once(event, listener)

once(event, listener): this

Listen once to the "limited" event which emits when the client starts limiting your calls due to hitting the rate limit.

# Parameters

event: "limited"

listener

# Returns

this

# once(event, listener)

once(event, listener): this

Listen once to the "reset" event which emits when the API rate limit resets.

# Parameters

event: "reset"

listener

# Returns

this

# once(event, listener)

once<E>(event, listener): this

# Type Parameters

E extends keyof ClientEvents

# Parameters

event: E

listener: ClientEvents[E]

# Returns

this

# Custom

# call()

call<T>(path, parameters): Promise<T & DefaultMeta & object>

The raw query method used by this library. You may use this if you need to use an undocumented method with this library.

# Type Parameters

T extends Record<string, unknown>

As all of Hypixel's API methods return a basic { success: boolean; cause?: string; }, this type parameter (if using Typescript) extends an interface including those.

# Parameters

path: string

The path on the method you want to query.

parameters: Parameters = {}

Any search parameters you want to use.

# Returns

Promise<T & DefaultMeta & object>

# Example

Getting the ID of a guild using the findGuild (opens new window) method.

const response = await client.call("findGuild", { byName: "Mini Squid" });
console.log(response);
// { success: true, guild: '553490650cf26f12ae5bac8f' }
1
2
3