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

> Delete items by id using the Python client

## documents.delete

Delete one or more items by id within a namespace. Missing ids are listed in `not_found_ids` without failing the request. Deleting items frees global item quota immediately.

```python theme={null}
client.documents.delete(namespace_name: str, *, ids: list[str]) -> dict[str, Any]
client.vectors.delete(namespace_name: str, *, ids: list[str]) -> dict[str, Any]
```

Both call the same endpoint. Use whichever matches the resource you uploaded with.

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

### Parameters

<ParamField path="namespace_name" type="string" required>
  Namespace to delete from.
</ParamField>

<ParamField body="ids" type="array" required>
  Non-empty array of item id strings. Maximum **100** ids per request.
</ParamField>

### Examples

```python theme={null}
from moorcheh import MoorchehClient, MoorchehApiError

with MoorchehClient("http://localhost:8080") as client:
    result = client.documents.delete(
        "my-documents",
        ids=["doc-1", "doc-missing"],
    )

    print(result["deleted"], result["not_found_ids"])
    # 1 ['doc-missing']
```

A response with `deleted: 0` means none of the requested ids existed — this is still a successful call, not an exception.

## Returns

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

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

<ResponseField name="namespace_name" type="string">
  Namespace items were deleted from.
</ResponseField>

<ResponseField name="requested" type="number">
  Number of ids sent in the request.
</ResponseField>

<ResponseField name="deleted" type="number">
  Number of items actually removed.
</ResponseField>

<ResponseField name="not_found_ids" type="array">
  Ids that were not found in the namespace (may be empty).
</ResponseField>

```python Example return value (partial) theme={null}
{
  "status": "success",
  "message": "Delete by ids completed.",
  "namespace_name": "my-documents",
  "requested": 2,
  "deleted": 1,
  "not_found_ids": ["doc-missing"],
}
```

```python Example return value (none found) theme={null}
{
  "status": "success",
  "message": "Delete by ids completed.",
  "namespace_name": "my-documents",
  "requested": 2,
  "deleted": 0,
  "not_found_ids": ["doc-missing", "another-missing"],
}
```

### Error Handling

Non-2xx responses raise `MoorchehApiError`. Partial deletes (some ids not found) do **not** raise — check `not_found_ids`.

```python theme={null}
from moorcheh import MoorchehClient, MoorchehApiError

try:
    with MoorchehClient() as client:
        result = client.documents.delete("my-documents", ids=["doc-1"])
except MoorchehApiError as e:
    print(e.status_code, e.body)
```

| Status | Cause                                              |
| ------ | -------------------------------------------------- |
| 400    | Empty `ids`, more than 100 ids, or empty id string |
| 404    | Namespace not found                                |

<Warning>
  * Maximum **100** ids per request
  * Deleting items frees quota toward the global **100,000 item** limit
  * A successful response with `deleted: 0` means none of the requested ids existed
</Warning>

## Related Operations

* [Get Items](/on-prem/python-client/items/get)
* [API: Delete items](/on-prem/api-references/items/delete)
* [CLI: moorcheh items-delete](/on-prem/cli/items/delete)
