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

# Delete Knowledge Source

> Remove a knowledge source from your account

Delete a knowledge source and all its associated embeddings from the vector database.

<Warning>
  This action is irreversible. All chunks and embeddings from this source will be permanently deleted.
</Warning>

## Request Body

<ParamField body="source_id" type="string" required>
  The unique identifier of the knowledge source to delete.
</ParamField>

## Response

<ResponseField name="success" type="boolean">
  Whether the source was deleted successfully.
</ResponseField>

<ResponseField name="chunks_deleted" type="integer">
  Number of chunks removed from the vector database.
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://api.magpipe.ai/functions/v1/delete-knowledge-source \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"source_id": "f7a8b9c0-d1e2-3f4a-5b6c-789012def345"}'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch(
    'https://api.magpipe.ai/functions/v1/delete-knowledge-source',
    {
      method: 'POST',
      headers: {
        'Authorization': 'Bearer YOUR_API_KEY',
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        source_id: 'f7a8b9c0-d1e2-3f4a-5b6c-789012def345'
      }),
    }
  );

  const result = await response.json();
  console.log(`Deleted ${result.chunks_deleted} chunks`);
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      'https://api.magpipe.ai/functions/v1/delete-knowledge-source',
      headers={
          'Authorization': 'Bearer YOUR_API_KEY',
          'Content-Type': 'application/json',
      },
      json={'source_id': 'f7a8b9c0-d1e2-3f4a-5b6c-789012def345'}
  )

  result = response.json()
  print(f"Deleted {result['chunks_deleted']} chunks")
  ```
</RequestExample>

<ResponseExample>
  ```json Success Response theme={null}
  {
    "success": true,
    "chunks_deleted": 24
  }
  ```

  ```json Error Response theme={null}
  {
    "error": {
      "code": "source_not_found",
      "message": "Knowledge source not found"
    }
  }
  ```
</ResponseExample>
