Skip to main content

Endpoint

POST /api/servers/:server/files/copy

Authentication

Requires Bearer token authentication via the Authorization header.

Path Parameters

server
string
required
The UUID of the server

Request Body

location
string
required
The path to the destination file (relative to server root)

Query Parameters

file
string
required
The source file path to copy (relative to server 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/copy?file=server.properties" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"location": "server.properties.bak"}'

Behavior

  • Creates a complete copy of the source file
  • Only files can be copied (not directories)
  • Parent directories in the destination path are created automatically
  • File permissions and ownership are preserved
  • If destination file already exists, it will be overwritten
  • Ignored files (.pteroignore) cannot be copied to or from
  • Path traversal is prevented
To copy directories, use the compress endpoint to create an archive, then decompress it to the new location.

Error Responses

Source is a directory (not supported)
Missing or invalid Bearer token
File is on the ignore list or path traversal attempt
Server or source file does not exist
Failed to copy file (disk full, permission error, etc.)

Use Cases

  • Create backup copies of important files
  • Duplicate configuration for testing
  • Copy template files
  • Create snapshots before modifications

Source Reference

Implementation: router/router_server_files.go (postServerCopyFile function)

Build docs developers (and LLMs) love