Skip to main content

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.

Overview

Delete one or more items by id within a namespace. Item ids are unique per namespace, not globally. Missing ids are listed in not_found_ids without failing the request. Deleting items frees global item quota immediately. Works for both text and vector namespaces.

Method

client.delete_namespace_items(namespace_name: str, payload: dict) -> dict

API

POST /namespaces/{namespace_name}/items/delete — see Delete items

Parameters

namespace_name
string
required
Namespace to delete from.
ids
array
required
Non-empty array of item id strings. Maximum 100 ids per request.

Example

from moorcheh import MoorchehApiClient, MoorchehApiError

client = MoorchehApiClient("http://localhost:8080")

result = client.delete_namespace_items("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

status
string
"success" when the delete request completed.
message
string
Human-readable result description.
namespace_name
string
Namespace items were deleted from.
requested
number
Number of ids sent in the request.
deleted
number
Number of items actually removed.
not_found_ids
array
Ids that were not found in the namespace (may be empty).
Example return value (partial)
{
  "status": "success",
  "message": "Delete by ids completed.",
  "namespace_name": "my-documents",
  "requested": 2,
  "deleted": 1,
  "not_found_ids": ["doc-missing"],
}
Example return value (none found)
{
  "status": "success",
  "message": "Delete by ids completed.",
  "namespace_name": "my-documents",
  "requested": 2,
  "deleted": 0,
  "not_found_ids": ["doc-missing", "another-missing"],
}

Errors

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

try:
    result = client.delete_namespace_items("my-documents", {"ids": ["doc-1"]})
except MoorchehApiError as e:
    print(e.status_code, e.body)
StatusCause
400Empty ids, more than 100 ids, or empty id string
404Namespace not found
  • 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