Edit a chunk
curl --request PATCH \
--url https://api.tryhamsa.com/v1/voice-agents/knowledge-base/{id}/chunks/{chunkId} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"text": "Enterprise plans include a dedicated support line, available 24/7 by phone and chat."
}
'import requests
url = "https://api.tryhamsa.com/v1/voice-agents/knowledge-base/{id}/chunks/{chunkId}"
payload = { "text": "Enterprise plans include a dedicated support line, available 24/7 by phone and chat." }
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({
text: 'Enterprise plans include a dedicated support line, available 24/7 by phone and chat.'
})
};
fetch('https://api.tryhamsa.com/v1/voice-agents/knowledge-base/{id}/chunks/{chunkId}', 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.tryhamsa.com/v1/voice-agents/knowledge-base/{id}/chunks/{chunkId}",
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([
'text' => 'Enterprise plans include a dedicated support line, available 24/7 by phone and chat.'
]),
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.tryhamsa.com/v1/voice-agents/knowledge-base/{id}/chunks/{chunkId}"
payload := strings.NewReader("{\n \"text\": \"Enterprise plans include a dedicated support line, available 24/7 by phone and chat.\"\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.tryhamsa.com/v1/voice-agents/knowledge-base/{id}/chunks/{chunkId}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"text\": \"Enterprise plans include a dedicated support line, available 24/7 by phone and chat.\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tryhamsa.com/v1/voice-agents/knowledge-base/{id}/chunks/{chunkId}")
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 \"text\": \"Enterprise plans include a dedicated support line, available 24/7 by phone and chat.\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Chunks saved successfully!",
"messageKey": "ChunksSavedSuccessfully",
"data": {
"id": "0f1a5c0e-2d9b-4f8a-9d3e-6b2c1a7e8f90",
"knowledgeBaseItemId": "d949f13f-40d2-4e48-ac86-b66633070603",
"position": 3,
"text": "Enterprise plans include a dedicated support line, available 24/7.",
"charCount": 66,
"wordCount": 10,
"origin": "AUTO",
"flagged": false,
"metadata": {
"headerPath": "Pricing > Enterprise",
"page": 4,
"kind": "prose",
"tokenCount": 212,
"qualityScore": 0.71,
"strategy": "SEMANTIC",
"context": "This section lists the support options included in the Enterprise plan.",
"title": "Enterprise support",
"flags": [
"too_short"
],
"overlapApplied": true,
"overlapTokenCount": 38,
"overlapSkipReason": "first_chunk"
},
"isIndexed": true,
"indexedAt": "2026-10-08T10:05:50.000Z",
"createdAt": "2026-10-08T10:05:50.000Z",
"updatedAt": "2026-10-08T10:05:50.000Z"
}
}{
"code": 8404,
"message": "Policy not found!",
"messageKey": "PolicyNotFound",
"params": {
"reason": "NO_DRAFT"
}
}{
"code": 8404,
"message": "Policy not found!",
"messageKey": "PolicyNotFound",
"params": {
"reason": "NO_DRAFT"
}
}{
"code": 8404,
"message": "Policy not found!",
"messageKey": "PolicyNotFound",
"params": {
"reason": "NO_DRAFT"
}
}{
"code": 8404,
"message": "Policy not found!",
"messageKey": "PolicyNotFound",
"params": {
"reason": "NO_DRAFT"
}
}{
"code": 8404,
"message": "Policy not found!",
"messageKey": "PolicyNotFound",
"params": {
"reason": "NO_DRAFT"
}
}{
"code": 8404,
"message": "Policy not found!",
"messageKey": "PolicyNotFound",
"params": {
"reason": "NO_DRAFT"
}
}Knowledge Base Routes
Edit Knowledge Base Item Chunk
Replaces the text of one chunk. The change is searchable after you index the item.
PATCH
/
v1
/
voice-agents
/
knowledge-base
/
{id}
/
chunks
/
{chunkId}
Edit a chunk
curl --request PATCH \
--url https://api.tryhamsa.com/v1/voice-agents/knowledge-base/{id}/chunks/{chunkId} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"text": "Enterprise plans include a dedicated support line, available 24/7 by phone and chat."
}
'import requests
url = "https://api.tryhamsa.com/v1/voice-agents/knowledge-base/{id}/chunks/{chunkId}"
payload = { "text": "Enterprise plans include a dedicated support line, available 24/7 by phone and chat." }
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({
text: 'Enterprise plans include a dedicated support line, available 24/7 by phone and chat.'
})
};
fetch('https://api.tryhamsa.com/v1/voice-agents/knowledge-base/{id}/chunks/{chunkId}', 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.tryhamsa.com/v1/voice-agents/knowledge-base/{id}/chunks/{chunkId}",
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([
'text' => 'Enterprise plans include a dedicated support line, available 24/7 by phone and chat.'
]),
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.tryhamsa.com/v1/voice-agents/knowledge-base/{id}/chunks/{chunkId}"
payload := strings.NewReader("{\n \"text\": \"Enterprise plans include a dedicated support line, available 24/7 by phone and chat.\"\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.tryhamsa.com/v1/voice-agents/knowledge-base/{id}/chunks/{chunkId}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"text\": \"Enterprise plans include a dedicated support line, available 24/7 by phone and chat.\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tryhamsa.com/v1/voice-agents/knowledge-base/{id}/chunks/{chunkId}")
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 \"text\": \"Enterprise plans include a dedicated support line, available 24/7 by phone and chat.\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Chunks saved successfully!",
"messageKey": "ChunksSavedSuccessfully",
"data": {
"id": "0f1a5c0e-2d9b-4f8a-9d3e-6b2c1a7e8f90",
"knowledgeBaseItemId": "d949f13f-40d2-4e48-ac86-b66633070603",
"position": 3,
"text": "Enterprise plans include a dedicated support line, available 24/7.",
"charCount": 66,
"wordCount": 10,
"origin": "AUTO",
"flagged": false,
"metadata": {
"headerPath": "Pricing > Enterprise",
"page": 4,
"kind": "prose",
"tokenCount": 212,
"qualityScore": 0.71,
"strategy": "SEMANTIC",
"context": "This section lists the support options included in the Enterprise plan.",
"title": "Enterprise support",
"flags": [
"too_short"
],
"overlapApplied": true,
"overlapTokenCount": 38,
"overlapSkipReason": "first_chunk"
},
"isIndexed": true,
"indexedAt": "2026-10-08T10:05:50.000Z",
"createdAt": "2026-10-08T10:05:50.000Z",
"updatedAt": "2026-10-08T10:05:50.000Z"
}
}{
"code": 8404,
"message": "Policy not found!",
"messageKey": "PolicyNotFound",
"params": {
"reason": "NO_DRAFT"
}
}{
"code": 8404,
"message": "Policy not found!",
"messageKey": "PolicyNotFound",
"params": {
"reason": "NO_DRAFT"
}
}{
"code": 8404,
"message": "Policy not found!",
"messageKey": "PolicyNotFound",
"params": {
"reason": "NO_DRAFT"
}
}{
"code": 8404,
"message": "Policy not found!",
"messageKey": "PolicyNotFound",
"params": {
"reason": "NO_DRAFT"
}
}{
"code": 8404,
"message": "Policy not found!",
"messageKey": "PolicyNotFound",
"params": {
"reason": "NO_DRAFT"
}
}{
"code": 8404,
"message": "Policy not found!",
"messageKey": "PolicyNotFound",
"params": {
"reason": "NO_DRAFT"
}
}Authorizations
Path Parameters
Body
application/json
Chunk text, at most 6,000 characters. Empty or blank text is refused (ChunkTextCannotBeEmpty).
Required string length:
1 - 6000Example:
"Enterprise plans include a dedicated support line, available 24/7 by phone and chat."
Was this page helpful?