# Delete a retrieval document

```http
DELETE /projects/{project_reference}/knowledge/retrieval-documents/{retrieval_document_id}
```

Delete retrieval document. Requires project.knowledge.write; API keys also need delete scope.

## Parameters

| Name                    | In    | Required | Description                                                                                                                                                                                                                                                   |
| ----------------------- | ----- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `project_reference`     | path  | Yes      |                                                                                                                                                                                                                                                               |
| `retrieval_document_id` | path  | Yes      | Retrieval document ID.                                                                                                                                                                                                                                        |
| `expected_revision`     | query |          | Delete only this observed revision. A changed record is a conflict; a missing record is not\_found. Delete the record before removing its chunks, as ragStore().removeDocument() does, so a concurrent refresh cannot publish through a still-visible record. |

## Responses

| Status | Description                                                                 |
| ------ | --------------------------------------------------------------------------- |
| 200    | The record was deleted.                                                     |
| 400    | invalid\_input: invalid ID or expected\_revision                            |
| 401    | unauthenticated                                                             |
| 403    | forbidden: the credential lacks project.knowledge.write or the delete scope |
| 404    | not\_found: project or retrieval document not found                         |
| 409    | conflict: the record changed since expected\_revision was read              |
| 500    | internal                                                                    |
