Create a new file or overwrite an existing one with specified content. The file is created in the specified directory relative to your home directory (/home/{cpanelUsername}/{dir}/{file}). Executable files like .php, .pl, .cgi, .py, .sh, etc., are blocked for security. Maximum file size is 1MB. NOTE: To change PHP version, create/edit .htaccess with: <FilesMatch "\.(php4|php5|php3|php2|php|phtml)$">SetHandler application/x-httpd-alt-phpXX___lsphp</FilesMatch> where XX is the version (e.g., 81 for PHP 8.1, 82 for PHP 8.2).
accountId integer · min: 1 required accountId parameter
Accept Example Content-Type Example dir string required Directory relative to home directory (e.g., 'public_html')
file string required Filename (e.g., 'robots.txt')
content string required File content (max 1MB)
from_charset string Character encoding for content (default: UTF-8)
to_charset string Character encoding for saved file (default: UTF-8)
path string contentLength string cpanelUsername string https://cloud.hostup.se/api/hosting/{accountId}/files/write curl -X POST "https://cloud.hostup.se/api/hosting/0/files/write" \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"dir": "string",
"file": "string",
"content": "string",
"from_charset": "string",
"to_charset": "string"
}' {
"path": "string",
"contentLength": "string",
"cpanelUsername": "string"
} {
"dir": "string",
"file": "string",
"content": "string",
"from_charset": "string",
"to_charset": "string"
}