> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://api.logicdialog.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://api.logicdialog.ai/_mcp/server.

# Receive a knowledge deletion

DELETE https://app.logicdialog.ai/knowledge/hooks/{workspaceId}/{environment}/{sourceKey}

Authenticates a deployed source token and durably queues the event before returning HTTP 200. No publishing occurs in the request. Preserve the WordPress post_id/post_type/post_url, Umbraco Id/CreateDate/Properties, or Power Automate filename/file.$content payload. Knowledge API sources accept JSON document upserts using a source article ID from meta.description.id, id or externalId (_id is a last fallback). DELETE supports Power Automate filenames and Knowledge API document IDs. Retries with an Idempotency-Key must use identical payloads; receipts are retained for 30 days. Without that header, only consecutive identical events are deduplicated. Processing requires the knowledge worker.

Reference: https://api.logicdialog.ai/api-reference/knowledge/delete-knowledge-hook

## Authentication

- `Authorization` header (bearer token, required) — Source-specific webhook token shown when configuring the knowledge source; activated only after deployment.

## Request

### Path parameters

- `workspaceId` (string, required)
- `environment` (string, required)
- `sourceKey` (string, required)

### Query parameters

- `filename` (string, optional) — DOCX filename, or supply filename in the JSON body.

### Headers

- `Idempotency-Key` (string, optional)

## Response

### 200

Event persisted; may already have been accepted

- `accepted` (boolean, optional)
- `id` (string, optional)
- `duplicate` (boolean, optional)

## Errors

### 400 Bad Request Error

Invalid document ID or payload

- `any`

### 401 Unauthorized Error

Invalid token

- `any`

### 404 Not Found Error

Unknown or inactive source

- `any`

### 409 Conflict Error

Event ID reused with different content

- `any`

### 413 Content Too Large Error

Payload exceeds size limit

- `any`

### 503 Service Unavailable Error

Queue full; retry later

- `any`

## Examples

**Response**

```json
{
  "accepted": true,
  "id": "string",
  "duplicate": true
}
```

**SDK Code**

```python
import requests

url = "https://app.logicdialog.ai/knowledge/hooks/workspaceId/environment/sourceKey"

headers = {"Authorization": "Bearer <token>"}

response = requests.delete(url, headers=headers)

print(response.json())
```

```javascript
const url = 'https://app.logicdialog.ai/knowledge/hooks/workspaceId/environment/sourceKey';
const options = {method: 'DELETE', headers: {Authorization: 'Bearer <token>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://app.logicdialog.ai/knowledge/hooks/workspaceId/environment/sourceKey"

	req, _ := http.NewRequest("DELETE", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://app.logicdialog.ai/knowledge/hooks/workspaceId/environment/sourceKey")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Delete.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.delete("https://app.logicdialog.ai/knowledge/hooks/workspaceId/environment/sourceKey")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('DELETE', 'https://app.logicdialog.ai/knowledge/hooks/workspaceId/environment/sourceKey', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://app.logicdialog.ai/knowledge/hooks/workspaceId/environment/sourceKey");
var request = new RestRequest(Method.DELETE);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://app.logicdialog.ai/knowledge/hooks/workspaceId/environment/sourceKey")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "DELETE"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```