Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/iFamishedX/HungerLib/llms.txt

Use this file to discover all available pages before exploring further.

FileManagerAPI is the low-level wrapper around Pterodactyl’s file management endpoints. It is attached to every Panel instance as panel.files and is also called internally by the convenience methods on GenericServer. Every method accepts a server_id as its first argument and returns a raw requests.Response object — parse response.json() for the payload or check response.status_code for success. You will typically reach these methods through a GenericServer instance rather than calling them directly, but they are fully public and safe to use on their own when you need granular control over the Pterodactyl file API.
from hungerlib import Panel

panel = Panel("https://panel.example.com", "ptlc_yourtoken")

# Direct usage via panel.files
response = panel.files.list("abc123", directory="/plugins")
print(response.json())

list

Returns the contents of a directory on the server’s filesystem. Endpoint: GET /api/client/servers/{server_id}/files/list?directory={directory}
panel.files.list(server_id, directory="/")
server_id
str
required
The short identifier of the target server (e.g. "abc123").
directory
str
default:"/"
The directory path to list, relative to the server root. Defaults to the root directory "/".
Returns: requests.Response — JSON body contains a data array of file/directory objects, each with name, mode, size, is_file, is_symlink, mimetype, and modified_at.
response = panel.files.list("abc123", directory="/plugins")
for entry in response.json()["data"]:
    print(entry["attributes"]["name"], entry["attributes"]["is_file"])

download

Generates a short-lived signed download URL for a single file. Endpoint: GET /api/client/servers/{server_id}/files/download?file={file_path}
panel.files.download(server_id, file_path)
server_id
str
required
The short identifier of the target server.
file_path
str
required
The full path to the file relative to the server root (e.g. "/server.properties").
Returns: requests.Response — JSON body contains attributes.url, a pre-signed URL you can GET to download the file contents.
response = panel.files.download("abc123", "/server.properties")
download_url = response.json()["attributes"]["url"]

upload

Uploads a file to the server using a multipart form upload. The underlying Panel._raw_upload() method handles the Content-Type: multipart/form-data encoding. Endpoint: POST /api/client/servers/{server_id}/files/upload
panel.files.upload(server_id, directory, file_data)
server_id
str
required
The short identifier of the target server.
directory
str
required
The destination directory on the server where the file will be written (e.g. "/plugins").
file_data
dict
required
A dictionary in the format expected by requests multipart uploads — typically {"files": (filename, file_object, content_type)}.
Returns: requests.Response — A 204 No Content response on success.
with open("myplugin.jar", "rb") as f:
    panel.files.upload("abc123", "/plugins", {"files": ("myplugin.jar", f, "application/java-archive")})

delete

Permanently deletes one or more files or directories from the server. Endpoint: POST /api/client/servers/{server_id}/files/delete
panel.files.delete(server_id, root, files)
server_id
str
required
The short identifier of the target server.
root
str
required
The base directory from which the files paths are resolved (e.g. "/").
files
list[str]
required
A list of file or directory names to delete, relative to root (e.g. ["old-world", "crash.txt"]).
Returns: requests.Response — A 204 No Content response on success.
panel.files.delete("abc123", "/", ["world_nether", "world_the_end"])

rename

Renames one or more files or directories on the server. Endpoint: POST /api/client/servers/{server_id}/files/rename
panel.files.rename(server_id, root, files)
server_id
str
required
The short identifier of the target server.
root
str
required
The base directory containing the files to rename.
files
list[dict]
required
A list of rename operations. Each dict must contain "from" (the current name) and "to" (the new name), both relative to root.
Returns: requests.Response — A 204 No Content response on success.
panel.files.rename("abc123", "/", [
    {"from": "server.properties.bak", "to": "server.properties"}
])

copy

Creates a copy of a file within the server filesystem. Endpoint: POST /api/client/servers/{server_id}/files/copy
panel.files.copy(server_id, root, files)
server_id
str
required
The short identifier of the target server.
root
str
required
The base directory containing the file to copy.
files
list[str]
required
A list of file paths (relative to root) to copy. Pterodactyl appends a suffix to avoid naming conflicts.
Returns: requests.Response — A 204 No Content response on success.
panel.files.copy("abc123", "/", ["server.properties"])

move

Moves one or more files to a new location on the server. Endpoint: POST /api/client/servers/{server_id}/files/move
panel.files.move(server_id, root, files)
server_id
str
required
The short identifier of the target server.
root
str
required
The base directory from which source paths are resolved.
files
list[dict]
required
A list of move operations, each with "from" and "to" keys specifying source and destination paths relative to root.
Returns: requests.Response — A 204 No Content response on success.
panel.files.move("abc123", "/", [
    {"from": "plugins/old-plugin.jar", "to": "plugins/archive/old-plugin.jar"}
])

create_folder

Creates a new directory on the server filesystem. Endpoint: POST /api/client/servers/{server_id}/files/create-folder
panel.files.create_folder(server_id, directory, name)
server_id
str
required
The short identifier of the target server.
directory
str
required
The parent directory in which to create the new folder (sent as the root key in the JSON body).
name
str
required
The name of the new folder to create.
Returns: requests.Response — A 204 No Content response on success.
panel.files.create_folder("abc123", "/plugins", "MyPlugin")

compress

Compresses one or more files into an archive on the server. Endpoint: POST /api/client/servers/{server_id}/files/compress
panel.files.compress(server_id, root, files)
server_id
str
required
The short identifier of the target server.
root
str
required
The directory containing the files to compress.
files
list[str]
required
A list of file or directory names (relative to root) to include in the archive.
Returns: requests.Response — JSON body describes the newly created archive file, including its name and size.
response = panel.files.compress("abc123", "/", ["world", "plugins"])
archive_name = response.json()["attributes"]["name"]
print(f"Created archive: {archive_name}")

decompress

Extracts an archive file in-place on the server. Endpoint: POST /api/client/servers/{server_id}/files/decompress
panel.files.decompress(server_id, file_path)
server_id
str
required
The short identifier of the target server.
file_path
str
required
The full path to the archive file to extract (sent as the file key in the JSON body), e.g. "/archive-2024-01-01.tar.gz".
Returns: requests.Response — A 204 No Content response on success; files are extracted into the same directory as the archive.
panel.files.decompress("abc123", "/archive-2024-01-01.tar.gz")

Build docs developers (and LLMs) love