Skip to main content

📚 Knowledge Service

A Knowledge record is a curated collection of content that the Intellect can search and reference when answering questions. Attach one to an intellect via knowledge_ids to give your assistant access to your media library, documents, or external web content.

Base route: POST /v1/knowledge/{action}

How Knowledge Relates to Intellect

📚 Knowledge record
└── sources
├── Internal: Kaltura category IDs → indexed media entries
└── Web: public URLs → crawled and indexed content

▼ attached via knowledge_ids
🧠 Intellect

A knowledge record defines where to get content. The intellect decides whether to use it (via the use_knowledge_base capability).

Data Model

Knowledge

FieldTypeDescription
idnumberServer-assigned Knowledge record ID
namestringDisplay name
descriptionstringOptional description
status'READY' | 'DELETED'Lifecycle status
configobjectKnowledge base configuration (see below)
tagsstring[]Searchable tags
partner_idnumberKaltura partner ID
user_idstringID of the user who created this record
created_at / updated_atstring (ISO date)Timestamps

KnowledgeConfig

FieldTypeDescription
sourcesobject[]One or more knowledge sources to index

Source Types

Internal source — indexes Kaltura media entries via categories:

FieldTypeRequiredDescription
type'internal'✅ YesSource type discriminator
languagestring✅ YesBCP-47 language code for captions/assets (e.g. 'en', 'fr')
categoryIdsstring[]✅ YesKaltura category IDs whose entries will be indexed
indexersobject[]✅ YesIndexing strategies to apply (see below)
customOperatorobjectNoOptional Kaltura ESearch operator to further filter entries

Web source — indexes content from public URLs:

FieldTypeRequiredDescription
type'web'✅ YesSource type discriminator
urlsstring[]✅ YesPublic URLs to crawl and index

Indexers (for internal sources)

Each indexer defines a strategy for embedding entry content:

FieldTypeDescription
typenumberContent type: 1=caption, 2=OCR, 3=document, 4=summary, 5=custom
strategystringEmbedding strategy: EmbedCaptionV1, EmbedOcrV1, EmbedDocumentV1, EmbedSummaryV1
index_positionnumberCursor tracking the last successfully indexed entry

Actions

add — Create a Knowledge Record

POST /v1/knowledge/add

Creates a new knowledge record. After creating it, use upload to add content or reference existing Kaltura categories.

Request body:

{
"name": "Product Video Library",
"description": "Indexed Kaltura video entries for product documentation",
"tags": ["production", "videos"],
"config": {
"sources": [
{
"type": "internal",
"language": "en",
"categoryIds": ["cat_abc123", "cat_def456"],
"indexers": [
{
"type": 1,
"strategy": "EmbedCaptionV1",
"index_position": 0
},
{
"type": 3,
"strategy": "EmbedDocumentV1",
"index_position": 0
}
]
}
]
}
}
FieldTypeRequiredDescription
namestringNoDisplay name
descriptionstringNoFree-text description
tagsstring[]NoSearchable tags
configobjectNoKnowledge base configuration

Response: Returns the created Knowledge object with generated id.

Examples:

cURL — create with internal Kaltura source
curl -X POST "https://YOUR_API_HOST/v1/knowledge/add" \
-H "Authorization: KS YOUR_KS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Product Video Library",
"config": {
"sources": [
{
"type": "internal",
"language": "en",
"categoryIds": ["cat_abc123"],
"indexers": [
{ "type": 1, "strategy": "EmbedCaptionV1", "index_position": 0 }
]
}
]
}
}'
JavaScript — create with web source
const knowledge = await fetch('https://YOUR_API_HOST/v1/knowledge/add', {
method: 'POST',
headers: { Authorization: `KS ${ksToken}`, 'Content-Type': 'application/json' },
body: JSON.stringify({
name: 'Documentation Site',
config: {
sources: [
{
type: 'web',
urls: ['https://docs.example.com/', 'https://docs.example.com/api/'],
},
],
},
}),
}).then((res) => res.json());

console.log(`Created knowledge record: ${knowledge.id}`);

get — Retrieve a Knowledge Record

POST /v1/knowledge/get

Request body:

