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

> Move a file 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>

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 Maintainer or Administrator role. 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.
</ParamField>

<ParamField body="to" type="string" placeholder="Path to file" required>
  The path to move the file to.
</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  | `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. |
