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

> Remove a file's chunks and summaries from the index. The source file on disk is kept.

## Overview

Deletes all indexed chunks and summary chunks for one file, and removes its file registry entry. The PDF or document under `~/.moorcheh/uploads` is **not** deleted.

Provide **exactly one** of `path` or `file_id`.

## Path parameters

<ParamField path="namespace_name" type="string" required>
  Text namespace.
</ParamField>

## Body

<ParamField body="path" type="string">
  Container path (e.g. `/uploads/document.pdf`). Must match the path used at upload.
</ParamField>

<ParamField body="file_id" type="string">
  File id from [List files](/on-prem/api-references/files/list).
</ParamField>

<Note>
  Direct API calls use **container paths**. The CLI accepts a host path under `~/.moorcheh/uploads` and converts it automatically.
</Note>

## Request examples

```bash theme={null}
# By container path
curl -X POST "http://localhost:8080/namespaces/my-documents/files/delete" \
  -H "Content-Type: application/json" \
  -d '{"path": "/uploads/document.pdf"}'

# By file_id
curl -X POST "http://localhost:8080/namespaces/my-documents/files/delete" \
  -H "Content-Type: application/json" \
  -d '{"file_id": "a1b2c3d4e5f67890"}'
```

## Response fields

<ResponseField name="status" type="string">
  `"success"` when the delete job started.
</ResponseField>

<ResponseField name="message" type="string">
  Human-readable result.
</ResponseField>

<ResponseField name="job_id" type="string">
  Async job id. Poll with [File job status](/on-prem/api-references/files/file-job-status) (`job_type`: `file_delete`).
</ResponseField>

<ResponseField name="file_id" type="string">
  File id being deleted.
</ResponseField>

<ResponseField name="namespace_name" type="string">
  Target namespace.
</ResponseField>

<ResponseField name="absolute_path" type="string">
  Container path of the file being deleted.
</ResponseField>

<ResponseExample>
  ```json 202 - Delete started theme={null}
  {
    "status": "success",
    "message": "File delete started. Poll file job status for progress.",
    "job_id": "job-39e12e05109c45bb8f477edb1912964d",
    "file_id": "a1b2c3d4e5f67890",
    "namespace_name": "my-documents",
    "absolute_path": "/uploads/document.pdf"
  }
  ```
</ResponseExample>

## Errors

| HTTP | Cause                                                          |
| ---- | -------------------------------------------------------------- |
| 400  | Both or neither of `path` and `file_id` provided; invalid path |
| 404  | Namespace or file not found                                    |

## Related

* [File job status](/on-prem/api-references/files/file-job-status)
* [CLI: moorcheh delete-file](/on-prem/cli/files/delete-file)
* [Python: files.delete()](/on-prem/python-client/files/delete-file)
