Skip to main content

Endpoint

POST /api/servers/:server/files/delete

Authentication

Requires Bearer token authentication via the Authorization header.

Path Parameters

server
string
required
The UUID of the server

Request Body

root
string
required
The root directory for delete operations (all paths are relative to this)
files
string[]
required
Array of file/directory paths to delete (relative to root)

Response

Returns 204 No Content on success.

Example Request

curl -X POST "https://wings.example.com/api/servers/d3aac109-f0fc-4674-b5bc-199bb50e6b88/files/delete" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "root": "/",
    "files": ["old-log.txt"]
  }'

Behavior

  • Both files and directories can be deleted
  • Directories are deleted recursively (all contents removed)
  • Operations are performed concurrently for better performance
  • If a file doesn’t exist, the operation is skipped (no error)
  • Ignored files (.pteroignore) are protected and cannot be deleted
  • Path traversal is prevented
  • Symlinks are followed and the target is deleted
Deletion is permanent and cannot be undone. Ensure you have backups before deleting important files or directories.

Error Responses

Missing or invalid Bearer token
File is on the ignore list or path traversal attempt
Server does not exist
Failed to delete file (permission error, file in use, etc.)

Use Cases

  • Clean up temporary files
  • Remove old logs
  • Delete unused plugins
  • Clear cache directories
  • Remove outdated backups
  • Batch delete operations

Source Reference

Implementation: router/router_server_files.go (postServerDeleteFiles function)

Build docs developers (and LLMs) love