Creates a new server with the provided data.
The request data for creating the server.
A promise that resolves to the created server.
const newServer = await app.servers.create({
name: "My New Server",
user: 1,
egg: 5,
docker_image: "quay.io/pterodactyl/core:java",
startup: "java -Xms128M -Xmx{{SERVER_MEMORY}}M -jar {{SERVER_JARFILE}}",
environment: {
MINECRAFT_VERSION: "latest",
SERVER_JARFILE: "server.jar",
BUILD_NUMBER: "recommended"
},
limits: {
memory: 1024,
swap: 0,
disk: 2048,
io: 500,
cpu: 100,
oom_disabled: false
},
feature_limits: {
databases: 2,
allocations: 1,
backups: 5
},
allocation: {
default: 1
}
});
Deletes a server by its ID.
The request data containing the server ID.
A promise that resolves to a boolean indicating success.
Fetches a list of servers with optional sorting, filtering, and pagination.
Optionalsort: SortParametersOptional sorting parameters.
Optionalinclude: IncludeParameters[]Optional include parameters for related resources.
Optionalfilter: Record<FilterParameters, string>Optional filtering parameters.
Optionalpagination: PaginationOptionsOptional pagination options.
A promise that resolves to an array of server attributes.
Fetches a single server by its ID.
The request data containing the server ID.
Optionalinclude: IncludeParameters[]Optional include parameters for related resources.
A promise that resolves to the server attributes.
Reinstalls a server by its ID.
The request data containing the server ID and optional force flag.
A promise that resolves to the reinstalled server attributes.
Suspends a server by its ID.
The request data containing the server ID.
A promise that resolves to a boolean indicating success.
Unsuspends a server by its ID.
The request data containing the server ID.
A promise that resolves to a boolean indicating success.
Updates a server with the provided data.
The request data for updating the server.
A promise that resolves to the updated server attributes.
Updates a server's build configuration including resource limits and feature limits.
The request data for updating the server build.
A promise that resolves to the updated server attributes.
Updates a server's startup configuration including startup command and environment variables.
The request data for updating the server startup.
A promise that resolves to the updated server attributes.
const updatedServer = await ptero.servers.updateServerStartup({
id: 1,
startup: "java -Xms128M -Xmx{{SERVER_MEMORY}}M -jar {{SERVER_JARFILE}}",
environment: {
MINECRAFT_VERSION: "1.19.4",
SERVER_JARFILE: "server.jar",
BUILD_TYPE: "recommended"
},
egg: 5,
image: "quay.io/pterodactyl/core:java",
skip_scripts: false
});
console.log(updatedServer);
Module for accessing Pterodactyl servers endpoints. This module provides methods to access server details, create servers, update servers, etc.