Update Text Entry
curl --request PATCH \
--url https://{appId}.api-{region}.cometchat.io/v3/ai-agents/agent-builder/knowledge-base/text/{uniqueId} \
--header 'Content-Type: application/json' \
--header 'apikey: <api-key>' \
--data '
{
"title": "Updated Company Policy Document",
"text": "This is the updated document content with new policies and procedures..."
}
'import requests
url = "https://{appId}.api-{region}.cometchat.io/v3/ai-agents/agent-builder/knowledge-base/text/{uniqueId}"
payload = {
"title": "Updated Company Policy Document",
"text": "This is the updated document content with new policies and procedures..."
}
headers = {
"apikey": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {apikey: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
title: 'Updated Company Policy Document',
text: 'This is the updated document content with new policies and procedures...'
})
};
fetch('https://{appId}.api-{region}.cometchat.io/v3/ai-agents/agent-builder/knowledge-base/text/{uniqueId}', 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://{appId}.api-{region}.cometchat.io/v3/ai-agents/agent-builder/knowledge-base/text/{uniqueId}",
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' => 'Updated Company Policy Document',
'text' => 'This is the updated document content with new policies and procedures...'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"apikey: <api-key>"
],
]);
$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://{appId}.api-{region}.cometchat.io/v3/ai-agents/agent-builder/knowledge-base/text/{uniqueId}"
payload := strings.NewReader("{\n \"title\": \"Updated Company Policy Document\",\n \"text\": \"This is the updated document content with new policies and procedures...\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("apikey", "<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://{appId}.api-{region}.cometchat.io/v3/ai-agents/agent-builder/knowledge-base/text/{uniqueId}")
.header("apikey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"title\": \"Updated Company Policy Document\",\n \"text\": \"This is the updated document content with new policies and procedures...\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{appId}.api-{region}.cometchat.io/v3/ai-agents/agent-builder/knowledge-base/text/{uniqueId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["apikey"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"title\": \"Updated Company Policy Document\",\n \"text\": \"This is the updated document content with new policies and procedures...\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Text detail updated successfully",
"data": {
"uniqueId": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"title": "Updated Title",
"fileName": "updated-title.md",
"s3Key": "my-app-id/text/f47ac10b/updated-title.md",
"status": "indexing"
}
}Knowledge Base
Update Text Entry
Updates a specific text-based knowledge base entry by its unique ID. Use this endpoint to modify the title or content of an existing text entry. Re-indexing: The content is re-uploaded and the en
PATCH
/
ai-agents
/
agent-builder
/
knowledge-base
/
text
/
{uniqueId}
Update Text Entry
curl --request PATCH \
--url https://{appId}.api-{region}.cometchat.io/v3/ai-agents/agent-builder/knowledge-base/text/{uniqueId} \
--header 'Content-Type: application/json' \
--header 'apikey: <api-key>' \
--data '
{
"title": "Updated Company Policy Document",
"text": "This is the updated document content with new policies and procedures..."
}
'import requests
url = "https://{appId}.api-{region}.cometchat.io/v3/ai-agents/agent-builder/knowledge-base/text/{uniqueId}"
payload = {
"title": "Updated Company Policy Document",
"text": "This is the updated document content with new policies and procedures..."
}
headers = {
"apikey": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {apikey: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
title: 'Updated Company Policy Document',
text: 'This is the updated document content with new policies and procedures...'
})
};
fetch('https://{appId}.api-{region}.cometchat.io/v3/ai-agents/agent-builder/knowledge-base/text/{uniqueId}', 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://{appId}.api-{region}.cometchat.io/v3/ai-agents/agent-builder/knowledge-base/text/{uniqueId}",
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' => 'Updated Company Policy Document',
'text' => 'This is the updated document content with new policies and procedures...'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"apikey: <api-key>"
],
]);
$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://{appId}.api-{region}.cometchat.io/v3/ai-agents/agent-builder/knowledge-base/text/{uniqueId}"
payload := strings.NewReader("{\n \"title\": \"Updated Company Policy Document\",\n \"text\": \"This is the updated document content with new policies and procedures...\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("apikey", "<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://{appId}.api-{region}.cometchat.io/v3/ai-agents/agent-builder/knowledge-base/text/{uniqueId}")
.header("apikey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"title\": \"Updated Company Policy Document\",\n \"text\": \"This is the updated document content with new policies and procedures...\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{appId}.api-{region}.cometchat.io/v3/ai-agents/agent-builder/knowledge-base/text/{uniqueId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["apikey"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"title\": \"Updated Company Policy Document\",\n \"text\": \"This is the updated document content with new policies and procedures...\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Text detail updated successfully",
"data": {
"uniqueId": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"title": "Updated Title",
"fileName": "updated-title.md",
"s3Key": "my-app-id/text/f47ac10b/updated-title.md",
"status": "indexing"
}
}For the complete error reference, see Error Guide.
Authorizations
API Key (i.e. Rest API Key from the Dashboard).
Path Parameters
Unique text detail ID
Example:
"f47ac10b-58cc-4372-a567-0e02b2c3d479"
Body
application/json
Title of the text content
Maximum string length:
500Example:
"Updated Company Policy Document"
Text content to be processed
Maximum string length:
5000Example:
"This is the updated document content with new policies and procedures..."
Was this page helpful?
⌘I