### Client API Example Source: https://github.com/ajdindev/pterodactyl-api-docs/blob/main/docs/authentication.md Get a list of servers for the authenticated user using a Client API key. ```bash # Get list of servers for the authenticated user curl "https://your-panel.com/api/client" \ -H "Authorization: Bearer ptlc_1234567890abcdef" \ -H "Content-Type: application/json" \ -H "Accept: Application/vnd.pterodactyl.v1+json" ``` -------------------------------- ### Example Response for Get Startup Configuration Source: https://github.com/ajdindev/pterodactyl-api-docs/blob/main/docs/api/client/servers.md Example JSON response from the GET /api/client/servers/{server}/startup endpoint. Contains a list of egg variables and metadata including startup command and available Docker images. ```json { "object": "list", "data": [ { "object": "egg_variable", "attributes": { "name": "Server Jar File", "description": "The name of the server jarfile to run the server with.", "env_variable": "SERVER_JARFILE", "default_value": "server.jar", "server_value": "server.jar", "is_editable": true, "rules": "required|regex:/^([\\w\\d._-]+)(\\.jar)$/" } }, { "object": "egg_variable", "attributes": { "name": "Server Version", "description": "The version of Minecraft to download and use.", "env_variable": "MINECRAFT_VERSION", "default_value": "latest", "server_value": "1.19.4", "is_editable": true, "rules": "required|string|between:1,20" } } ], "meta": { "startup_command": "java -Xms128M -Xmx{{SERVER_MEMORY}}M -jar {{SERVER_JARFILE}}", "raw_startup_command": "java -Xms128M -Xmx1024M -jar server.jar", "docker_images": { "ghcr.io/pterodactyl/yolks:java_17": "Java 17", "ghcr.io/pterodactyl/yolks:java_11": "Java 11", "ghcr.io/pterodactyl/yolks:java_8": "Java 8" } } } ``` -------------------------------- ### Application API Example Source: https://github.com/ajdindev/pterodactyl-api-docs/blob/main/docs/authentication.md Get a list of all users (admin only) using an Application API key. ```bash # Get list of all users (admin only) curl "https://your-panel.com/api/application/users" \ -H "Authorization: Bearer ptla_1234567890abcdef" \ -H "Content-Type: application/json" \ -H "Accept: Application/vnd.pterodactyl.v1+json" ``` -------------------------------- ### Go Example: Get Server Database Source: https://github.com/ajdindev/pterodactyl-api-docs/blob/main/docs/api/application/databases.md Uses net/http to send a GET request and read the response body. Requires an application API key. ```go package main import ( "net/http" "io/ioutil" ) func main() { client := &http.Client{} req, _ := http.NewRequest("GET", "https://panel.example.com/api/application/servers/{server}/databases/{database}", nil) req.Header.Add("Authorization", "Bearer YOUR_APPLICATION_API_KEY") req.Header.Add("Accept", "application/json") req.Header.Add("Content-Type", "application/json") resp, _ := client.Do(req) defer resp.Body.Close() body, _ := ioutil.ReadAll(resp.Body) } ``` -------------------------------- ### C# Example: Get Server Database Source: https://github.com/ajdindev/pterodactyl-api-docs/blob/main/docs/api/application/databases.md Uses HttpClient to send a GET request and read the response content. Requires an application API key. ```csharp using System.Net.Http; using System.Net.Http.Headers; var client = new HttpClient(); client.DefaultRequestHeaders.Add("Authorization", "Bearer YOUR_APPLICATION_API_KEY"); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); var response = await client.GetAsync("https://panel.example.com/api/application/servers/{server}/databases/{database}"); var content = await response.Content.ReadAsStringAsync(); ``` -------------------------------- ### Java Example: Get Server Database Source: https://github.com/ajdindev/pterodactyl-api-docs/blob/main/docs/api/application/databases.md Uses java.net.http to send a GET request and receive the response. Requires an application API key. ```java import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; import java.net.URI; HttpClient client = HttpClient.newHttpClient(); HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://panel.example.com/api/application/servers/{server}/databases/{database}")) .header("Authorization", "Bearer YOUR_APPLICATION_API_KEY") .header("Accept", "application/json") .header("Content-Type", "application/json") .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); ``` -------------------------------- ### Local Development Setup Source: https://github.com/ajdindev/pterodactyl-api-docs/blob/main/README.md Clone the repository, install dependencies, start the development server, and build for production. Requires Node.js 24 LTS and npm or yarn. ```bash # 1. Fork the repository on GitHub first! # 2. Clone your fork git clone https://github.com/YOUR_USERNAME/pterodactyl-api-docs.git cd pterodactyl-api-docs # 3. Install dependencies npm install # 4. Start development server npm start # → Opens http://localhost:3000 # 5. Build for production npm run build # → Generates static files in build/ directory ``` -------------------------------- ### Ruby Example: Get Server Database Source: https://github.com/ajdindev/pterodactyl-api-docs/blob/main/docs/api/application/databases.md Uses Net::HTTP to send a GET request and parse the JSON response. Requires an application API key. ```ruby require 'net/http' require 'json' uri = URI('https://panel.example.com/api/application/servers/{server}/databases/{database}') http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Get.new(uri) request['Authorization'] = 'Bearer YOUR_APPLICATION_API_KEY' request['Accept'] = 'application/json' request['Content-Type'] = 'application/json' response = http.request(request) database = JSON.parse(response.body) ``` -------------------------------- ### Clone and install the repository Source: https://github.com/ajdindev/pterodactyl-api-docs/blob/main/CONTRIBUTING.md Start by cloning the repository and installing dependencies with npm. ```bash git clone https://github.com/AjdinDev/pterodactyl-api-docs.git cd pterodactyl-api-docs npm install ``` -------------------------------- ### JavaScript Example: Get Server Database Source: https://github.com/ajdindev/pterodactyl-api-docs/blob/main/docs/api/application/databases.md Uses fetch to send a GET request and parse the JSON response. Requires an application API key. ```javascript const response = await fetch('https://panel.example.com/api/application/servers/{server}/databases/{database}', { method: 'GET', headers: { 'Authorization': 'Bearer YOUR_APPLICATION_API_KEY', 'Accept': 'application/json', 'Content-Type': 'application/json' } }); const database = await response.json(); ``` -------------------------------- ### Python Example: Get Server Database Source: https://github.com/ajdindev/pterodactyl-api-docs/blob/main/docs/api/application/databases.md Uses requests library to send a GET request and parse the JSON response. Requires an application API key. ```python import requests response = requests.get( 'https://panel.example.com/api/application/servers/{server}/databases/{database}', headers={ 'Authorization': 'Bearer YOUR_APPLICATION_API_KEY', 'Accept': 'application/json', 'Content-Type': 'application/json' } ) database = response.json() ``` -------------------------------- ### List Server Databases - C# Example Source: https://github.com/ajdindev/pterodactyl-api-docs/blob/main/docs/api/application/databases.md Uses C# HttpClient to send a GET request to the databases endpoint. The response content is read as a string. ```csharp using System.Net.Http; using System.Net.Http.Headers; var client = new HttpClient(); client.DefaultRequestHeaders.Add("Authorization", "Bearer YOUR_APPLICATION_API_KEY"); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); var response = await client.GetAsync("https://panel.example.com/api/application/servers/{server}/databases"); var content = await response.Content.ReadAsStringAsync(); ``` -------------------------------- ### List Server Databases - Go Example Source: https://github.com/ajdindev/pterodactyl-api-docs/blob/main/docs/api/application/databases.md Uses Go's net/http package to send a GET request to the databases endpoint. The response body is read and stored in a variable. ```go package main import ( "net/http" "io/ioutil" ) func main() { client := &http.Client{} req, _ := http.NewRequest("GET", "https://panel.example.com/api/application/servers/{server}/databases", nil) req.Header.Add("Authorization", "Bearer YOUR_APPLICATION_API_KEY") req.Header.Add("Accept", "application/json") req.Header.Add("Content-Type", "application/json") resp, _ := client.Do(req) defer resp.Body.Close() body, _ := ioutil.ReadAll(resp.Body) } ``` -------------------------------- ### cURL Example: Get Server Database Source: https://github.com/ajdindev/pterodactyl-api-docs/blob/main/docs/api/application/databases.md Uses cURL to send a GET request to the endpoint. Requires an application API key for authorization. ```bash curl -X GET "https://panel.example.com/api/application/servers/{server}/databases/{database}" \ -H "Authorization: Bearer YOUR_APPLICATION_API_KEY" \ -H "Accept: application/json" \ -H "Content-Type: application/json" ``` -------------------------------- ### PHP Example: Get Server Database Source: https://github.com/ajdindev/pterodactyl-api-docs/blob/main/docs/api/application/databases.md Uses cURL in PHP to send a GET request and decode the JSON response. Requires an application API key. ```php response = client.send(request, HttpResponse.BodyHandlers.ofString()); ``` -------------------------------- ### Get User Details - Go Example Source: https://github.com/ajdindev/pterodactyl-api-docs/blob/main/docs/api/application/users.md Uses net/http to fetch user details with the `include=servers` query parameter. Requires a valid API key. ```go package main import ( "encoding/json" "fmt" "net/http" ) func main() { userId := 1 url := fmt.Sprintf("https://your-panel.com/api/application/users/%d?include=servers", userId) client := &http.Client{} req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Bearer ptla_YOUR_API_KEY") req.Header.Add("Accept", "Application/vnd.pterodactyl.v1+json") resp, _ := client.Do(req) defer resp.Body.Close() var result map[string]interface{} json.NewDecoder(resp.Body).Decode(&result) fmt.Println(result) } ``` -------------------------------- ### List Server Databases - cURL Example Source: https://github.com/ajdindev/pterodactyl-api-docs/blob/main/docs/api/application/databases.md Uses cURL to send a GET request to the databases endpoint. Requires an Application API key and Accept and Content-Type headers set to application/json. ```bash curl -X GET "https://panel.example.com/api/application/servers/{server}/databases" \ -H "Authorization: Bearer YOUR_APPLICATION_API_KEY" \ -H "Accept: application/json" \ -H "Content-Type: application/json" ``` -------------------------------- ### C# Example: Get Nest Details Source: https://github.com/ajdindev/pterodactyl-api-docs/blob/main/docs/api/application/nests-eggs.md Uses HttpClient to fetch nest details. Requires .NET and a valid API key. The response content is printed. ```csharp using System; using System.Net.Http; using System.Threading.Tasks; class Program { static async Task Main(string[] args) { int nestId = 1; var client = new HttpClient(); client.DefaultRequestHeaders.Add("Authorization", "Bearer ptla_YOUR_API_KEY"); client.DefaultRequestHeaders.Add("Accept", "Application/vnd.pterodactyl.v1+json"); var response = await client.GetAsync($"https://your-panel.com/api/application/nests/{nestId}?include=eggs"); var content = await response.Content.ReadAsStringAsync(); Console.WriteLine(content); } } ``` -------------------------------- ### Create Server Database with Go Source: https://github.com/ajdindev/pterodactyl-api-docs/blob/main/docs/api/application/databases.md Go example using net/http to POST a new server database. Marshals a map to JSON, sets headers, and sends the request. ```go package main import ( "bytes" "encoding/json" "net/http" ) func main() { data := map[string]interface{}{ "database": "my_database", "remote": "%", "host": 1, } jsonData, _ := json.Marshal(data) client := &http.Client{} req, _ := http.NewRequest("POST", "https://panel.example.com/api/application/servers/{server}/databases", bytes.NewBuffer(jsonData)) req.Header.Add("Authorization", "Bearer YOUR_APPLICATION_API_KEY") req.Header.Add("Accept", "application/json") req.Header.Add("Content-Type", "application/json") resp, _ := client.Do(req) defer resp.Body.Close() } ``` -------------------------------- ### Example Response - Get Account Details Source: https://github.com/ajdindev/pterodactyl-api-docs/blob/main/docs/api/client/account.md Example JSON response for the GET /api/client/account endpoint, showing the user object with attributes. ```json { "object": "user", "attributes": { "id": 1, "admin": true, "username": "admin", "email": "user@example.com", "first_name": "Admin", "last_name": "User", "language": "en" } } ``` -------------------------------- ### Create Server Database with Ruby Net::HTTP Source: https://github.com/ajdindev/pterodactyl-api-docs/blob/main/docs/api/application/databases.md Ruby example using net/http to POST a new server database. Sets headers and JSON body, then parses the response. ```ruby require 'net/http' require 'json' uri = URI('https://panel.example.com/api/application/servers/{server}/databases') http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Post.new(uri) request['Authorization'] = 'Bearer YOUR_APPLICATION_API_KEY' request['Accept'] = 'application/json' request['Content-Type'] = 'application/json' request.body = { database: 'my_database', remote: '%', host: 1 }.to_json response = http.request(request) database = JSON.parse(response.body) ``` -------------------------------- ### Example Response - Updated Variable Source: https://github.com/ajdindev/pterodactyl-api-docs/blob/main/docs/api/client/servers.md Shows the JSON response returned after successfully updating a startup variable. Contains the variable attributes including name, description, env_variable, default_value, server_value, is_editable, and rules. ```json { "object": "egg_variable", "attributes": { "name": "Server Version", "description": "The version of Minecraft to download and use.", "env_variable": "MINECRAFT_VERSION", "default_value": "latest", "server_value": "1.20.1", "is_editable": true, "rules": "required|string|between:1,20" } } ``` -------------------------------- ### Create Server Database with C# HttpClient Source: https://github.com/ajdindev/pterodactyl-api-docs/blob/main/docs/api/application/databases.md C# example using System.Net.Http to POST a new server database. Serializes an anonymous object to JSON and sends it as content. ```csharp using System.Net.Http; using System.Text; using System.Text.Json; var client = new HttpClient(); client.DefaultRequestHeaders.Add("Authorization", "Bearer YOUR_APPLICATION_API_KEY"); var data = new { database = "my_database", remote = "%", host = 1 }; var json = JsonSerializer.Serialize(data); var content = new StringContent(json, Encoding.UTF8, "application/json"); var response = await client.PostAsync("https://panel.example.com/api/application/servers/{server}/databases", content); ``` -------------------------------- ### Create Server Database with Java HttpClient Source: https://github.com/ajdindev/pterodactyl-api-docs/blob/main/docs/api/application/databases.md Java example using java.net.http to POST a new server database. Builds a request with JSON body and headers, then sends it. ```java import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; import java.net.URI; String requestBody = """ { "database": "my_database", "remote": "%", "host": 1 } """; HttpClient client = HttpClient.newHttpClient(); HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://panel.example.com/api/application/servers/{server}/databases")) .header("Authorization", "Bearer YOUR_APPLICATION_API_KEY") .header("Accept", "application/json") .header("Content-Type", "application/json") .POST(HttpRequest.BodyPublishers.ofString(requestBody)) .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); ``` -------------------------------- ### C# Example: Get User by External ID Source: https://github.com/ajdindev/pterodactyl-api-docs/blob/main/docs/api/application/users.md Uses System.Net.Http.HttpClient to send a GET request. Requires .NET and a valid API key. ```csharp using System.Net.Http; using System.Threading.Tasks; var client = new HttpClient(); client.DefaultRequestHeaders.Add("Authorization", "Bearer ptla_YOUR_API_KEY"); client.DefaultRequestHeaders.Add("Accept", "Application/vnd.pterodactyl.v1+json"); string externalId = "ext-123456"; var response = await client.GetAsync($"https://your-panel.com/api/application/users/external/{externalId}"); var content = await response.Content.ReadAsStringAsync(); Console.WriteLine(content); ``` -------------------------------- ### Create Server Database with JavaScript fetch Source: https://github.com/ajdindev/pterodactyl-api-docs/blob/main/docs/api/application/databases.md JavaScript example using fetch to POST a new server database. Sends JSON body with database, remote, and host fields, and parses the response as JSON. ```javascript const response = await fetch('https://panel.example.com/api/application/servers/{server}/databases', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_APPLICATION_API_KEY', 'Accept': 'application/json', 'Content-Type': 'application/json' }, body: JSON.stringify({ database: 'my_database', remote: '%', host: 1 }) }); const database = await response.json(); ``` -------------------------------- ### Example Response for Get Location Details Source: https://github.com/ajdindev/pterodactyl-api-docs/blob/main/docs/api/application/locations.md Example JSON response from the API, showing location attributes and relationships for nodes and servers. ```json { "object": "location", "attributes": { "id": 1, "short": "us-east", "long": "US East Coast", "created_at": "2024-01-15T10:26:32+00:00", "updated_at": "2024-01-15T10:26:32+00:00" }, "relationships": { "nodes": { "object": "list", "data": [ { "object": "node", "attributes": { "id": 1, "public": true, "name": "Node 1", "fqdn": "node1.example.com", "memory": 8192, "disk": 102400 } } ] }, "servers": { "object": "list", "data": [ { "object": "server", "attributes": { "id": 1, "uuid": "d3aac109-e5e0-4331-b03e-3454f7e02bbe", "name": "Minecraft Server", "node": 1 } } ] } } } ``` -------------------------------- ### Java Example: Get User by External ID Source: https://github.com/ajdindev/pterodactyl-api-docs/blob/main/docs/api/application/users.md Uses java.net.http.HttpClient to send a GET request. Requires Java 11+ and a valid API key. ```java import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; import java.net.URI; String externalId = "ext-123456"; String url = String.format("https://your-panel.com/api/application/users/external/%s", externalId); HttpClient client = HttpClient.newHttpClient(); HttpRequest request = HttpRequest.newBuilder() .uri(URI.create(url)) .header("Authorization", "Bearer ptla_YOUR_API_KEY") .header("Accept", "Application/vnd.pterodactyl.v1+json") .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); ``` -------------------------------- ### Example Response - Server Details JSON Source: https://github.com/ajdindev/pterodactyl-api-docs/blob/main/docs/api/client/servers.md Example JSON response for the GET /api/client/servers/{server} endpoint, showing server attributes, limits, and relationships. ```json { "object": "server", "attributes": { "server_owner": true, "identifier": "d3aac109", "internal_id": 4, "uuid": "d3aac109-e5e0-4331-b03e-3454f7e136dc", "name": "Survival Server", "node": "Node 1", "is_node_under_maintenance": false, "sftp_details": { "ip": "node.example.com", "port": 2022 }, "description": "A vanilla Minecraft survival server", "limits": { "memory": 1024, "swap": 0, "disk": 5120, "io": 500, "cpu": 200, "threads": null, "oom_disabled": true }, "invocation": "java -Xms128M -Xmx1024M -jar server.jar", "docker_image": "ghcr.io/pterodactyl/yolks:java_17", "egg_features": [ "eula", "java_version", "pid_limit" ], "feature_limits": { "databases": 2, "allocations": 1, "backups": 10 }, "status": "running", "is_suspended": false, "is_installing": false, "is_transferring": false, "relationships": { "allocations": { "object": "list", "data": [] }, "variables": { "object": "list", "data": [] } } }, "meta": { "is_server_owner": true, "user_permissions": [ "*" ] } } ``` -------------------------------- ### Example Code Block with Syntax Highlighting Source: https://github.com/ajdindev/pterodactyl-api-docs/blob/main/docs/contributing.md Use this bash code block format for code examples, ensuring proper syntax highlighting. ```bash # Use proper syntax highlighting curl -X GET "https://example.com/api/endpoint" ``` -------------------------------- ### PHP Example: Get User by External ID Source: https://github.com/ajdindev/pterodactyl-api-docs/blob/main/docs/api/application/users.md Uses GuzzleHttp\Client to send a GET request. Requires the Guzzle HTTP client and a valid API key. ```php get("https://your-panel.com/api/application/users/external/{$externalId}", [ 'headers' => [ 'Authorization' => 'Bearer ptla_YOUR_API_KEY', 'Accept' => 'Application/vnd.pterodactyl.v1+json' ] ]); $data = json_decode($response->getBody(), true); print_r($data); ?> ``` -------------------------------- ### Create Server Database with Python requests Source: https://github.com/ajdindev/pterodactyl-api-docs/blob/main/docs/api/application/databases.md Python example using requests library to POST a new server database. Sends JSON body with database, remote, and host fields, and stores the response JSON. ```python import requests response = requests.post( 'https://panel.example.com/api/application/servers/{server}/databases', headers={ 'Authorization': 'Bearer YOUR_APPLICATION_API_KEY', 'Accept': 'application/json', 'Content-Type': 'application/json' }, json={ 'database': 'my_database', 'remote': '%', 'host': 1 } ) database = response.json() ``` -------------------------------- ### Python Example: Get User by External ID Source: https://github.com/ajdindev/pterodactyl-api-docs/blob/main/docs/api/application/users.md Uses the requests library to perform a GET request. Requires the requests package and a valid API key. ```python import requests external_id = 'ext-123456' headers = { 'Authorization': 'Bearer ptla_YOUR_API_KEY', 'Accept': 'Application/vnd.pterodactyl.v1+json' } response = requests.get(f'https://your-panel.com/api/application/users/external/{external_id}', headers=headers) print(response.json()) ``` -------------------------------- ### C# Example: Get Deployable Nodes Source: https://github.com/ajdindev/pterodactyl-api-docs/blob/main/docs/api/application/nodes.md Uses HttpClient to GET the deployable nodes endpoint with memory and disk query parameters. Prints the response content. ```csharp using System.Net.Http; using System.Threading.Tasks; var client = new HttpClient(); client.DefaultRequestHeaders.Add("Authorization", "Bearer ptla_YOUR_API_KEY"); client.DefaultRequestHeaders.Add("Accept", "Application/vnd.pterodactyl.v1+json"); var response = await client.GetAsync("https://your-panel.com/api/application/nodes/deployable?memory=1024&disk=5000"); var content = await response.Content.ReadAsStringAsync(); Console.WriteLine(content); ``` -------------------------------- ### Reinstall Server with Go (net/http) Source: https://github.com/ajdindev/pterodactyl-api-docs/blob/main/docs/api/client/servers.md Uses the standard net/http package to send a POST request to reinstall a server. Requires a valid API key. ```go package main import ( "fmt" "net/http" ) func main() { serverId := "d3aac109" client := &http.Client{} req, _ := http.NewRequest("POST", fmt.Sprintf("https://your-panel.com/api/client/servers/%s/settings/reinstall", serverId), nil) req.Header.Add("Authorization", "Bearer ptlc_YOUR_API_KEY") req.Header.Add("Accept", "Application/vnd.pterodactyl.v1+json") req.Header.Add("Content-Type", "application/json") resp, _ := client.Do(req) defer resp.Body.Close() fmt.Println("Server reinstall initiated") } ``` -------------------------------- ### Java Example: Get Deployable Nodes Source: https://github.com/ajdindev/pterodactyl-api-docs/blob/main/docs/api/application/nodes.md Uses java.net.http.HttpClient to GET the deployable nodes endpoint with memory and disk query parameters. Prints the response body. ```java import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; import java.net.URI; HttpClient client = HttpClient.newHttpClient(); HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://your-panel.com/api/application/nodes/deployable?memory=1024&disk=5000")) .header("Authorization", "Bearer ptla_YOUR_API_KEY") .header("Accept", "Application/vnd.pterodactyl.v1+json") .GET() .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); ``` -------------------------------- ### PHP Example: Get Deployable Nodes Source: https://github.com/ajdindev/pterodactyl-api-docs/blob/main/docs/api/application/nodes.md Uses GuzzleHttp\Client to GET the deployable nodes endpoint with memory and disk query parameters. Decodes and prints the response. ```php get('https://your-panel.com/api/application/nodes/deployable', [ 'headers' => [ 'Authorization' => 'Bearer ptla_YOUR_API_KEY', 'Accept' => 'Application/vnd.pterodactyl.v1+json' ], 'query' => [ 'memory' => 1024, 'disk' => 5000 ] ]); $data = json_decode($response->getBody(), true); print_r($data); ?> ``` -------------------------------- ### Create User with Go Source: https://github.com/ajdindev/pterodactyl-api-docs/blob/main/docs/api/application/users.md Go example using net/http to create a user. Marshals user data to JSON, sends POST request with headers, and prints response. ```go package main import ( "bytes" "encoding/json" "fmt" "net/http" ) func main() { userData := map[string]interface{}{ "email": "newuser@example.com", "username": "newuser", "first_name": "New", "last_name": "User", "password": "secure_password_123", "language": "en", "root_admin": false, } jsonData, _ := json.Marshal(userData) client := &http.Client{} req, _ := http.NewRequest("POST", "https://your-panel.com/api/application/users", bytes.NewBuffer(jsonData)) req.Header.Add("Authorization", "Bearer ptla_YOUR_API_KEY") req.Header.Add("Accept", "Application/vnd.pterodactyl.v1+json") req.Header.Add("Content-Type", "application/json") resp, _ := client.Do(req) defer resp.Body.Close() var result map[string]interface{} json.NewDecoder(resp.Body).Decode(&result) fmt.Println(result) } ``` -------------------------------- ### Start development server Source: https://github.com/ajdindev/pterodactyl-api-docs/blob/main/CONTRIBUTING.md Start the development server and test changes at http://localhost:3000. ```bash npm start # Start development server # Edit files and test your changes at http://localhost:3000 ``` -------------------------------- ### Python Example: Get Deployable Nodes Source: https://github.com/ajdindev/pterodactyl-api-docs/blob/main/docs/api/application/nodes.md Uses requests library to GET the deployable nodes endpoint with memory and disk parameters. Prints the JSON response. ```python import requests headers = { 'Authorization': 'Bearer ptla_YOUR_API_KEY', 'Accept': 'Application/vnd.pterodactyl.v1+json' } params = { 'memory': 1024, 'disk': 5000 } response = requests.get('https://your-panel.com/api/application/nodes/deployable', headers=headers, params=params) print(response.json()) ``` -------------------------------- ### Ruby Example: Get User by External ID Source: https://github.com/ajdindev/pterodactyl-api-docs/blob/main/docs/api/application/users.md Uses Net::HTTP to send a GET request. Requires a valid API key and parses the JSON response. ```ruby require 'net/http' require 'json' external_id = 'ext-123456' uri = URI("https://your-panel.com/api/application/users/external/#{external_id}") http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Get.new(uri) request['Authorization'] = 'Bearer ptla_YOUR_API_KEY' request['Accept'] = 'Application/vnd.pterodactyl.v1+json' response = http.request(request) puts JSON.parse(response.body) ``` -------------------------------- ### Go Example: Get User by External ID Source: https://github.com/ajdindev/pterodactyl-api-docs/blob/main/docs/api/application/users.md Uses the net/http package to perform a GET request. Requires a valid API key and handles the response as JSON. ```go package main import ( "encoding/json" "fmt" "net/http" ) func main() { externalId := "ext-123456" url := fmt.Sprintf("https://your-panel.com/api/application/users/external/%s", externalId) client := &http.Client{} req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Bearer ptla_YOUR_API_KEY") req.Header.Add("Accept", "Application/vnd.pterodactyl.v1+json") resp, _ := client.Do(req) defer resp.Body.Close() var result map[string]interface{} json.NewDecoder(resp.Body).Decode(&result) fmt.Println(result) } ``` -------------------------------- ### List Nest Eggs - Go Example Source: https://github.com/ajdindev/pterodactyl-api-docs/blob/main/docs/api/application/nests-eggs.md Go example using net/http to list eggs in a nest, including the 'variables' relationship. Requires an API key. ```go package main import ( "fmt" "io" "net/http" ) func main() { nestId := 1 client := &http.Client{} req, _ := http.NewRequest("GET", fmt.Sprintf("https://your-panel.com/api/application/nests/%d/eggs?include=variables", nestId), nil) req.Header.Add("Authorization", "Bearer ptla_YOUR_API_KEY") req.Header.Add("Accept", "Application/vnd.pterodactyl.v1+json") resp, _ := client.Do(req) defer resp.Body.Close() body, _ := io.ReadAll(resp.Body) fmt.Println(string(body)) } ``` -------------------------------- ### JavaScript (Node.js) Example: Get User by External ID Source: https://github.com/ajdindev/pterodactyl-api-docs/blob/main/docs/api/application/users.md Uses Axios to make an asynchronous GET request. Requires the axios package and a valid API key. ```javascript const axios = require('axios'); const externalId = 'ext-123456'; const response = await axios.get(`https://your-panel.com/api/application/users/external/${externalId}`, { headers: { 'Authorization': 'Bearer ptla_YOUR_API_KEY', 'Accept': 'Application/vnd.pterodactyl.v1+json' } }); console.log(response.data); ``` -------------------------------- ### PHP Example: Get Server by External ID Source: https://github.com/ajdindev/pterodactyl-api-docs/blob/main/docs/api/application/servers.md Uses GuzzleHttp\Client to send a GET request to the external server endpoint. Requires Guzzle and a valid API key. ```php get("https://your-panel.com/api/application/servers/external/{$externalId}", [ 'headers' => [ 'Authorization' => 'Bearer ptla_YOUR_API_KEY', 'Accept' => 'Application/vnd.pterodactyl.v1+json' ] ]); $data = json_decode($response->getBody(), true); print_r($data); ?> ``` -------------------------------- ### Get Startup Configuration with JavaScript (axios) Source: https://github.com/ajdindev/pterodactyl-api-docs/blob/main/docs/api/client/servers.md Retrieve the current startup configuration and environment variables for a server using JavaScript with axios. Requires an API key with the `startup.read` permission. ```javascript const axios = require('axios'); const serverId = 'd3aac109'; const response = await axios.get(`https://your-panel.com/api/client/servers/${serverId}/startup`, { headers: { 'Authorization': 'Bearer ptlc_YOUR_API_KEY', 'Accept': 'Application/vnd.pterodactyl.v1+json', 'Content-Type': 'application/json' } }); console.log('Startup config:', response.data); ``` -------------------------------- ### JavaScript Example: Get Server by External ID Source: https://github.com/ajdindev/pterodactyl-api-docs/blob/main/docs/api/application/servers.md Uses Axios to make a GET request to the external server endpoint. Requires axios and a valid API key. ```javascript const axios = require('axios'); const externalId = 'srv-ext-123'; const response = await axios.get(`https://your-panel.com/api/application/servers/external/${externalId}`, { headers: { 'Authorization': 'Bearer ptla_YOUR_API_KEY', 'Accept': 'Application/vnd.pterodactyl.v1+json' } }); console.log(response.data); ``` -------------------------------- ### Reinstall Server with C# (HttpClient) Source: https://github.com/ajdindev/pterodactyl-api-docs/blob/main/docs/api/client/servers.md Uses HttpClient to send a POST request to reinstall a server. Requires .NET and a valid API key. ```csharp using System.Net.Http; using System.Threading.Tasks; var serverId = "d3aac109"; var client = new HttpClient(); client.DefaultRequestHeaders.Add("Authorization", "Bearer ptlc_YOUR_API_KEY"); client.DefaultRequestHeaders.Add("Accept", "Application/vnd.pterodactyl.v1+json"); var response = await client.PostAsync($"https://your-panel.com/api/client/servers/{serverId}/settings/reinstall", null); Console.WriteLine("Server reinstall initiated"); ``` -------------------------------- ### Go Example: Get Deployable Nodes Source: https://github.com/ajdindev/pterodactyl-api-docs/blob/main/docs/api/application/nodes.md Uses net/http to GET the deployable nodes endpoint with memory and disk query parameters. Decodes and prints the JSON response. ```go package main import ( "encoding/json" "fmt" "net/http" ) func main() { url := "https://your-panel.com/api/application/nodes/deployable?memory=1024&disk=5000" client := &http.Client{} req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Bearer ptla_YOUR_API_KEY") req.Header.Add("Accept", "Application/vnd.pterodactyl.v1+json") resp, _ := client.Do(req) defer resp.Body.Close() var result map[string]interface{} json.NewDecoder(resp.Body).Decode(&result) fmt.Println(result) } ``` -------------------------------- ### GET /api/client/servers/{server}/startup Source: https://github.com/ajdindev/pterodactyl-api-docs/blob/main/docs/api/client/servers.md Retrieves the current startup configuration and environment variables for a server. This endpoint returns a list of egg variables, the startup command, and available Docker images. ```APIDOC ## [GET] /api/client/servers/{server}/startup ### Description Retrieves the current startup configuration and environment variables for a server. ### Method GET ### Endpoint /api/client/servers/{server}/startup ### Parameters #### Path Parameters - **server** (string) - Required - The server identifier (e.g., `d3aac109`) ### Response #### Success Response (200) - **object** (string) - Always `"list"` - **data** (array) - List of egg variables - **object** (string) - Always `"egg_variable"` - **attributes** (object) - Variable details - **name** (string) - Variable name - **description** (string) - Variable description - **env_variable** (string) - Environment variable name - **default_value** (string) - Default value - **server_value** (string) - Current server value - **is_editable** (boolean) - Whether the variable is editable - **rules** (string) - Validation rules - **meta** (object) - Additional metadata - **startup_command** (string) - Startup command with placeholders - **raw_startup_command** (string) - Raw startup command - **docker_images** (object) - Available Docker images (key-value pairs) ### Request Example ```curl curl "https://your-panel.com/api/client/servers/d3aac109/startup" \ -H "Authorization: Bearer ptlc_YOUR_API_KEY" \ -H "Accept: Application/vnd.pterodactyl.v1+json" \ -H "Content-Type: application/json" ``` ### Response Example ```json { "object": "list", "data": [ { "object": "egg_variable", "attributes": { "name": "Server Jar File", "description": "The name of the server jarfile to run the server with.", "env_variable": "SERVER_JARFILE", "default_value": "server.jar", "server_value": "server.jar", "is_editable": true, "rules": "required|regex:/^([\\w\\d._-]+)(\\.jar)$/" } }, { "object": "egg_variable", "attributes": { "name": "Server Version", "description": "The version of Minecraft to download and use.", "env_variable": "MINECRAFT_VERSION", "default_value": "latest", "server_value": "1.19.4", "is_editable": true, "rules": "required|string|between:1,20" } } ], "meta": { "startup_command": "java -Xms128M -Xmx{{SERVER_MEMORY}}M -jar {{SERVER_JARFILE}}", "raw_startup_command": "java -Xms128M -Xmx1024M -jar server.jar", "docker_images": { "ghcr.io/pterodactyl/yolks:java_17": "Java 17", "ghcr.io/pterodactyl/yolks:java_11": "Java 11", "ghcr.io/pterodactyl/yolks:java_8": "Java 8" } } } ``` ``` -------------------------------- ### Get User Details - Example Response Source: https://github.com/ajdindev/pterodactyl-api-docs/blob/main/docs/api/application/users.md Example JSON response for a successful user details request. Shows the user object with attributes and an empty servers relationship list. ```json { "object": "user", "attributes": { "id": 1, "external_id": null, "uuid": "c4022c6c-9bf1-4a23-bff9-519cceb38335", "username": "system", "email": "admin@example.com", "first_name": "System", "last_name": "Administrator", "language": "en", "root_admin": true, "2fa": false, "created_at": "2023-01-15T10:26:32+00:00", "updated_at": "2023-01-15T10:26:32+00:00" }, "relationships": { "servers": { "object": "list", "data": [] } } } ``` -------------------------------- ### C# Example: Get Server by External ID Source: https://github.com/ajdindev/pterodactyl-api-docs/blob/main/docs/api/application/servers.md Uses System.Net.Http.HttpClient to make an asynchronous GET request to the external server endpoint. Requires .NET and a valid API key. ```csharp using System.Net.Http; using System.Threading.Tasks; var client = new HttpClient(); client.DefaultRequestHeaders.Add("Authorization", "Bearer ptla_YOUR_API_KEY"); client.DefaultRequestHeaders.Add("Accept", "Application/vnd.pterodactyl.v1+json"); string externalId = "srv-ext-123"; var response = await client.GetAsync($"https://your-panel.com/api/application/servers/external/{externalId}"); var content = await response.Content.ReadAsStringAsync(); Console.WriteLine(content); ``` -------------------------------- ### Get Startup Configuration with Python (requests) Source: https://github.com/ajdindev/pterodactyl-api-docs/blob/main/docs/api/client/servers.md Retrieve the current startup configuration and environment variables for a server using Python with the requests library. Requires an API key with the `startup.read` permission. ```python import requests server_id = 'd3aac109' headers = { 'Authorization': 'Bearer ptlc_YOUR_API_KEY', 'Accept': 'Application/vnd.pterodactyl.v1+json', 'Content-Type': 'application/json' } response = requests.get(f'https://your-panel.com/api/client/servers/{server_id}/startup', headers=headers) data = response.json() print('Startup config:', data) ```