Client¶
- class Client(host, key)¶
- Arguments
host – Where your panel is hosted (EG: http(s)://panel.host.net/)
Account¶
getAccountDetails()¶
- Client.getAccountDetails()¶
Gets the account details associated with this.hostUrl and this.hostKey
- Returns
Promise.<Object> –
getAccountPermissions()¶
- Client.getAccountPermissions()¶
Gets the permissions that this associated host and key have
- Returns
Promise.<unknown> –
updateEmail()¶
- Client.updateEmail(newEmail, currentPassword)¶
Updates the email for the specified host and API key
By default Pterodactyl API returns a empty string on success (“”), i altered the response to make it a boolean value of “true”
- Arguments
newEmail (String) –
currentPassword (String) –
- Returns
Promise.<Boolean> –
updatePassword()¶
- Client.updatePassword(newPassword, currentPassword)¶
Updates the password for the specified host and api key
By default Pterodactyl API returns a empty string on success (“”), i altered the response to make it a boolean value of “true”
- Arguments
newPassword (String) –
currentPassword (String) –
- Returns
Promise.<Boolean> –
Get Server Details¶
getServerDetails()¶
- Client.getServerDetails(serverId)¶
Gets a Server’s information NOTE: This does not return any live resource usages such as CPU, memory or RAM, but it will show the max limits of these values
- Arguments
serverId (String) –
- Returns
Promise.<unknown> –
getServerStatus()¶
- Client.getServerStatus(serverId)¶
Gets a server’s status, so whether it is running, starting or powered off
- Arguments
serverId (String) –
- Returns
Promise.<unknown> –
getAllServers()¶
- Client.getAllServers()¶
Gets a list of servers from your panel, currently this only get the first page but i will add support for grabbing ALL pages with this methods
- Returns
Promise.<unknown> –
getServerPage()¶
- Client.getServerPage(pageNum)¶
Gets a server by a specified page number
This will return an empty array if the specified page was invalid.
- Arguments
pageNum (Integer) –
- Returns
Promise.<unknown> –
getServerUsages()¶
- Client.getServerUsages(serverId)¶
gets a servers current memory/cpu/disk usages as bytes
- Arguments
serverId (String) –
- Returns
Promise.<unknown> –
getConsoleWebSocket()¶
- Client.getConsoleWebSocket(serverId)¶
Gets the Console WebSocket instance for a server you will ne to establish your own socket connection for now (try socket.io)
- Arguments
serverId (String) –
- Returns
Promise.<unknown> –
Server Actions¶
startServer()¶
- Client.startServer(serverId)¶
Starts a server if the host and api key have permission By default Pterodactyl API returns a empty string on success (“”), i altered the response to make it a boolean value of “true”
- Arguments
serverId (String) –
- Returns
Promise.<Boolean> –
restartServer()¶
- Client.restartServer(serverId)¶
Restarts a server if the host and api key have permission By default Pterodactyl API returns a empty string on success (“”), i altered the response to make it a boolean value of “true”
- Arguments
serverId (String) –
- Returns
Promise.<Boolean> –
stopServer()¶
- Client.stopServer(serverId)¶
Stops a server if the host and api key have permission By default Pterodactyl API returns a empty string on success (“”), i altered the response to make it a boolean value of “true”
- Arguments
serverId (String) –
- Returns
Promise.<Boolean> –
killServer()¶
- Client.killServer(serverId)¶
Kills a server if the host and api key have permission By default Pterodactyl API returns a empty string on success (“”), i altered the response to make it a boolean value of “true”
- Arguments
serverId (String) –
- Returns
Promise.<Boolean> –
sendServerCommand()¶
- Client.sendServerCommand(serverId, command)¶
sends a command to a server if the host and api key have permission By default Pterodactyl API returns a empty string on success (“”), i altered the response to make it a boolean value of “true”
- Arguments
serverId (String) –
command (String) –
- Returns
Promise.<Boolean> –
renameServer()¶
- Client.renameServer(serverId, newName)¶
Renames the target server
- Arguments
serverId (String) –
newName (String) –
- Returns
Promise.<Boolean> –
reInstallServer()¶
- Client.reInstallServer(serverId)¶
ReInstalls a target server
- Arguments
serverId (String) –
- Returns
Promise.<Boolean> –
createSubUser()¶
- Client.createSubUser(serverId, email, permissions)¶
Create subuser on a server
- Arguments
serverId (String) –
email (String) –
permissions (Array) –
- Returns
Promise.<unknown> –
createApiKey()¶
- Client.createApiKey(description, allowedIps)¶
Creates an API key with specified host and api key. tbh this feels pretty useless as the key i received from this request gave me a 403, i will not provide support for this command. REPEAT: WILL NOT PROVIDE SUPPORT FOR THIS COMMAND!!!!!! Make sure to read that previous line ^
- Arguments
description (String) –
allowedIps (Array) –
- Returns
Promise.<unknown> –
deleteApiKey()¶
- Client.deleteApiKey(keyId)¶
Deletes a specified API key. Only use the API key identifier provided to you on the panel
By default Pterodactyl API returns a empty string on success (“”), i altered the response to make it a boolean value of “true” However do not this value will NEVER be false. To catch an error for this request you check if the caught error === 404, this will mean the provided API key was non existing.
- Arguments
keyId (Integer) –
- Returns
Promise.<Boolean> –
Server Backups¶
listServerBackups()¶
- Client.listServerBackups(serverId)¶
Lists what backups a server has
- Arguments
serverId (String) –
- Returns
Promise.<Array> –
createServerBackup()¶
- Client.createServerBackup(serverId)¶
Creates a backup for a specified server
This will send a error code 924 when trying to create 2 backups within a 10 minute time frame Stay tuned for what error this returns when the max amount of backups have been created
- Arguments
serverId (String) –
- Returns
Promise.<Object> –