Update KB Source
curl --request PATCH \
--url https://api.attention.tech/v2/knowledge-base/sources/{sourceId} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"title": "Q4 Product Launch Playbook (Updated)",
"content": "# Product Launch Playbook v2\n\n## Overview\nUpdated with lessons learned from beta launch..."
}
'import requests
url = "https://api.attention.tech/v2/knowledge-base/sources/{sourceId}"
payload = {
"title": "Q4 Product Launch Playbook (Updated)",
"content": "# Product Launch Playbook v2
## Overview
Updated with lessons learned from beta launch..."
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
title: 'Q4 Product Launch Playbook (Updated)',
content: '# Product Launch Playbook v2\n\n## Overview\nUpdated with lessons learned from beta launch...'
})
};
fetch('https://api.attention.tech/v2/knowledge-base/sources/{sourceId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.attention.tech/v2/knowledge-base/sources/{sourceId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'title' => 'Q4 Product Launch Playbook (Updated)',
'content' => '# Product Launch Playbook v2
## Overview
Updated with lessons learned from beta launch...'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.attention.tech/v2/knowledge-base/sources/{sourceId}"
payload := strings.NewReader("{\n \"title\": \"Q4 Product Launch Playbook (Updated)\",\n \"content\": \"# Product Launch Playbook v2\\n\\n## Overview\\nUpdated with lessons learned from beta launch...\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.attention.tech/v2/knowledge-base/sources/{sourceId}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"title\": \"Q4 Product Launch Playbook (Updated)\",\n \"content\": \"# Product Launch Playbook v2\\n\\n## Overview\\nUpdated with lessons learned from beta launch...\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.attention.tech/v2/knowledge-base/sources/{sourceId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"title\": \"Q4 Product Launch Playbook (Updated)\",\n \"content\": \"# Product Launch Playbook v2\\n\\n## Overview\\nUpdated with lessons learned from beta launch...\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"type": "kb_sources",
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"attributes": {
"title": "Q4 Product Launch Playbook",
"source_type": "manual",
"content": "# Product Launch Playbook\n\n## Overview\nThis document covers the key steps...",
"format": "text/markdown",
"status": "indexed",
"file_size": 4096,
"chunk_count": 12,
"created_at": "2025-01-15T10:30:00Z",
"updated_at": "2025-01-15T10:35:00Z"
}
}
}{
"id": "not_found_error",
"status": "404",
"code": "404",
"title": "Not Found Error",
"detail": "The requested resource was not found",
"source": {
"pointer": "/data/attributes/id"
}
}{
"id": "not_found_error",
"status": "404",
"code": "404",
"title": "Not Found Error",
"detail": "The requested resource was not found",
"source": {
"pointer": "/data/attributes/id"
}
}{
"id": "not_found_error",
"status": "404",
"code": "404",
"title": "Not Found Error",
"detail": "The requested resource was not found",
"source": {
"pointer": "/data/attributes/id"
}
}{
"id": "not_found_error",
"status": "404",
"code": "404",
"title": "Not Found Error",
"detail": "The requested resource was not found",
"source": {
"pointer": "/data/attributes/id"
}
}Knowledge Base
Update KB Source
Updates the title and/or content of a KB source. If content is changed, triggers re-indexing.
PATCH
/
knowledge-base
/
sources
/
{sourceId}
Update KB Source
curl --request PATCH \
--url https://api.attention.tech/v2/knowledge-base/sources/{sourceId} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"title": "Q4 Product Launch Playbook (Updated)",
"content": "# Product Launch Playbook v2\n\n## Overview\nUpdated with lessons learned from beta launch..."
}
'import requests
url = "https://api.attention.tech/v2/knowledge-base/sources/{sourceId}"
payload = {
"title": "Q4 Product Launch Playbook (Updated)",
"content": "# Product Launch Playbook v2
## Overview
Updated with lessons learned from beta launch..."
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
title: 'Q4 Product Launch Playbook (Updated)',
content: '# Product Launch Playbook v2\n\n## Overview\nUpdated with lessons learned from beta launch...'
})
};
fetch('https://api.attention.tech/v2/knowledge-base/sources/{sourceId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.attention.tech/v2/knowledge-base/sources/{sourceId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'title' => 'Q4 Product Launch Playbook (Updated)',
'content' => '# Product Launch Playbook v2
## Overview
Updated with lessons learned from beta launch...'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.attention.tech/v2/knowledge-base/sources/{sourceId}"
payload := strings.NewReader("{\n \"title\": \"Q4 Product Launch Playbook (Updated)\",\n \"content\": \"# Product Launch Playbook v2\\n\\n## Overview\\nUpdated with lessons learned from beta launch...\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.attention.tech/v2/knowledge-base/sources/{sourceId}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"title\": \"Q4 Product Launch Playbook (Updated)\",\n \"content\": \"# Product Launch Playbook v2\\n\\n## Overview\\nUpdated with lessons learned from beta launch...\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.attention.tech/v2/knowledge-base/sources/{sourceId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"title\": \"Q4 Product Launch Playbook (Updated)\",\n \"content\": \"# Product Launch Playbook v2\\n\\n## Overview\\nUpdated with lessons learned from beta launch...\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"type": "kb_sources",
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"attributes": {
"title": "Q4 Product Launch Playbook",
"source_type": "manual",
"content": "# Product Launch Playbook\n\n## Overview\nThis document covers the key steps...",
"format": "text/markdown",
"status": "indexed",
"file_size": 4096,
"chunk_count": 12,
"created_at": "2025-01-15T10:30:00Z",
"updated_at": "2025-01-15T10:35:00Z"
}
}
}{
"id": "not_found_error",
"status": "404",
"code": "404",
"title": "Not Found Error",
"detail": "The requested resource was not found",
"source": {
"pointer": "/data/attributes/id"
}
}{
"id": "not_found_error",
"status": "404",
"code": "404",
"title": "Not Found Error",
"detail": "The requested resource was not found",
"source": {
"pointer": "/data/attributes/id"
}
}{
"id": "not_found_error",
"status": "404",
"code": "404",
"title": "Not Found Error",
"detail": "The requested resource was not found",
"source": {
"pointer": "/data/attributes/id"
}
}{
"id": "not_found_error",
"status": "404",
"code": "404",
"title": "Not Found Error",
"detail": "The requested resource was not found",
"source": {
"pointer": "/data/attributes/id"
}
}Authorizations
Path Parameters
The unique identifier of the KB source
Body
application/jsonapplication/vnd.api+json
Response
KB source updated successfully
Show child attributes
Show child attributes
Example:
{
"type": "kb_sources",
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"attributes": {
"title": "Q4 Product Launch Playbook",
"source_type": "manual",
"format": "text/markdown",
"status": "indexed",
"file_size": 4096,
"chunk_count": 12,
"created_at": "2025-01-15T10:30:00Z",
"updated_at": "2025-01-15T10:35:00Z"
}
}
Was this page helpful?
⌘I