Endpoint
Authentication
Requires Bearer token authentication via theAuthorization header.
Path Parameters
The UUID of the server
Request Body
The path to the destination file (relative to server root)
Query Parameters
The source file path to copy (relative to server root)
Response
Returns204 No Content on success.
Example Request
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
400 Bad Request
400 Bad Request
Source is a directory (not supported)
401 Unauthorized
401 Unauthorized
403 Forbidden
403 Forbidden
File is on the ignore list or path traversal attempt
404 Not Found
404 Not Found
Server or source file does not exist
500 Internal Server Error
500 Internal Server Error
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)