> ## Documentation Index
> Fetch the complete documentation index at: https://wordsmithai.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Remove Document

> Remove a document from a repository. Its file is deleted with it.

> [!NOTE]
>
> **Preview.** This endpoint is available to organisations in the Wordsmith MCP pilot. Other organisations receive `403 mcp_not_enabled`. See the [preview overview](/preview).

Removes one document from a repository and from the search index. The file behind it is deleted too: the repository owns the file of each document it holds (see [Add Documents](/api-reference/repositories/add-documents)), so that `file_id` stops working. Download it first if you need to keep it.

Only a document added as a file can be removed on its own. A document synced from a connected source, such as a SharePoint folder, comes back on the next sync: remove the source in the app instead.

Reports whose rows follow this repository lose the document's row and its cells.

## Authentication

Requires an API key, or an OAuth token with `repositories:write`. The caller also needs edit access to the repository.

## Path parameters

**repository\_id** `string` *required*

The repository id.

**document\_id** `string` *required*

The document id, not the `file_id`.

## Response

Returns `204` with no body. The document disappears from listings at once; its file and index entries are removed in the background.

```bash cURL theme={null}
curl -X DELETE "https://api.wordsmith.ai/api/v1/repositories/b23066a1-44cb-4b31-8b44-c723dc507d9b/documents/612bf514-5c3e-468b-9782-d5d5a635b72d" \
  -H "Authorization: Bearer sk-ws-api1-your_api_key_here"
```

```text Response theme={null}
204 No Content
```

## Errors

| Status | `error_code` | When |
| - | - | - |
| 400 | `bad_request` | The document is synced from a connected source. |
| 401 | `unauthorized` | The API key or token is missing or invalid. |
| 403 | `mcp_not_enabled` | Your organisation is not in the preview. |
| 403 | `forbidden` | The caller can read the repository but cannot edit it. |
| 404 | `resource_not_found` | No repository or document with these ids, or the caller cannot read the repository. |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.