client.account
- class pydactyl.api.client.account.Account
Class for interacting with the Pterodactyl Client API.
Methods in this class appear in the base client.account namespace when using PterodactylClient.
- api_key_create(description: str, allowed_ips: list)
Create a client API key.
- Parameters:
description (str) – Note for the API key
allowed_ips (iter) – List of allowed IPs
- api_key_delete(identifier)
Delete a client API key.
- Parameters:
identifier (str) – API key identifier
- api_key_list()
List client’s API keys.
- disable_2fa(password: str)
Disables 2FA on the account.
- Parameters:
password (str) – User’s account password
- enable_2fa(code: str)
Enables TOTP 2FA.
Takes a TOTP code generated by a client configured using the code from get_2fa_setup_code(). This does not take the code directly and you must first setup an authenticator app such as Google Authenticator to generate the code provided to this method.
- Parameters:
code (str) – TOTP code generated by authenticator app
- get_2fa_setup_code()
Generates a TOTP QR code image to allow the setup of 2FA.
- get_account()
List details of the account belonging to the client API key.
- update_email(email: str, password: str)
Updates the email address of the account.
- Parameters:
email (str) – New email address
password (str) – User’s account password
- update_password(current: str, new: str, new_confirm: str)
Updates the password of the account.
- Parameters:
current (str) – User’s current password
new (str) – New password for the account, must match new_confirm
new_confirm (str) – New password for the account, must match new
client.servers
- class pydactyl.api.client.servers.base.ServersBase
Pterodactyl Client Server Base API.
Methods in this class appear in the base client.servers namespace when using PterodactylClient.
- get_server(server_id, detail=False, includes=None, params=None)
Get information for the specified server.
- Parameters:
server_id (str) – Server identifier (abbreviated UUID)
detail (bool) – If True includes the object type and a nested data structure. This is not particularly useful.
includes (iter) – List of includes, e.g. (‘egg’, ‘subusers’)
params (dict) – Extra parameters to pass, e.g. {‘per_page’: 300}
- get_server_utilization(server_id, detail=False)
Get resource utilization information for the specified server.
- Parameters:
server_id (str) – Server identifier (abbreviated UUID)
detail (bool) – If True includes the object type and a nested data structure. This is not particularly useful.
- get_websocket(server_id)
Generates credentials to connect to the server’s websocket.
- Parameters:
server_id (str) – Server identifier (abbreviated UUID)
- Returns:
Response with token and websocket address
- Return type:
response(dict)
- list_permissions()
Retries all available permissions.
This is used by the frontend. I have no idea what this does.
- list_servers(includes=None, params=None)
List all servers the client has access to.
- Parameters:
includes (iter) – List of includes, e.g. (‘egg’, ‘subusers’)
params (dict) – Extra parameters to pass, e.g. {‘per_page’: 300}
- send_console_command(server_id, cmd)
Sends a console command to the specified server.
The server must be online, otherwise API will return a HTTP 412 error. If successful, there will be an empty response body.
- Parameters:
server_id (str) – Server identifier (abbreviated UUID)
cmd (str) – Console command to send to the server
- send_power_action(server_id, signal)
Sends a console command to the specified server.
The server must be online, otherwise API will return a HTTP 412 error. If successful, there will be an empty response body.
- Parameters:
server_id (str) – Server identifier (abbreviated UUID)
signal (str) –
Power signal to send to the server. Valid options: start - Sends the startup command to the server. stop - Sends the stop command to the server. restart - Stops the server then immediately starts it. kill - Instantly ends all processes and marks the server as
stopped. The kill signal can corrupt server files and should only be used as a last resort.
client.servers.backups
- class pydactyl.api.client.servers.backups.Backups
Pterodactyl Client Server Backups API.
- create_backup(server_id: str)
Create a new backup of the specified server.
- Parameters:
server_id (str) – Server identifier (abbreviated UUID)
- delete_backup(server_id: str, backup_id: str)
Deletes the specified backup.
- Parameters:
server_id (str) – Server identifier (abbreviated UUID)
backup_id (str) – Backup identifier (long UUID)
- get_backup_detail(server_id: str, backup_id: str)
Retrieves information about the specified backup.
- Parameters:
server_id (str) – Server identifier (abbreviated UUID)
backup_id (str) – Backup identifier (long UUID)
- get_backup_download(server_id: str, backup_id: str)
Generates a download link for the specified backup.
- Parameters:
server_id (str) – Server identifier (abbreviated UUID)
backup_id (str) – Backup identifier (long UUID)
- list_backups(server_id: str)
List files belonging to specified server.
Optionally specify a directory and only return results in the specified directory. Directory is relative to the server’s root.
- Parameters:
server_id (str) – Server identifier (abbreviated UUID)
- restore_backup(server_id: str, backup_id: str, delete_existing_files: bool = True)
Restores the specified backup.
- Parameters:
server_id (str) – Server identifier (abbreviated UUID)
backup_id (str) – Backup identifier (long UUID)
delete_existing_files (bool) – Delete existing files if True
client.servers.databases
- class pydactyl.api.client.servers.databases.Databases
Pterodactyl Client Server Databases API.
- create_database(server_id: str, name: str, remote: str = '%')
Create a new database for the specified server.
Limits connections to the address specified in remote, defaulting to allowing from all.
- Parameters:
server_id (str) – Server identifier (abbreviated UUID)
remote (str) – Remote address to allow connections from (e.g. 1.2.3.4)
- delete_database(server_id: str, database_id: str)
Deletes the specified database.
- Parameters:
server_id (str) – Server identifier (abbreviated UUID)
database_id (str) – Database identifier (long UUID)
- list_databases(server_id: str, include_passwords: bool = False, includes: list = [], params: dict = None)
List all databases for a server.
Optionally includes the database user passwords.
- Parameters:
server_id (str) – Server identifier (abbreviated UUID)
include_passwords (bool) – True to include database user passwords
includes (iter) – List of includes, e.g. (‘password’)
params (dict) – Extra parameters to pass, e.g. {‘per_page’: 300}
- rotate_database_password(server_id: str, database_id: str)
Changes the password of the specified database.
Generates a new password and returns it in the response.
- Parameters:
server_id (str) – Server identifier (abbreviated UUID)
database_id (str) – Database identifier (long UUID)
client.servers.files
- class pydactyl.api.client.servers.files.Files
Class for interacting with the Pterodactyl Client API.
- compress_files(server_id: str, files: iter, path: str = '/')
Creates a compressed archive.
Creates a tar.gz compressed file containing the listed files.
- Parameters:
server_id (str) – Server identifier (abbreviated UUID)
files (iter) – List of files to add to the archive
path (str) – Root path to create the archive from
- copy_file(server_id: str, path: str)
Makes a copy of a file.
This is primarily used by the file manager.
Makes a copy of the file with a unique name. You cannot specify the new name of the file, it just picks one for you. For example ‘test.txt’ will have a copy created named ‘test copy.txt’. Running it again will create ‘test copy 1.txt’.
- Parameters:
server_id (str) – Server identifier (abbreviated UUID)
path (str) – URL encoded path to desired file (e.g. ‘eula.txt’)
- create_folder(server_id: str, name: str, path: str = '/')
Creates the specified folder in the specified directory.
- Parameters:
server_id (str) – Server identifier (abbreviated UUID)
name (str) – Name of the directory to create
path (str) – Root path to create the directory in
- decompress_file(server_id: str, file: str, path: str = '/')
Decompresses an archive.
Decompresses a compressed file to the specified path.
- Parameters:
server_id (str) – Server identifier (abbreviated UUID)
file (str) – Name of the archive file to decompress
path (str) – Root path to decompress in
- delete_files(server_id: str, files: iter, path: str = '/')
Deletes the specified file(s) or directory(s).
- Parameters:
server_id (str) – Server identifier (abbreviated UUID)
files (iter) – List of files to delete
path (str) – Root path look for files in
- download_file(server_id: str, path: str) str
Get a download link for the specified file on the specified server.
- Parameters:
server_id (str) – Server identifier (abbreviated UUID)
path (str) – URL encoded path to desired file (e.g. ‘eula.txt’)
- Returns:
Signed URL to download file
- Return type:
response(str)
- get_file_contents(server_id: str, path: str, json: bool = True) str
Get contents of the specified file on the specified server.
- Parameters:
server_id (str) – Server identifier (abbreviated UUID)
path (str) – URL encoded path to desired file (e.g. ‘eula.txt’)
json (bool) – Whether to get the json_response (default: True)
- get_upload_file_url(server_id: str) str
Returns a signed URL used to upload files to the server using POST.
- Parameters:
server_id (str) – Server identifier (abbreviated UUID)
- list_files(server_id: str, path: str = None)
List files belonging to specified server.
Optionally specify a directory and only return results in the specified directory. Directory is relative to the server’s root.
- Parameters:
server_id (str) – Server identifier (abbreviated UUID)
path (str) – Path to list in (e.g. ‘save_game’)
- rename_file(server_id: str, old_name: str, new_name: str, root: str = '/')
Rename a file.
- Parameters:
server_id (str) – Server identifier (abbreviated UUID)
old_name (str) – Name of existing file to rename
new_name (str) – New filename
root (str) – Path to files, relative to server root
- write_file(server_id: str, path: str, contents: str)
Writes contents to a file.
- Parameters:
server_id (str) – Server identifier (abbreviated UUID)
path (str) – Path to desired file (e.g. ‘eula.txt’)
contents (str) – Contents to write to the file.
client.servers.network
- class pydactyl.api.client.servers.network.Network
Pterodactyl Client Server Network API.
- assign_allocation(server_id: str)
Assigns an allocation to the server.
Automatically assigns a new allocation if auto-assign is enabled on the instance.
- Parameters:
server_id (str) – Server identifier (abbreviated UUID)
- list_allocations(server_id: str)
Retrieves network information for the specified server.
- Parameters:
server_id (str) – Server identifier (abbreviated UUID)
- set_allocation_note(server_id: str, allocation_id: int, note: str)
Sets the note on an allocation.
- Parameters:
server_id (str) – Server identifier (abbreviated UUID)
allocation_id (int) – Allocation identifier (e.g. 2)
note (str) – Contents of the note
- set_primary_allocation(server_id: str, allocation_id: int)
Sets the specified allocation as the primary allocation.
- Parameters:
server_id (str) – Server identifier (abbreviated UUID)
allocation_id (int) – Allocation identifier (e.g. 2)
- unassign_allocation(server_id: str, allocation_id: int)
Deletes the specified non-primary allocation.
- Parameters:
server_id (str) – Server identifier (abbreviated UUID)
allocation_id (int) – Allocation identifier (e.g. 2)
client.servers.settings
- class pydactyl.api.client.servers.settings.Settings
Pterodactyl Client Server Settings API.
- reinstall_server(server_id: str)
Reinstalls the specified server.
- Parameters:
server_id (str) – Server identifier (abbreviated UUID)
- rename_server(server_id: str, name: str, description: str = None)
Renames the server.
- Parameters:
server_id (str) – Server identifier (abbreviated UUID)
name (str) – New name for the server
description (str) – New description for the server
client.servers.startup
- class pydactyl.api.client.servers.startup.Startup
Pterodactyl Client Server Startup API.
- list_variables(server_id: str)
Lists all variables on the server.
- Parameters:
server_id (str) – Server identifier (abbreviated UUID)
- update_variable(server_id: str, name: str, value: str)
Updates the specified server variable.
- Parameters:
server_id (str) – Server identifier (abbreviated UUID)
name (str) – Variable name to update
value (str) – Value to assign to the updated variable
client.servers.users
- class pydactyl.api.client.servers.users.Users
Pterodactyl Client Server Backups API.
- create_user(server_id: str, email: str, permissions: iter, username: str = None)
Adds a new user to the server.
- Parameters:
server_id (str) – Server identifier (abbreviated UUID)
email (str) – Email address of the new user
permissions (iter) – List of permissions to assign to the user
username (str) – Username to assign, randomized if not specified
- delete_user(server_id: str, user_id: str)
Deletes the specified user.
- Parameters:
server_id (str) – Server identifier (abbreviated UUID)
user_id (str) – User identifier (long UUID)
- get_user(server_id: str, user_id: str)
Retrieves details about the specified user.
- Parameters:
server_id (str) – Server identifier (abbreviated UUID)
user_id (str) – User identifier (long UUID)
- list_users(server_id: str)
List all users added to the server.
Includes user details and permissions assigned to them.
- Parameters:
server_id (str) – Server identifier (abbreviated UUID)
- update_user(server_id: str, user_id: str, permissions)
Updates the specified user.
This probably has more options than the documentation list.
- Parameters:
server_id (str) – Server identifier (abbreviated UUID)
user_id (str) – User identifier (long UUID)
permissions (iter) – List of permissions to assign to the user