> ## 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.

# Move or rename an application file

> Move or rename a file inside an application with PATCH /v2/apps/{app_id}/files, from path to to, without re-uploading it or restarting the app.

<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>

Requires an API key with the `files:write` [scope](/en/api-reference/authentication#scopes).

Move File renames or relocates a single file inside an application's storage, from `path` to `to`, without downloading and re-uploading its contents. Use it to reorganize a directory structure or rename a config file in place.

`path` and `to` must both pass path validation and must be different, sending the same value for both is rejected with `INVALID_PATH`. This only moves the file on the running application's storage; it does not restart the process, so a running process reading the old path will not see the change until it reloads or the app is [restarted](/en/api-reference/endpoint/apps/restart). To delete a file instead of moving it, see [Delete File](/en/api-reference/endpoint/apps/filemanager/delete).

On workspace-shared applications the caller needs the `maintain` or `admin` [role](/en/api-reference/endpoint/workspace/members/invite#roles). The restricted-files check applies to both the source and destination names, so a member without that permission cannot rename an allowed file into a protected name like `.env` to plant or overwrite it.

## 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" placeholder="Path to file" required>
  The path of the file to move, up to 256 characters.
</ParamField>

<ParamField body="to" type="string" placeholder="Path to file" required>
  The path to move the file to, up to 256 characters.
</ParamField>

## Response

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

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

## Common errors

| Code | HTTP | Meaning |
| - | - | - |
| `INVALID_PATH` | 400 | `path` or `to` failed validation, or `path` and `to` were identical. |
| `RENAME_FAILED` | 400 | The cluster could not rename the file. |
| `PERMISSION_DENIED` | 403 | The caller lacks the workspace permission to rename a restricted file, checked on both the source and destination names. |

## Related

* CLI: [`squarecloud app file move`](/en/cli-reference/files#squarecloud-app-file-move)
* SDKs: [`api.apps.files.move()`](/en/sdks/js/managing_files) (JavaScript), [`client.apps.files.move()`](/en/sdks/py/managing_files) (Python), [`c.Apps.Files.Move()`](/en/sdks/go/managing_files) (Go)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.