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

# Delete Knowledge

Use this API to hard-delete a knowledge source and all its derived chunks and rules. A source that is still `processing`, or that other sources were de-duplicated against, returns `ABORTED` (HTTP 409). The dependents error also carries `details.dependentCount`. Poll [Get Ingest Status](/docs/api-reference/rest-apis/v2/memory/knowledge/ingest-status) until the source is terminal, or delete the dependents first, then retry.

# Endpoint

`POST https://api.velt.dev/v2/memory/knowledge/delete`

Rate limit: 30 requests per minute per API key. This endpoint rejects unrecognized fields, so a misspelled key returns `INVALID_ARGUMENT`.

# Headers

<ParamField header="x-velt-api-key" type="string" required>
  Your API key.
</ParamField>

<ParamField header="x-velt-auth-token" type="string" required>
  Your [Auth Token](/docs/security/auth-tokens).
</ParamField>

# Body

#### Params

<ParamField body="data" type="object" required>
  <Expandable title="properties">
    <ParamField body="sourceId" type="string" required>
      The knowledge source id returned by Ingest Knowledge.
    </ParamField>
  </Expandable>
</ParamField>

## **Example Requests**

#### Delete a source

```JSON theme={null}
{
  "data": {
    "sourceId": "src_9a8..."
  }
}
```

# Response

The response confirms the deletion and reports how many derived chunks and rules were removed. An unknown `sourceId`, or one belonging to another workspace, returns `NOT_FOUND`.

Deleting a de-duplicated source returns `deletedChunks: 0` and `deletedRules: 0`, because its content belongs to the source it was de-duplicated against.

#### Success Response

```JSON theme={null}
{
  "result": {
    "status": "deleted",
    "sourceId": "src_9a8...",
    "deletedChunks": 0,
    "deletedRules": 7
  }
}
```

#### Failure Response

```JSON theme={null}
{
  "error": {
    "message": "ERROR_MESSAGE",
    "status": "INVALID_ARGUMENT"
  }
}
```

<ResponseExample>
  ```js theme={null}
  {
    "result": {
      "status": "deleted",
      "sourceId": "src_9a8...",
      "deletedChunks": 0,
      "deletedRules": 7
    }
  }
  ```
</ResponseExample>
