Create or update an application file
Create or overwrite a file in an application with PUT /v2/apps//files. Send base64 content for binary files, up to 10 MB each, with no restart.
PUT
Create or update an application file
string
required
The API key for your account. You can find this in your account settings.
files:write scope.
Create/Modify File writes content to path inside a running application, creating the file if it does not exist or overwriting it if it does. For binary files, send content base64-encoded together with encoding: "base64", the recommended format. content also accepts a UTF-8 string for text files, a plain array of byte values ([104, 105]) or a { type: "Buffer", data: number[] } object. An empty content ("" or []) writes an empty file. Each write takes up to 10 MB, measured on the decoded bytes. Writes are rate limited to 10 requests every 5 seconds per user. Use it for small, targeted edits, such as tweaking a config value or dropping in a generated file, without re-uploading the whole application; for bulk changes or a .zip, use Commit Application instead.
Writing to squarecloud.app or squarecloud.config is treated specially: the platform parses it as the application’s config (display name, description, memory, autorestart, subdomain) and validates each field, an invalid value returns a specific error code (for example INVALID_MEMORY or INVALID_SUBDOMAIN) instead of writing the file. These config rewrites are rate limited to 1 request every 15 seconds per user.
On workspace-shared applications the caller needs the maintain or admin role, and members without the restricted-files permission are blocked from writing to excluded paths like .env. Like other file manager routes, this does not restart the application, call Restart Application to apply changes that need a fresh process.
Parameters
string
required
The ID of the application. You can find this in the URL of your application’s dashboard.
string
required
The path where the file should be created, up to 256 characters. Example: /test.txt
string | number[]
required
The content of the file to be created: base64 when
encoding is base64, otherwise a UTF-8 string or an array of bytes.string
Set to
base64 when content is the file base64-encoded. Recommended for binary files.Response
string
Indicates whether the call was successful:
success if it was, error if not.Common errors
Related
- CLI:
squarecloud app file write - SDKs:
api.apps.files.write()(JavaScript),client.apps.files.write()(Python),c.Apps.Files.Write()(Go)

