curl --request POST \
--url https://api.tryhamsa.com/v1/voice-agents/knowledge-base/{id}/chunks \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"text": "Refunds are issued within 5 business days.",
"afterChunkId": "0f1a5c0e-2d9b-4f8a-9d3e-6b2c1a7e8f90"
}
'{
"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
Add Knowledge Base Item Chunk
Adds one chunk you wrote. It is not searchable until you index the item (POST /v1/voice-agents/knowledge-base/{id}/index). An item can have at most 5,000 chunks.
POST
/
v1
/
voice-agents
/
knowledge-base
/
{id}
/
chunks
curl --request POST \
--url https://api.tryhamsa.com/v1/voice-agents/knowledge-base/{id}/chunks \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"text": "Refunds are issued within 5 business days.",
"afterChunkId": "0f1a5c0e-2d9b-4f8a-9d3e-6b2c1a7e8f90"
}
'{
"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:
"Refunds are issued within 5 business days."
Was this page helpful?