# Application

# class NodeactylApplication(host, key)

Main class constructor

Parameters

  • host - Where your panel is hosted (EG: http(s)://panel.host.net/)
  • key

# function getAllUsers(Page)

Gets a list of users from your panel

Parameters

  • Page (Integer) - number

Returns

  • (Promise)

# function getUserDetails(userId)

Gets details of a user

Parameters

  • userId (Integer)

Returns

  • (Promise)

# function getUserByUsername(username)

Gets details of a user by username

Parameters

  • username (String)

Returns

  • (Promise)

# function getUserByEmail(email)

Gets details of a user

Parameters

  • email (String)

Returns

  • (Promise)

# function getUserPage(pageNum)

Gets users by a specified page number This will return an empty array if the specified page was invalid.

Parameters

  • pageNum

Returns

  • (Promise)

# function createUser(Email, Username, FirstName, LastName, Password)

Creates a user

Parameters

  • Email (String) - Users email
  • Username (String) - Users username
  • FirstName (String) - Users first name
  • LastName (String) - Users last name
  • Password (String) - Users password (optional)

Returns

  • (Promise)

# function updateUserDetails(userId, Email, Username, FirstName, LastName, Language, Password)

Updates a users details

Parameters

  • userId (Integer)
  • Email (String)
  • Username (String)
  • FirstName (String)
  • LastName (String)
  • Language (String)
  • Password (String)

Returns

  • (Promise)

# function createServer(Version, NameOfServer, OwnerID, EggID, DockerImage, StartupCmd, RAM, Swap, Disk, IO, CPU, AmountOfDatabases, AmountOfBackups, AmountOfAllocations)

Creates a server !! DEPRECATED !!

Parameters

  • Version (String) - Version of the server to use
  • NameOfServer (String) - Name of server to create
  • OwnerID (Integer) - User ID of who should own this server
  • EggID (Integer) - Egg ID to use when installing the server
  • DockerImage (String) - The image to use from Docker
  • StartupCmd (String) - The command to use when starting this server (AKA JVM Arguments)
  • RAM (Integer) - The amount of RAM the server has
  • Swap (Integer) - The amount of Swap the server has
  • Disk (Integer) - The amount of Storage the server has
  • IO (Integer) - Set this to 500 please. (Even if you know what it is leave it alone)
  • CPU (Integer) - The amount of CPU Power the server can use (100 = 1 core);
  • AmountOfDatabases (Integer) - The max amount of databases a server can use
  • AmountOfBackups (Integer) - The max backups you can hold
  • AmountOfAllocations (Integer) - The max amount of allocation(s) a server can us

Returns

  • (Promise)

# function createRawServer(object)

Creates a server using a raw JSON object

Parameters

  • object

Returns

  • (Promise)

# function createSimpleServer(OwnerID, EggID, RAM, Disk, CPU, AmountOfDatabases, AmountOfBackups, AmountOfAllocations)

Creates a server

Parameters

  • OwnerID (Integer) - User ID of who should own this server
  • EggID (Integer) - Egg ID to use when installing the server
  • RAM (Integer) - The amount of RAM the server has
  • Disk (Integer) - The amount of Storage the server has
  • CPU (Integer) - The amount of CPU Power the server can use (100 = 1 core);
  • AmountOfDatabases (Integer) - The max amount of databases a server can use
  • AmountOfBackups (Integer) - The max backups you can hold
  • AmountOfAllocations (Integer) - The max amount of allocation(s) a server can us

Returns

  • (Promise)

# function 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)

# function getServerPage(pageNum)

Gets servers by a specified page number This will return an empty array if the specified page was invalid.

Parameters

  • pageNum (Integer)

Returns

  • (Promise)

# function getServerDetails(serverId)

Gets a info of a server from your panel

Parameters

  • serverId (Integer)

Returns

  • (Promise)

# function deleteUser(userId)

Deletes a specified user 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. MUST USE ClientAPI Key!!! Application API Keys NO LONGER WORK with ANY Pterodactyl version 1 and above!

Parameters

  • userId

Returns

  • (Promise)

# function suspendServer(serverId)

Suspend 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"

Parameters

  • serverId (Integer)

Returns

  • (Promise)

# function unsuspendServer(serverId)

Unsuspend 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"

Parameters

  • serverId (Integer)

Returns

  • (Promise)

# function reinstallServer(serverId)

Reinstall 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"

Parameters

  • serverId (Integer)

Returns

  • (Promise)

# function updateServerDetails(serverId, Name, userId, externalId, Description)

UpdateServerDetails By default Pterodactyl API returns a empty string on success (""), i altered the response to make it a boolean value of "true"

Parameters

  • serverId (Integer)
  • Name (String)
  • userId (Integer)
  • externalId (Integer)
  • Description (String)

Returns

  • (Promise)

# function updateServerBuild(serverId, AllocationID, RAM, Swap, IO, CPU, Disk, Threads, AmountOfDatabases, AmountOfBackups, AmountOfAllocations)

UpdateServerBuild By default Pterodactyl API returns a empty string on success (""), i altered the response to make it a boolean value of "true"

Parameters

  • serverId (Integer)
  • AllocationID (Integer)
  • RAM (Integer)
  • Swap (Integer)
  • IO (Integer)
  • CPU (Integer)
  • Disk (Integer)
  • Threads (Integer)
  • AmountOfDatabases (Integer)
  • AmountOfBackups (Integer)
  • AmountOfAllocations (Integer)

Returns

  • (Promise)

# function updateServerStartup(serverId, StartupCmd, Environment, Egg, DockerImage, SkipScripts)

UpdateServerStartup This update the startup details for a specified server

Parameters

  • serverId - ID of serer
  • StartupCmd - new startup command to use for this server
  • Environment - The environment object for this server to use
  • Egg - Egg ID for this serer to use
  • DockerImage - Docker Image for this serer
  • SkipScripts - Do you want to skip scripts? (have no idea what this is)

Returns

  • (Promise)

# function deleteServer(serverId)

Deletes a specified server 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. MUST USE ClientAPI Key!!! Application API Keys NO LONGER WORK with ANY Pterodactyl version 1 and above!

Parameters

  • serverId

Returns

  • (Promise)

# function getNestDetails(nestId)

Gets details of a nest

Parameters

  • nestId (Integer)

Returns

  • (Promise)

# function getAllLocations()

Get all locations from your panel

Returns

  • (Promise)

# function getLocationPage(pageNum)

Gets locations by a specified page number This will return an empty array if the specified page was invalid.

Parameters

  • pageNum (Integer)

Returns

  • (Promise)

# function getLocationDetails(locationId)

Gets a info of a location from your panel

Parameters

  • locationId (Integer)

Returns

  • (Promise)

# function createLocation(short, long)

Creates a new location

Parameters

  • short (String) - Identifier for the location Ex: GB
  • long (String) - Descrption for the location Ex: London Datacenter

Returns

  • (Promise)

# function updateLocationDetails(locationId, short, long)

Updates the short or long location details

Parameters

  • locationId (Integer)
  • short (String) - Identifier for the location Ex: GB
  • long (String) - Descrption for the location Ex: London Datacenter

Returns

  • (Promise)

# function deleteLocation(locationId)

Deletes a specified location 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.

Parameters

  • locationId

Returns

  • (Promise)

# function getAllNodes()

Get all nodes from your panel

Returns

  • (Promise)

# function getNodePage(pageNum)

Gets nodes by a specified page number This will return an empty array if the specified page was invalid.

Parameters

  • pageNum (Integer)

Returns

  • (Promise)

# function getNodeDetails(nodeId)

Gets info of a node from your panel

Parameters

  • nodeId (Integer) - the id oftthe node to get the details of

Returns

  • (Promise)

# function getNodeConfig(nodeId)

Gets the configuration of given node

Parameters

  • nodeId (Integer) - the id of the node to get the config for

Returns

  • (Promise)

# function createNode(name, locationId, fqdn, memory, disk)

Creates a new node

Parameters

  • name (String) - name of the new node
  • locationId (Integer) - the id of the location to assign to this node
  • fqdn (String) - the Fully Qualified Domain Name (or IP) for this node
  • memory (Integer) - the amount of memory/ram this node has
  • disk (Integer) - The amount of storage this node has

Returns

  • (Promise)

# function updateNodeDetails(nodeId, name, description, locationId, fqdn, scheme, behindProxy, maintenanceMode, memory, memoryOver, disk, diskOver, uploadSize, daemonSftp, daemonListen)

Updates the details of the given node

Parameters

  • nodeId (Integer) - id of the node to update
  • name (String) - name of the node
  • description (String) - description of the node
  • locationId (String) - id of the location this node belongs to
  • fqdn (String) - Fully Qualified Domain Name for node
  • scheme (String) - scheme for node
  • behindProxy (Boolean) - whether or not node is behind proxy like cloudflare
  • maintenanceMode (Boolean) - whether or not the node is under maintenance
  • memory (Integer) - memory of node
  • memoryOver (Integer) - % of memory allowed to go over limit
  • disk (Integer) - disk space of the node
  • diskOver (Integer) - % of disk allowed to go over limit
  • uploadSize (Integer) - max uploadSize, usually 100
  • daemonSftp (Integer) - port for sftp
  • daemonListen (Integer) - port for daemon to listen on

Returns

  • (Promise)

# function deleteNode(nodeId)

Deletes a specified node 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.

Parameters

  • nodeId (Integer) - the id of the node to delete

Returns

  • (Promise)

# function getNodeAllocations(nodeId)

Gets the allocations of given node

Parameters

  • nodeId (Integer) - the id of the node to get the allocations of

Returns

  • (Promise)

# function createNodeAllocations(nodeId, ip, ports)

Create allocations on given node 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.

Parameters

  • nodeId (Integer) - the id of the node to add allocations to
  • ip (String) - the ip of the allocation as a string Ex: "127.0.0.1"
  • ports (Array) - an array of ports as strings Ex: ["25565", "25575"]

Returns

  • (Promise)

# function deleteNodeAllocation(nodeId, allocationId)

Deletes a specified node allocation 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.

Parameters

  • nodeId (Integer) - the id of the node to delete the allocation on
  • allocationId (Integer) - the id of the allocation to delete

Returns

  • (Promise)
Last Updated: 9/5/2021, 2:10:36 PM