Skip to content

Pterodactyl API ​

GamePanel answers two of Pterodactyl's APIs in Pterodactyl's format, so tools written for Pterodactyl work with GamePanel:

  • the client API (/api/client), used by Discord bots, mobile apps and scripts, with any GamePanel API key;
  • the application API (/api/application), the part billing modules use (WHMCS, Paymenter, Blesta), with an administrator's API key.

Point the tool at your panel's address and give it a GamePanel key (gp_...) where it asks for a Pterodactyl key. After an import, the Pterodactyl keys people had (ptlc_..., ptla_...) keep working too. Errors come back in Pterodactyl's error format ({"errors":[{"code":"…","status":"422","detail":"…"}]}); refused fields name themselves in meta.source_field, as Pterodactyl's ValidationException does.

Client API ​

EndpointNotes
GET /api/client/accountusername is the part of the email before @; first and last name are empty
GET /api/clientYour servers
GET /api/client/servers/{id}Details, limits, feature limits, ports
GET /api/client/servers/{id}/resourcesLive usage and state
POST /api/client/servers/{id}/powerstart, stop, restart, kill
POST /api/client/servers/{id}/commandSend a console command
GET /api/client/servers/{id}/files/listList a folder
GET /api/client/servers/{id}/files/contentsRead a file
POST /api/client/servers/{id}/files/writeWrite a file
GET /api/client/servers/{id}/backupsList backups

{id} is the server's identifier (the first 8 characters of its UUID) or the full UUID. States map to Pterodactyl's four: starting, running and stopping as they are, everything else as offline.

The same permissions apply as anywhere else: a subuser's key can only do what that subuser may.

Application API ​

For billing modules. It takes an administrator's API key (Account → API keys while signed in as an admin), never a browser session; a customer's key gets 403. Everything it does goes through the same code as GamePanel's own shop API: the node is told, the activity log records it under the key's account, and webhooks fire.

Setting up a billing module ​

ModuleWhereWhat to enter
WHMCS (pterodactyl/whmcs)Products/Services → ServersHostname: your panel's host name; Password: the admin API key; tick "Secure" for HTTPS
Paymenter (Pterodactyl extension)Extensions → PterodactylHost: https://panel.example.com; API key: the admin API key
Blesta (module-pterodactyl)Modules → Pterodactyl → Add serverHost name; Application API key: the admin API key; Account API key: any GamePanel key (it only checks it)

Then set up products as for Pterodactyl: pick a location, a nest and an egg, and the limits. Before that:

  1. Make a location and put your nodes in it (Nodes → a node's settings → Location, or POST /api/locations). Modules deploy into a location; GamePanel then picks the online node there with the most free memory.
  2. Import your eggs (Eggs → Import). Every egg is in nest 1.

Links the module shows customers (/server/<identifier>) open the server in GamePanel.

Endpoints ​

EndpointNotes
GET /api/application/usersfilter[email], filter[external_id]; paginated (page, per_page)
GET /api/application/users/{id}, …/users/external/{external_id}404 when there is none
POST /api/application/usersemail, external_id, password (optional). username, first_name and last_name are accepted and not kept
PATCH /api/application/users/{id}Email, external id, password
DELETE /api/application/users/{id}Refused while the account owns servers
GET /api/application/serversfilter[external_id], filter[uuid], filter[uuidShort], filter[name]; include=allocations
GET /api/application/servers/{id}, …/servers/external/{external_id}
POST /api/application/serversdeploy (locations, port range) or allocation (default, additional); 201
PATCH /api/application/servers/{id}/detailsName, description, owner (user), external id
PATCH /api/application/servers/{id}/buildLimits, feature limits, primary allocation, add_allocations, remove_allocations
PATCH /api/application/servers/{id}/startupVariables, image, startup command
POST /api/application/servers/{id}/suspend, …/unsuspend204
POST /api/application/servers/{id}/reinstall204
DELETE /api/application/servers/{id}, …/{id}/forceforce also deletes a server whose node is offline
GET /api/application/nodes, …/nodes/{id}
GET /api/application/nodes/deployablememory, disk, location_ids[]; online nodes with room. include=allocations lists up to 1,000 ports each
GET /api/application/nodes/{id}/allocationsThe node's port range, the ones in use assigned
GET, POST /api/application/locations; GET, PATCH, DELETE …/locations/{id}A location with nodes cannot be deleted
GET /api/application/nests, …/nests/{id}One nest, id 1
GET /api/application/nests/{nest}/eggs, …/eggs/{egg}; GET /api/application/eggs, …/eggs/{egg}include=variables

Numbers may be sent as JSON numbers or numeric strings, as Laravel accepts.

How it maps ​

PterodactylGamePanel
Server idA number each server gets when it is created. It is never reused, even after the server is deleted. Imported servers keep their Pterodactyl id.
Server identifierThe first 8 characters of the UUID
NestGamePanel has none: every egg is in nest 1, and the nest in a path (/nests/5/eggs/12) is not checked, so products made on Pterodactyl keep working
LocationA location. Imported ones keep their id.
AllocationA port in a node's range. Its id is node_id × 65536 + port; there are no allocation records to create first
limits.memoryMemory limit. 0 (unlimited) is refused: GamePanel always sets one, at least 64 MB
limits.swap, disk, cpu, threadsThe same (threads pins CPUs; leaving it out keeps the current pinning)
limits.ioNot used: current Wings does not apply it either, and a node without the io.weight controller would refuse to start the server
feature_limits.allocationsPorts in total, the primary one included
feature_limits.backupsAt least 1: GamePanel keeps one backup a server may have
feature_limits.databasesnull is 0
oom_disabled, skip_scripts, deploy.dedicated_ipAccepted and not used: the OOM killer stays on, the egg's install script always runs, and servers listen on every address
environmentValues for the egg's variables, checked against its rules. Names the egg does not have are ignored, as Pterodactyl does
A create whose external_id exists422 on external_id, as Pterodactyl answers (GamePanel's own API returns the existing server instead)
No node in the locations has room, or none is online400 NoViableNodeException

Two things are stricter than Pterodactyl, on purpose:

  • Passwords must pass GamePanel's password policy (12 characters or more, not a known leaked password). A new account whose password from the billing system is too weak is still made, without that password: the person gets an email with a link to choose one, as when no password is sent. Changing a password to a weak one is refused (422 on password).
  • Administrators' email and password cannot be changed through the API (403), and administrator rights cannot be given or taken (422 on root_admin): a leaked billing key must not be a way into the other admins' accounts.

Changing a server's egg (PATCH …/startup with another egg) is refused; create a new server instead.

Not supported ​

  • The rest of the client API (schedules, databases, subusers, network, startup, and the file actions not listed above).
  • The client websocket (/api/client/servers/{id}/websocket), so tools that stream the console from Pterodactyl will not.
  • The rest of the application API: database hosts, mounts, server databases and node configuration. Nodes and eggs are managed in GamePanel.

Released under the AGPL-3.0 license.