Endpoint
Authentication
Requires Bearer token authentication via theAuthorization header.
Path Parameters
The UUID of the server
Query Parameters
The file path to write (relative to server root)
Request Body
Raw file contents to write. TheContent-Type should be set appropriately for the file being written.
Response
Returns204 No Content on success.
Example Request
Behavior
- Creates the file if it doesn’t exist
- Overwrites the file completely if it already exists
- Creates parent directories automatically if they don’t exist
- Sets appropriate file permissions based on server user configuration
- Path traversal is prevented
- Ignored files (
.pteroignore) cannot be written
Error Responses
401 Unauthorized
401 Unauthorized
403 Forbidden
403 Forbidden
File is on the ignore list (.pteroignore) or path traversal attempt detected
404 Not Found
404 Not Found
Server does not exist
500 Internal Server Error
500 Internal Server Error
Failed to write file (disk full, permission error, etc.)
Use Cases
- Update configuration files
- Modify server settings
- Create new script files
- Edit whitelist/ban lists
Source Reference
Implementation:router/router_server_files.go (postServerWriteFile function)