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

# Delete File

> Remove a file index using the Python client

## files.delete

Remove a file's index entries. The file on disk is kept. Provide exactly one of `file_id` or `path`.

```python theme={null}
client.files.delete(
    namespace_name: str,
    *,
    file_id: str | None = None,
    path: str | None = None,
) -> dict[str, Any]
```

**API:** `POST /namespaces/{namespace_name}/files/delete` — see [Delete file](/on-prem/api-references/files/delete)

### Examples

```python theme={null}
from pathlib import Path
from moorcheh import MoorchehClient
from moorcheh.docker_runtime import default_upload_dir, host_path_to_container_upload_path

with MoorchehClient("http://localhost:8080") as client:
    # By file_id
    resp = client.files.delete("my-documents", file_id="a1b2c3d4e5f67890")

    # By path (container path)
    upload_root = default_upload_dir()
    host_file = (upload_root / "document.pdf").resolve()
    resp = client.files.delete(
        "my-documents",
        path=host_path_to_container_upload_path(host_file, upload_root),
    )

    job = client.files.job_status("my-documents", resp["job_id"])
```

## Related Operations

* [File Job Status](/on-prem/python-client/files/file-job-status)
* [API: Delete file index](/on-prem/api-references/files/delete)
