Skip to main content
Version: v1.0+

File Management

Manage server files and directories including listing, reading, uploading, downloading, and manipulating files.

List Directory Contents

Retrieve the contents of a server directory.

GET /api/client/servers/{server}/files/list

Query Parameters

ParameterTypeDescription
directorystringDirectory path to list (default: /)

Example Request

GET /api/client/servers/{server}/files/list
curl "https://your-panel.com/api/client/servers/d3aac109/files/list?directory=%2F" \
-H "Authorization: Bearer ptlc_YOUR_API_KEY" \
-H "Accept: Application/vnd.pterodactyl.v1+json" \
-H "Content-Type: application/json"

Example Response

{
"object": "list",
"data": [
{
"object": "file_object",
"attributes": {
"name": "server.jar",
"mode": "-rw-r--r--",
"mode_bits": "0644",
"size": 47698923,
"is_file": true,
"is_symlink": false,
"mimetype": "application/java-archive",
"created_at": "2024-01-15T14:30:25+00:00",
"modified_at": "2024-01-15T14:30:25+00:00"
}
},
{
"object": "file_object",
"attributes": {
"name": "logs",
"mode": "drwxr-xr-x",
"mode_bits": "0755",
"size": 4096,
"is_file": false,
"is_symlink": false,
"mimetype": "inode/directory",
"created_at": "2024-01-15T14:30:25+00:00",
"modified_at": "2024-01-15T14:30:25+00:00"
}
},
{
"object": "file_object",
"attributes": {
"name": "world",
"mode": "drwxr-xr-x",
"mode_bits": "0755",
"size": 4096,
"is_file": false,
"is_symlink": false,
"mimetype": "inode/directory",
"created_at": "2024-01-15T14:30:25+00:00",
"modified_at": "2024-01-15T14:30:25+00:00"
}
}
]
}

Read File Contents

Read the contents of a specific file.

GET /api/client/servers/{server}/files/contents

Query Parameters

ParameterTypeDescription
filestringPath to the file to read

Example Request

GET /api/client/servers/{server}/files/contents
curl "https://your-panel.com/api/client/servers/d3aac109/files/contents?file=%2Fserver.properties" \
-H "Authorization: Bearer ptlc_YOUR_API_KEY" \
-H "Accept: Application/vnd.pterodactyl.v1+json" \
-H "Content-Type: application/json"

Example Response (Plain Text)

# Minecraft server properties
server-port=25565
gamemode=survival
max-players=20
online-mode=true
difficulty=normal
spawn-protection=16
white-list=false
generate-structures=true
allow-flight=false

Write File Contents

Create or update a file with new content.

POST /api/client/servers/{server}/files/write

Query Parameters

ParameterTypeDescription
filestringPath to the file to write

Request Body

Send the file content as raw text in the request body.

Example Request

POST /api/client/servers/{server}/files/write
curl -X POST "https://your-panel.com/api/client/servers/d3aac109/files/write?file=%2Fserver.properties" \
-H "Authorization: Bearer ptlc_YOUR_API_KEY" \
-H "Accept: Application/vnd.pterodactyl.v1+json" \
-H "Content-Type: text/plain" \
-d "# Minecraft server properties
server-port=25565
gamemode=survival
max-players=30
online-mode=true
difficulty=hard"

Success Response (204)

Returns empty response body with status code 204.


Upload Files

Upload files to the server via multipart form data.

GET /api/client/servers/{server}/files/upload

Example Request

GET /api/client/servers/{server}/files/upload
curl -X GET "https://your-panel.com/api/client/servers/d3aac109/files/upload" \
-H "Authorization: Bearer ptlc_YOUR_API_KEY" \
-H "Accept: Application/vnd.pterodactyl.v1+json" \
-F "files[]=@/path/to/local/file.txt" \
-F "directory=/"

Upload Limits

LimitValue
Maximum file size100 MB per file
Maximum files per request10 files
Allowed file typesAll types (configurable by admin)

Download File

Download a file from the server.

