---
title: "Delete a document (requires explicit confirmation)."
method: DELETE
path: "/v1/documents/{document_id}"
tags: ["documents"]
---

# Delete a document (requires explicit confirmation).

`DELETE /v1/documents/{document_id}`

## Request

- Base URL: `https://api.andish.ru` (the document declares no server; this is the origin it was published from)
- URL: `https://api.andish.ru/v1/documents/{document_id}`
- Auth: none declared

Deletes a document from the tenant's knowledge graph.

**Without confirm=true (default):** Returns 409 Conflict with a ``deletion_impact`` preview so the caller can make an informed decision about orphaned entities.

**With confirm=true:** Runs the cascade (chunks → relations → optionally exclusive entities → vectors → document row) inside a single RLS-scoped transaction and returns 204 No Content with an ``X-Deletion-Impact`` header carrying the pre-deletion counters (chunks, edges, entities_removed, entities_preserved).

Cross-tenant: returns 404 uniformly (RLS-transparent, no tenant leak).

## Path parameters

- `document_id` string, uuid, required: Document UUID.

## Query parameters

- `confirm` boolean: Must be true to proceed with deletion. Omit (or false) to receive a 409 with deletion impact preview.
- `remove_orphans` boolean: When confirm=true: if true (default), exclusive-to-this-doc entities are deleted along with their graph nodes and edges; if false, VDB entities are preserved as orphans (graph nodes/edges are still cleaned regardless, as they always become stale after document deletion).

## Response `204`

Deletion complete; X-Deletion-Impact header carries the pre-cascade counters.

## Other responses

- `404`: Document not found (or belongs to another tenant).
- `409`: Confirmation required — impact preview returned.
- `422`: Validation Error

---

[API](https://skmtc.dev/andish/apis/mnemo-api.md) · [All operations](https://skmtc.dev/andish/apis/mnemo-api/llms.txt) · [OpenAPI document](https://skmtc.dev/andish/apis/mnemo-api/revisions/d5449f23414c?raw)
