> 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 change

POST https://app.logicdialog.ai/knowledge/hooks/{workspaceId}/{environment}/{sourceKey}
Content-Type: application/json

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/post-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)

### Headers

- `Idempotency-Key` (string, optional)

### Body (application/json)

This endpoint expects a map from string to any.

- `map from string to any`

## 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

### wordpress

**Request**

```json
{
  "post_id": 42,
  "post_type": "post",
  "post_url": "https://example.com/hours"
}
```

**Response**

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

**SDK Code**

```python wordpress
import requests

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

payload = {
    "post_id": 42,
    "post_type": "post",
    "post_url": "https://example.com/hours"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript wordpress
const url = 'https://app.logicdialog.ai/knowledge/hooks/workspaceId/environment/sourceKey';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"post_id":42,"post_type":"post","post_url":"https://example.com/hours"}'
};

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

```go wordpress
package main

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

func main() {

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

	payload := strings.NewReader("{\n  \"post_id\": 42,\n  \"post_type\": \"post\",\n  \"post_url\": \"https://example.com/hours\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

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

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

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

}
```

```ruby wordpress
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::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"post_id\": 42,\n  \"post_type\": \"post\",\n  \"post_url\": \"https://example.com/hours\"\n}"

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

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

HttpResponse<String> response = Unirest.post("https://app.logicdialog.ai/knowledge/hooks/workspaceId/environment/sourceKey")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"post_id\": 42,\n  \"post_type\": \"post\",\n  \"post_url\": \"https://example.com/hours\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://app.logicdialog.ai/knowledge/hooks/workspaceId/environment/sourceKey', [
  'body' => '{
  "post_id": 42,
  "post_type": "post",
  "post_url": "https://example.com/hours"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp wordpress
using RestSharp;

var client = new RestClient("https://app.logicdialog.ai/knowledge/hooks/workspaceId/environment/sourceKey");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"post_id\": 42,\n  \"post_type\": \"post\",\n  \"post_url\": \"https://example.com/hours\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift wordpress
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "post_id": 42,
  "post_type": "post",
  "post_url": "https://example.com/hours"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

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

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()
```

### powerAutomate

**Request**

```json
{
  "file": {
    "$content": "BASE64_DOCX"
  },
  "filename": "Policy.docx"
}
```

**Response**

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

**SDK Code**

```python powerAutomate
import requests

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

payload = {
    "file": { "$content": "BASE64_DOCX" },
    "filename": "Policy.docx"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript powerAutomate
const url = 'https://app.logicdialog.ai/knowledge/hooks/workspaceId/environment/sourceKey';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"file":{"$content":"BASE64_DOCX"},"filename":"Policy.docx"}'
};

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

```go powerAutomate
package main

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

func main() {

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

	payload := strings.NewReader("{\n  \"file\": {\n    \"$content\": \"BASE64_DOCX\"\n  },\n  \"filename\": \"Policy.docx\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

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

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

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

}
```

```ruby powerAutomate
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::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"file\": {\n    \"$content\": \"BASE64_DOCX\"\n  },\n  \"filename\": \"Policy.docx\"\n}"

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

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

HttpResponse<String> response = Unirest.post("https://app.logicdialog.ai/knowledge/hooks/workspaceId/environment/sourceKey")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"file\": {\n    \"$content\": \"BASE64_DOCX\"\n  },\n  \"filename\": \"Policy.docx\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://app.logicdialog.ai/knowledge/hooks/workspaceId/environment/sourceKey', [
  'body' => '{
  "file": {
    "$content": "BASE64_DOCX"
  },
  "filename": "Policy.docx"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp powerAutomate
using RestSharp;

var client = new RestClient("https://app.logicdialog.ai/knowledge/hooks/workspaceId/environment/sourceKey");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"file\": {\n    \"$content\": \"BASE64_DOCX\"\n  },\n  \"filename\": \"Policy.docx\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift powerAutomate
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "file": ["$content": "BASE64_DOCX"],
  "filename": "Policy.docx"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

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

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()
```

### umbracoDelete

**Request**

```json
{
  "Id": "content-id"
}
```

**Response**

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

**SDK Code**

```python umbracoDelete
import requests

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

payload = { "Id": "content-id" }
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript umbracoDelete
const url = 'https://app.logicdialog.ai/knowledge/hooks/workspaceId/environment/sourceKey';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"Id":"content-id"}'
};

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

```go umbracoDelete
package main

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

func main() {

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

	payload := strings.NewReader("{\n  \"Id\": \"content-id\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

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

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

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

}
```

```ruby umbracoDelete
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::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"Id\": \"content-id\"\n}"

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

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

HttpResponse<String> response = Unirest.post("https://app.logicdialog.ai/knowledge/hooks/workspaceId/environment/sourceKey")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"Id\": \"content-id\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://app.logicdialog.ai/knowledge/hooks/workspaceId/environment/sourceKey', [
  'body' => '{
  "Id": "content-id"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp umbracoDelete
using RestSharp;

var client = new RestClient("https://app.logicdialog.ai/knowledge/hooks/workspaceId/environment/sourceKey");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"Id\": \"content-id\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift umbracoDelete
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = ["Id": "content-id"] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

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

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()
```

### knowledgeApi

**Request**

```json
{
  "content": {
    "kb": {
      "text": "Updated knowledge"
    }
  },
  "id": "source-article-id"
}
```

**Response**

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

**SDK Code**

```python knowledgeApi
import requests

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

payload = {
    "content": { "kb": { "text": "Updated knowledge" } },
    "id": "source-article-id"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript knowledgeApi
const url = 'https://app.logicdialog.ai/knowledge/hooks/workspaceId/environment/sourceKey';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"content":{"kb":{"text":"Updated knowledge"}},"id":"source-article-id"}'
};

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

```go knowledgeApi
package main

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

func main() {

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

	payload := strings.NewReader("{\n  \"content\": {\n    \"kb\": {\n      \"text\": \"Updated knowledge\"\n    }\n  },\n  \"id\": \"source-article-id\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

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

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

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

}
```

```ruby knowledgeApi
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::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"content\": {\n    \"kb\": {\n      \"text\": \"Updated knowledge\"\n    }\n  },\n  \"id\": \"source-article-id\"\n}"

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

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

HttpResponse<String> response = Unirest.post("https://app.logicdialog.ai/knowledge/hooks/workspaceId/environment/sourceKey")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"content\": {\n    \"kb\": {\n      \"text\": \"Updated knowledge\"\n    }\n  },\n  \"id\": \"source-article-id\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://app.logicdialog.ai/knowledge/hooks/workspaceId/environment/sourceKey', [
  'body' => '{
  "content": {
    "kb": {
      "text": "Updated knowledge"
    }
  },
  "id": "source-article-id"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp knowledgeApi
using RestSharp;

var client = new RestClient("https://app.logicdialog.ai/knowledge/hooks/workspaceId/environment/sourceKey");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"content\": {\n    \"kb\": {\n      \"text\": \"Updated knowledge\"\n    }\n  },\n  \"id\": \"source-article-id\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift knowledgeApi
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "content": ["kb": ["text": "Updated knowledge"]],
  "id": "source-article-id"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

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

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()
```