GET /api/client/servers/{server}/files/download

Query Parameters

ParameterTypeDescription
filestringPath to the file to download

Example Request

GET /api/client/servers/{server}/files/download
curl "https://your-panel.com/api/client/servers/d3aac109/files/download?file=%2Fbackups%2Fworld.zip" \
-H "Authorization: Bearer ptlc_YOUR_API_KEY" \
-H "Accept: Application/vnd.pterodactyl.v1+json" \
-o "world.zip"

Create Directory

Create a new directory on the server.

POST /api/client/servers/{server}/files/create-folder

Request Body

FieldTypeRequiredDescription
rootstringYesParent directory path
namestringYesDirectory name to create

Example Request

curl -X POST "https://your-panel.com/api/client/servers/d3aac109/files/create-folder" \
-H "Authorization: Bearer ptlc_YOUR_API_KEY" \
-H "Accept: Application/vnd.pterodactyl.v1+json" \
-H "Content-Type: application/json" \
-d '{
"root": "/",
"name": "plugins"
}'

Success Response (204)

Returns empty response body with status code 204.


Copy Files

Copy files or directories to a new location.

POST /api/client/servers/{server}/files/copy

Request Body

FieldTypeRequiredDescription
locationstringYesSource file/directory path

Example Request

curl -X POST "https://your-panel.com/api/client/servers/d3aac109/files/copy" \
-H "Authorization: Bearer ptlc_YOUR_API_KEY" \
-H "Accept: Application/vnd.pterodactyl.v1+json" \
-H "Content-Type: application/json" \
-d '{
"location": "/world"
}'

Creates a copy of the file/directory with "_copy" appended to the name.

Success Response (204)

Returns empty response body with status code 204.


Rename Files

Rename or move files and directories.

PUT /api/client/servers/{server}/files/rename

Request Body

FieldTypeRequiredDescription
rootstringYesParent directory
filesarrayYesArray of rename operations

Files Array Structure

FieldTypeRequiredDescription
fromstringYesCurrent filename
tostringYesNew filename

Example Request

curl -X PUT "https://your-panel.com/api/client/servers/d3aac109/files/rename" \
-H "Authorization: Bearer ptlc_YOUR_API_KEY" \
-H "Accept: Application/vnd.pterodactyl.v1+json" \
-H "Content-Type: application/json" \
-d '{
"root": "/",
"files": [
{
"from": "old_name.txt",
"to": "new_name.txt"
}
]
}'

Success Response (204)

Returns empty response body with status code 204.


Delete Files

Delete files or directories from the server.

POST /api/client/servers/{server}/files/delete

Request Body

FieldTypeRequiredDescription
rootstringYesParent directory
filesarrayYesArray of filenames to delete

Example Request

curl -X POST "https://your-panel.com/api/client/servers/d3aac109/files/delete" \
-H "Authorization: Bearer ptlc_YOUR_API_KEY" \
-H "Accept: Application/vnd.pterodactyl.v1+json" \
-H "Content-Type: application/json" \
-d '{
"root": "/",
"files": [
"unnecessary_file.txt",
"old_backup.zip"
]
}'

Success Response (204)

Returns empty response body with status code 204.

Permanent Deletion

File deletion is permanent and cannot be undone. Always ensure you have backups before deleting important files.


Compress Files

Create an archive (ZIP/TAR) from files and directories.

POST /api/client/servers/{server}/files/compress

Request Body

FieldTypeRequiredDescription
rootstringYesRoot directory
filesarrayYesFiles/directories to compress

Example Request

curl -X POST "https://your-panel.com/api/client/servers/d3aac109/files/compress" \
-H "Authorization: Bearer ptlc_YOUR_API_KEY" \
-H "Accept: Application/vnd.pterodactyl.v1+json" \
-H "Content-Type: application/json" \
-d '{
"root": "/",
"files": [
"world",
"plugins"
]
}'

Example Response

