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

# Delete File

> Delete a file from 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>

Delete File removes a single file from a running application by path, without touching the rest of the file tree or restarting the process. Use it for cleaning up generated files, old logs, or stray uploads without redeploying.

The deletion happens directly on the application's storage on the cluster node, so it takes effect immediately; there is no undo short of restoring from a prior [snapshot](/en/api-reference/endpoint/apps/snapshots/restore). To remove a whole application instead of one file, see [Delete Application](/en/api-reference/endpoint/apps/delete). To rename or move a file instead of deleting it, use [Move File](/en/api-reference/endpoint/apps/filemanager/patch).

On workspace-shared applications the caller needs the Maintainer or Administrator role. Members without the restricted-files permission cannot delete files on the excluded list (such as `.env` or `.env.production`), the request is rejected with `PERMISSION_DENIED` first.

### 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 delete.
</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 (traversal, invalid characters, or too long). |
| `DELETE_FAILED`     | 400  | The cluster could not delete the file.                                           |
| `PERMISSION_DENIED` | 403  | The caller lacks the workspace permission to delete a restricted file.           |