{ "id": 7 }
FieldTypeRequiredDescription
idnumber✅ YesThe knowledge record ID to retrieve

Example:

cURL
curl -X POST "https://YOUR_API_HOST/v1/knowledge/get" \
-H "Authorization: KS YOUR_KS_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "id": 7 }'

update — Update a Knowledge Record

POST /v1/knowledge/update

Update name, description, tags, or the full config. Only provided fields are changed.

Request body:

{
"id": 7,
"name": "Product Video Library (Updated)",
"config": {
"sources": [
{
"type": "internal",
"language": "en",
"categoryIds": ["cat_abc123", "cat_new789"],
"indexers": [{ "type": 1, "strategy": "EmbedCaptionV1", "index_position": 0 }]
}
]
}
}
FieldTypeRequiredDescription
idnumber✅ YesThe knowledge record to update
namestringNoNew display name
descriptionstringNoNew description
tagsstring[]NoReplaces tag list
configobjectNoReplaces full knowledge config

upload — Upload Content to a Knowledge Record

POST /v1/knowledge/upload

Creates a Kaltura entry and upload token so you can ingest a file (video, audio, or document) into the knowledge base. The entry type is inferred from the file extension.

Request body:

{
"id": 7,
"name": "Q4 Product Demo",
"file_name": "q4-demo.mp4",
"category_id": "cat_abc123",
"description": "Product demo video for Q4",
"language": "English",
"tags": ["demo", "q4"]
}
FieldTypeRequiredDescription
idnumber✅ YesKnowledge record ID to upload content to
namestring✅ YesDisplay name for the Kaltura entry
file_namestring✅ YesFile name with extension (e.g. lecture.mp4, notes.pdf) — determines entry type
category_idstringNoKaltura category ID to assign the entry to. Defaults to the first configured category; creates one automatically if none exist
descriptionstringNoOptional description
languagestringNoEntry language (default: 'English')
tagsstring[]NoTags for the Kaltura entry

Response:

{
"upload_token_id": "0_abc123xyz",
"entry_id": "1_def456ghi",
"category_id": "cat_abc123"
}

Use the upload_token_id and entry_id with Kaltura's upload API to send the actual file.

Example:

JavaScript — get upload token then upload file
// Step 1: Get an upload token
const { upload_token_id, entry_id } = await fetch('https://YOUR_API_HOST/v1/knowledge/upload', {
method: 'POST',
headers: { Authorization: `KS ${ksToken}`, 'Content-Type': 'application/json' },
body: JSON.stringify({
id: 7,
name: 'Q4 Product Demo',
file_name: 'q4-demo.mp4',
}),
}).then((res) => res.json());

// Step 2: Upload the file using Kaltura's upload API
const formData = new FormData();
formData.append('fileData', videoFile);

await fetch(`https://www.kaltura.com/api_v3/service/uploadtoken/action/upload?uploadTokenId=${upload_token_id}&ks=${ksToken}`, { method: 'POST', body: formData });

console.log(`File uploaded to entry: ${entry_id}`);

delete — Delete a Knowledge Record

POST /v1/knowledge/delete

Permanently deletes a knowledge record.

Request body:

{ "id": 7 }
Check intellects before deleting

If an intellect references this knowledge record via knowledge_ids, remove it from there first to avoid broken configurations.


Attaching Knowledge to an Intellect

Once you have a knowledge record ID, attach it when creating or updating an intellect:

// Create an intellect with knowledge attached
const intellect = await fetch('https://YOUR_API_HOST/v1/intellect/add', {
method: 'POST',
headers: { Authorization: `KS ${ksToken}`, 'Content-Type': 'application/json' },
body: JSON.stringify({
type: 'internal',
name: 'Kali',
status: 1,
knowledge_ids: [7], // ← attach the knowledge record
capabilities: {
use_knowledge_base: 'on', // ← enable it
},
}),
}).then((res) => res.json());
info

Currently only one knowledge record can be attached per intellect (knowledge_ids has a max of 1 item).

Next Steps

  • 🧠 Intellect Service — Attach this knowledge record via knowledge_ids and enable use_knowledge_base
  • 🤖 Agent Service — Configure agents that use this intellect