Class: Client


# Class: Client

# Constructors

# constructor

+ new Client(key: string, options?: ClientOptions): Client

Create a new instance of the API client.

# Parameters:

Name Type Description
key string Your Hypixel API key.
options? ClientOptions Any options and customizations being applied.

Returns: Client

Defined in: Client.ts:190 (opens new window)

# API Properties

# findGuild

findGuild: FindGuild

Returns the id of the requested guild if found.

example

const { guild } = await client.findGuild.byUuid("20934ef9488c465180a78f861586b4cf");
console.log(guild);
// 553490650cf26f12ae5bac8f
1
2
3

Defined in: Client.ts:260 (opens new window)


# friends

friends: Friends

Returns friendships for given player.

example

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

Defined in: Client.ts:271 (opens new window)


# guild

guild: Guild

Returns the guild by the requested ID if found.

example

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

Defined in: Client.ts:299 (opens new window)


# 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

Defined in: Client.ts:346 (opens new window)


# 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

Defined in: Client.ts:375 (opens new window)


# resources

resources: Resources

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

Defined in: Client.ts:381 (opens new window)


# skyblock

skyblock: SkyBlock

All SkyBlock related endpoints.

Defined in: Client.ts:387 (opens new window)


# 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

Defined in: Client.ts:398 (opens new window)

# API Methods

# boosters

boosters(): Promise<ResultObject<$200, [success]>>

Returns list of boosters.

example

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

Returns: Promise<ResultObject<$200, [success]>>

Defined in: Client.ts:241 (opens new window)


# gameCounts

gameCounts(): Promise<ResultObject<$200, [success]>>

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

example

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

Returns: Promise<ResultObject<$200, [success]>>

Defined in: Client.ts:282 (opens new window)


# key

key(): Promise<ResultObject<$200, [record]>>

Returns information regarding given key.

example

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

Returns: Promise<ResultObject<$200, [record]>>

Defined in: Client.ts:310 (opens new window)


# leaderboards

leaderboards(): Promise<ResultObject<$200, [leaderboards]>>

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

example

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

Returns: Promise<ResultObject<$200, [leaderboards]>>

Defined in: Client.ts:328 (opens new window)


# playerCount

playerCount(): Promise<ResultObject<$200, [success]>>

Returns current player count.

example

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

Returns: Promise<ResultObject<$200, [success]>>

Defined in: Client.ts:357 (opens new window)


# watchdogstats

watchdogstats(): Promise<ResultObject<$200, [success]>>

Returns some statistics about Watchdog & bans.

example

const response = await client.watchdogstats();
console.log(response);
// {
//   watchdog_lastMinute: 1,
//   staff_rollingDaily: 3014,
//   watchdog_total: 5589923,
//   watchdog_rollingDaily: 4662,
//   staff_total: 1874174
// }
1
2
3
4
5
6
7
8
9

Returns: Promise<ResultObject<$200, [success]>>

Defined in: Client.ts:416 (opens new window)


# Events Methods

# off

off(event: limited, listener: () => void): Client

Remove your function listening to the "limited" event.

# Parameters:

Name Type
event limited
listener () => void

Returns: Client

Defined in: Client.ts:158 (opens new window)

off(event: reset, listener: () => void): Client

Remove your function listening to the "reset" event.

# Parameters:

Name Type
event reset
listener () => void

Returns: Client

Defined in: Client.ts:164 (opens new window)

off<E>(event: E, listener: ClientEvents[E]): Client

# Type parameters:

Name Type
E keyof ClientEvents

# Parameters:

Name Type
event E
listener ClientEvents[E]

Returns: Client

Defined in: Client.ts:224 (opens new window)


# on

on(event: limited, listener: (limit: number, reset: Date) => void): Client

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

# Parameters:

Name Type
event limited
listener (limit: number, reset: Date) => void

Returns: Client

Defined in: Client.ts:134 (opens new window)

on(event: reset, listener: () => void): Client

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

# Parameters:

Name Type
event reset
listener () => void

Returns: Client

Defined in: Client.ts:140 (opens new window)

on<E>(event: E, listener: ClientEvents[E]): Client

# Type parameters:

Name Type
E keyof ClientEvents

# Parameters:

Name Type
event E
listener ClientEvents[E]

Returns: Client

Defined in: Client.ts:208 (opens new window)


# once

once(event: limited, listener: (limit: number, reset: Date) => void): Client

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

# Parameters:

Name Type
event limited
listener (limit: number, reset: Date) => void

Returns: Client

Defined in: Client.ts:146 (opens new window)

once(event: reset, listener: () => void): Client

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

# Parameters:

Name Type
event reset
listener () => void

Returns: Client

Defined in: Client.ts:152 (opens new window)

once<E>(event: E, listener: ClientEvents[E]): Client

# Type parameters:

Name Type
E keyof ClientEvents

# Parameters:

Name Type
event E
listener ClientEvents[E]

Returns: Client

Defined in: Client.ts:216 (opens new window)


# Custom Methods

# call

call<T>(path: string, parameters?: Parameters): Promise<T & { cached?: boolean }>

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

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

# Type parameters:

Name Type Description
T ApiSuccess 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:

Name Type Description
path string The path on the method you want to query.
parameters Parameters Any search parameters you want to use.

Returns: Promise<T & { cached?: boolean }>

Defined in: Client.ts:440 (opens new window)