Skip to content
Pterodactyl Panel API SDK for PHP (For Pterodactyl 0.7.x)
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
src Add updateServerDetails, Build and Startup Jul 8, 2019
.gitignore add ability to use servers as a user May 17, 2018 Update Jan 29, 2019 Merge branch 'master' of Jul 8, 2019
composer.json Update composer.json Mar 6, 2019

Pterodactyl PHP SDK

Latest Version on Packagist Total Downloads Software License Chat on Gitter Coverage


As we are upgrading it to support version 0.7.x, some APIs are still not integrated, and we can't guarantee that there are no bugs. You can see a list that what we completed and planned below. Unless you already know the possible consequences, don't use it in production.

ToDo List

The following ticked items are upgraded & tested.


All done, you can see available functions below.


All done, you can see available functions below.


  • $pterodactyl->nodes();
  • $pterodactyl->node($nodeId);
  • $pterodactyl->createNode(array $data);
  • $pterodactyl->updateNode($nodeId, array $data);
  • $pterodactyl->deleteNode($nodeId);

Node Instance

  • $node->update(array $data);
  • $node->delete();


To install the SDK in your project you need to require the package via composer:

composer require hcgcloud/pterodactyl-sdk:dev-master

Then use Composer's autoload unless you are using a framework that support composer autoload:

require __DIR__.'/../vendor/autoload.php';

And finally create an instance of the SDK:

$pterodactyl = new \HCGCloud\Pterodactyl\Pterodactyl(API_KEY_HERE, BASE_URI_HERE);


Using the pterodactyl instance you may perform multiple actions as well as retrieve the different resources Pterodactyl's API provides:

$servers = $pterodactyl->servers();

This will give you an array of servers that you have access to, each server is represented by an instance of HCGCloud\Pterodactyl\Resources\Server, this instance has multiple public properties like $name, $id, $owner, $memory, and others.

You may also retrieve a single server using:

$server = $pterodactyl->server(SERVER_ID_HERE);

On multiple actions supported by this SDK you may need to pass some parameters, for example when creating a new server:

$egg = $pterodactyl->egg($nest_id, $egg_id);
$server = $pterodactyl->createServer([
    "external_id" => $external_id,
    "name" => $name,
    "user" => $user_id,
    "egg" => $egg_id,
    "pack" => 0,
    "docker_image" => $egg->dockerImage,
    "skip_scripts" => false,
    "environment" => [],
    "limits" => [
        "memory" => $memory,
        "swap" => $swap,
        "disk" => $disk,
        "io" => $io,
        "cpu" => $cpu
    "feature_limits" => [
        "databases" => $databases,
        "allocations" => $allocations
    "startup" => $egg->startup,
    "description" => "",
    "deploy" => [
        "locations" => [$location_id],
        "dedicated_ip" => false,
        "port_range" => []
    "start_on_completion" => true

These parameters will be used in the POST request sent to Pterodactyl servers, you can find more information about the parameters needed in panel source: app\Http\Requests\Api\Application\Servers\StoreServerRequest.php

Notice that this request for example will only start the server creation process, your server might need a few minutes before it completes provisioning, you'll need to check the Server's $installed property to know if it's ready or not yet.

Or use the following code to create a new user:

$user = $pterodactyl->createUser([
    "external_id" => "2", //Optional
    "email" => '',
    "username" => 'TestUser',
    "first_name" => 'Test',
    "last_name" => 'User',
    "language" => 'en',
    "password" => '123456'

Managing Users

$pterodactyl->createUser(array $data);
$pterodactyl->updateUser($userId, array $data);

On a User instance you may also call:

$user->update(array $data);

Managing Servers

//Works with Application API
$pterodactyl->createServer(array $data);
$pterodactyl->updateServerDetails($serverId, array $data);
$pterodactyl->updateServerBuild($serverId, array $data);
$pterodactyl->updateServerStartup($serverId, array $data);

//Works with Account API
//Please note that the following $serverIdentifier is not same as $serverId, it is a short version of server UUID.
$pterodactyl->powerServer($serverIdentifier, $action); //'start', 'stop', 'restart', 'kill'
$pterodactyl->commandServer($serverIdentifier, $command);

On a Server instance you may also call:

//Works with Application API
$server->updateDetails(array $data);
$server->updateBuild(array $data);
$server->updateStartup(array $data);

//Works with Account API
$server->power($action); //'start', 'stop', 'restart', 'kill

Managing Nests


Managing Eggs

$pterodactyl->egg($nestId, $eggId);


hcgcloud/pterodactyl-sdk is licensed under the MIT License (MIT). Please see the license file for more information.

You can’t perform that action at this time.