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

# Remove File

> Remove a file or directory from a sandbox.

Removes the file or directory (recursively) at the given path inside the sandbox.
Returns an empty `{}` body regardless of whether the path existed — the operation
is idempotent.

<Warning>
  Directory removal is recursive. All files and subdirectories under the specified
  path are permanently deleted.
</Warning>

## Path Parameters

<ParamField path="sandbox_id" type="string" required>
  The sandbox identifier. Format: `sbx-<8 chars>`.
</ParamField>

## Query Parameters

<ParamField query="path" type="string" required>
  Absolute path of the file or directory to remove inside the sandbox.

  Example: `/home/user/old-results/`
</ParamField>

## Response

Returns an empty JSON object `{}`.

## Example

<CodeGroup>
  ```bash cURL theme={null}
  curl -X DELETE "https://api.declaw.ai/sandboxes/sbx-a1b2c3d4/files?path=/home/user/old-results" \
    -H "X-API-Key: YOUR_API_KEY"
  ```

  ```python Python theme={null}
  from declaw import Sandbox

  sbx = Sandbox.connect("sbx-a1b2c3d4", api_key="YOUR_API_KEY", domain="api.declaw.ai")
  sbx.files.remove("/home/user/old-results")
  ```

  ```typescript TypeScript theme={null}
  import { Sandbox } from "@declaw/sdk";

  const sbx = await Sandbox.connect("sbx-a1b2c3d4", {
    apiKey: "YOUR_API_KEY",
    domain: "api.declaw.ai",
  });
  await sbx.files.remove("/home/user/old-results");
  ```
</CodeGroup>

```json Response theme={null}
{}
```

## Error Responses

| Status | Cause                      |
| ------ | -------------------------- |
| `401`  | Missing or invalid API key |
| `404`  | Sandbox not found          |
| `503`  | Sandbox has no VM          |
