Skip to content

@zikeji/hypixel / Client

Class: Client ​

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

Example ​

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

Constructors ​

Constructor ​

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

Properties ​

API ​

guild ​

guild: Guild

Returns the guild by the requested ID if found.

Example ​
typescript
const guild = await client.guild.id("553490650cf26f12ae5bac8f");

housing ​

housing: Housing

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

Example ​
typescript
const housingData = await client.housing.active();
console.log(housingData);

player ​

player: Player

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

Example ​
typescript
const player = await client.player.uuid("20934ef9488c465180a78f861586b4cf");
console.log(player);

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 ​
typescript
const response = await client.recentgames.uuid("20934ef9488c465180a78f861586b4cf");
console.log(response);

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 ​
typescript
const response = await client.status.uuid("20934ef9488c465180a78f861586b4cf");
console.log(response);

Methods ​

API ​

boosters() ​

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

Returns list of boosters.

Returns ​

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

Example ​
typescript
const boosters = await client.boosters();
console.log(boosters);

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 ​
typescript
const response = await client.counts();
console.log(response);

leaderboards() ​

leaderboards(): Promise<object & object>

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

Returns ​

Promise<object & object>

Example ​
typescript
const leaderboards = await client.leaderboards();
console.log(leaderboards);

punishmentstats() ​

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

Returns some statistics about punishments.

Returns ​

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

Example ​
typescript
const response = await client.punishmentstats();
console.log(response);

Events ​

off() ​

Call Signature ​

off(event, listener): this

Remove your function listening to the "limited" event.

Parameters ​
event ​

"limited"

listener ​

() => void

Returns ​

this

Call Signature ​

off(event, listener): this

Remove your function listening to the "reset" event.

Parameters ​
event ​

"reset"

listener ​

() => void

Returns ​

this

Call Signature ​

off<E>(event, listener): this

Remove your function listening to the "limited" event.

Type Parameters ​
E ​

E extends keyof ClientEvents

Parameters ​
event ​

E

listener ​

ClientEvents[E]

Returns ​

this


on() ​

Call Signature ​

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 ​

(limit, reset) => void

Returns ​

this

Call Signature ​

on(event, listener): this

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

Parameters ​
event ​

"reset"

listener ​

() => void

Returns ​

this

Call Signature ​

on<E>(event, listener): this

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

Type Parameters ​
E ​

E extends keyof ClientEvents

Parameters ​
event ​

E

listener ​

ClientEvents[E]

Returns ​

this


once() ​

Call Signature ​

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 ​

(limit, reset) => void

Returns ​

this

Call Signature ​

once(event, listener): this

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

Parameters ​
event ​

"reset"

listener ​

() => void

Returns ​

this

Call Signature ​

once<E>(event, listener): this

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

Type Parameters ​
E ​

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 ​

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 method.

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

Released under the MIT License.