Delete a document (irreversible)
frappe_delete_docPermanently deletes a Frappe document by DocType and exact name; use only for disposable or test records because deletion is irreversible and blocked by linked records.
Instructions
Permanently delete a document by its doctype and name.
Use only for genuinely disposable records such as ToDo or Note, or for a test document created moments earlier — the deletion is irreversible, with no undo and no recycle bin. Prefer frappe_update_doc to set a status such as 'Cancelled' whenever an audit trail matters, which covers most transactional records (Sales Invoice, Sales Order, Payment Entry, Journal Entry).
Behavior: writes to the site. Not idempotent from the caller's point of view — a second call for the same name raises a not-found error. Frappe refuses the delete while other documents link to this one, so a link-exists error means the dependants must be handled first. Deleting a parent removes its child-table rows with it. Submitted documents must be cancelled before they can be deleted. Requires delete permission on the DocType.
Parameters: name is the exact name primary key, not a title, and a wrong value deletes the wrong record with no warning — confirm with frappe_get_doc first when there is any doubt. One document per call: there is no bulk mode and no dry-run, and the deletion is committed as soon as the call is accepted.
Returns: {"message": "ok"} on success.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | The exact `name` primary key of the document to permanently remove (e.g. 'TODO-00001', 'NOTE-00001'). This operation cannot be undone, so verify the value identifies the intended record before calling. | |
| doctype | Yes | The DocType of the document to delete (e.g. 'ToDo', 'Note', 'Contact', 'Address'). WARNING: deleting a transactional or parent document removes its child rows and may be blocked by, or orphan, linked records. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| data | No | Present instead of `message` when the site answers 202 Accepted; the value is 'accepted'. | |
| message | No | Confirmation string returned by Frappe, typically 'ok'. |