> ## 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 an application file

> Delete a single file from an application by path with DELETE /v2/apps/{app_id}/files. It takes effect at once, without restarting or redeploying 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).

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 `maintain` or `admin` [role](/en/api-reference/endpoint/workspace/members/invite#roles). 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, 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 | The `path` field failed validation (traversal, invalid characters, or longer than 256 characters). |
| `DELETE_FAILED` | 400 | The cluster could not delete the file. |
| `PERMISSION_DENIED` | 403 | The caller lacks the workspace permission to delete a restricted file. |

## Related

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


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