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

# Forget Knowledge

> Remove a document from knowledge

## Overview

Removes a document from knowledge. Choose how far it goes:

| Mode | What it does |
| - | - |
| `withdraw` | Removes the content but keeps a record that the document existed and when it was withdrawn |
| `delete` (default) | Removes the document entirely |
| `erase` | Also removes the original uploaded file, facts that were extracted from it, and its text from past run records |

> [!NOTE]
>
> Changes data, so it needs a key that isn't read-only.

Operation name: `knowledge.forget`.

## Authorization

**x-api-key** `string` *required*

Your Composer API key

## Headers

**Content-Type** `string` *required*

Must be set to application/json

## Body

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

The document to remove, from List Knowledge.

```json Example theme={null}
"document_id": "c41d2e7a-6b5f-4a3e-8d9c-0b1a2f3e4d5c"
```

**mode** `string`

`withdraw`, `delete` (default) or `erase`.

```json Example theme={null}
"mode": "delete"
```

```json Example Request theme={null}
{
  "document_id": "c41d2e7a-6b5f-4a3e-8d9c-0b1a2f3e4d5c",
  "mode": "delete"
}
```

***

## Response

**document\_id** `string`

The document removed.

**collection** `string`

Its collection.

**mode** `string`

The mode used.

```json Example Success Response theme={null}
{
  "document_id": "c41d2e7a-6b5f-4a3e-8d9c-0b1a2f3e4d5c",
  "collection": "semantic",
  "mode": "delete"
}
```

***

## Example cURL

```bash cURL theme={null}
curl --request POST 'https://composer.personal.ai/lab/api/v1/op/knowledge.forget' \
--header 'Content-Type: application/json' \
--header 'x-api-key: <your-api-key>' \
--data '{"document_id": "c41d2e7a-6b5f-4a3e-8d9c-0b1a2f3e4d5c", "mode": "delete"}'
```

***

## Error Codes

| Code | Description |
| - | - |
| 400 | The body doesn't match the fields above, or the operation failed. The response body says why. |
| 401 | Missing or invalid API key |
| 403 | This key isn't allowed to call this operation (for example, a read-only key) |


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