{
"object": "file_object",
"attributes": {
"name": "archive-2024-01-15-143025.tar.gz",
"mode": "-rw-r--r--",
"mode_bits": "0644",
"size": 125829120,
"is_file": true,
"is_symlink": false,
"mimetype": "application/gzip",
"created_at": "2024-01-15T14:30:25+00:00",
"modified_at": "2024-01-15T14:30:25+00:00"
}
}

Decompress Files

Extract files from an archive.

POST /api/client/servers/{server}/files/decompress

Request Body

FieldTypeRequiredDescription
rootstringYesDirectory containing the archive
filestringYesArchive filename

Example Request

curl -X POST "https://your-panel.com/api/client/servers/d3aac109/files/decompress" \
-H "Authorization: Bearer ptlc_YOUR_API_KEY" \
-H "Accept: Application/vnd.pterodactyl.v1+json" \
-H "Content-Type: application/json" \
-d '{
"root": "/",
"file": "backup.zip"
}'

Success Response (204)

Returns empty response body with status code 204.

Supported Archive Types

ExtensionFormatDescription
.zipZIPMost common format
.tarTARUncompressed tarball
.tar.gzTAR+GZIPCompressed tarball
.tar.bz2TAR+BZIP2Compressed tarball

Change File Permissions

Modify file or directory permissions (chmod).

POST /api/client/servers/{server}/files/chmod

Request Body

FieldTypeRequiredDescription
rootstringYesParent directory
filesarrayYesArray of permission changes

Files Array Structure

FieldTypeRequiredDescription
filestringYesFilename
modestringYesOctal permission mode (e.g., "755", "644")

Example Request

curl -X POST "https://your-panel.com/api/client/servers/d3aac109/files/chmod" \
-H "Authorization: Bearer ptlc_YOUR_API_KEY" \
-H "Accept: Application/vnd.pterodactyl.v1+json" \
-H "Content-Type: application/json" \
-d '{
"root": "/",
"files": [
{
"file": "start.sh",
"mode": "755"
},
{
"file": "config.yml",
"mode": "644"
}
]
}'

Success Response (204)

Returns empty response body with status code 204.

Common Permission Modes

ModeDescriptionSymbolic
755rwxr-xr-xFull access for owner, read+execute for others
644rw-r--r--Read+write for owner, read-only for others
600rw-------Read+write for owner only
777rwxrwxrwxFull access for everyone (not recommended)

Pull Remote File

Download a file from a URL directly to the server.

POST /api/client/servers/{server}/files/pull

Request Body

FieldTypeRequiredDescription
urlstringYesURL of the file to download
directorystringYesDirectory to save the file
filenamestringNoCustom filename (optional)

Example Request

curl -X POST "https://your-panel.com/api/client/servers/d3aac109/files/pull" \
-H "Authorization: Bearer ptlc_YOUR_API_KEY" \
-H "Accept: Application/vnd.pterodactyl.v1+json" \
-H "Content-Type: application/json" \
-d '{
"url": "https://piston-data.mojang.com/v1/objects/8dd1a28015f51b1803213892b50b7b4fc76e594d/server.jar",
"directory": "/",
"filename": "server.jar"
}'

Success Response (204)

Returns empty response body with status code 204.

Remote Pull Limitations

  • Maximum file size: 1 GB
  • Timeout: 5 minutes
  • Only HTTP/HTTPS URLs allowed
  • Some panel configurations may restrict certain domains

Required Permissions

PermissionDescription
file.readView file contents and directory listings
file.read-contentRead individual file contents
file.createCreate new files and directories
file.updateModify existing files
file.deleteDelete files and directories
file.archiveCreate and extract archives
file.sftpAccess files via SFTP

Security Best Practices

  1. File Size Limits: Be aware of upload and download limits
  2. Path Traversal: The API prevents access outside the server directory
  3. File Types: Some file extensions may be restricted by server configuration
  4. Permissions: Always use the minimum required file permissions
  5. Backups: Create backups before making bulk changes

Source References

Controller: FileController
Routes: api-client.php - File management endpoints
Wings Integration: Wings Server Code - File operations

Next Steps