> ## Documentation Index
> Fetch the complete documentation index at: https://docs.squarecloud.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Create/Modify File

> Create files in your application.

<ParamField header="Authorization" type="string" placeholder="API Key" required>
  The API key for your account. You can find this in your [account settings](https://squarecloud.app/en/account/security).
</ParamField>

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. `content` accepts either a UTF-8 string for text files or a `{ type: "Buffer", data: number[] }` byte array for binary content. 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](/en/api-reference/endpoint/apps/commit) 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 Maintainer or Administrator 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](/en/api-reference/endpoint/apps/restart) to apply changes that need a fresh process.

### Parameters

<ParamField path="app_id" type="string" placeholder="Application ID" required>
  The ID of the application. You can find this in the URL of your application's dashboard.
</ParamField>

<ParamField body="path" type="string" required>
  The path where the file should be created. Example: /test.txt
</ParamField>

<ParamField body="content" type="string" required>
  The content of the file to be created.
</ParamField>

### Response

<ResponseField name="status" type="string">
  Indicates whether the call was successful.. `success` if successful, `error` if not.
</ResponseField>

<ResponseExample>
  ```json theme={null}
  {
      "status": "success"
  }
  ```
</ResponseExample>

### Common errors

| Code                                                                                                            | HTTP | Meaning                                                                               |
| --------------------------------------------------------------------------------------------------------------- | ---- | ------------------------------------------------------------------------------------- |
| `INVALID_PATH`                                                                                                  | 400  | The `path` field failed validation.                                                   |
| `INVALID_CONTENT`                                                                                               | 400  | `content` is missing or empty.                                                        |
| `INVALID_DISPLAY_NAME` / `INVALID_DESCRIPTION` / `INVALID_MEMORY` / `INVALID_AUTORESTART` / `INVALID_SUBDOMAIN` | 400  | A field parsed from a `squarecloud.app`/`squarecloud.config` write failed validation. |
| `CANNOT_SET_SUBDOMAIN`                                                                                          | 400  | The parsed config tried to set a subdomain the plan or account cannot use.            |
| `BLOCKED_PATH`                                                                                                  | 403  | The caller lacks the workspace permission to write to a restricted file.              |
| `SAVE_FAILED`                                                                                                   | 500  | The parsed config update could not be persisted.                                      |
