Skip to main content

Knowledge Base

Verified against backend/internal/publicapi/builder_dto.go, knowledge_handler.go, and routes.go.

MethodPathScope
GET/agents/:id/knowledgeknowledge:read
POST/agents/:id/knowledgeknowledge:write
DELETE/agents/:id/knowledge/*titleknowledge:write

There is no "knowledge base" object

This is worth stating plainly because every competitor's docs model a KB as a resource with an ID you create once and attach files to. This API doesn't, because the underlying table doesn't either: knowledge_base is a chunk table — one row per chunk, with a vector(1536) embedding inline. There's nothing to create ahead of time and no KB id to hold onto. Knowledge attaches directly to the agent.

Add a source

bash
curl -X POST https://api.voicematrix.ai/api/v1/ext/agents/<agent-id>/knowledge \
  -H "X-API-Key: vm_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "source_type": "url",
    "url": "https://docs.acme.com/pricing",
    "title": "Pricing page"
  }'
FieldRequiredNotes
source_typeyestext or url
contentrequired if source_type: text
urlrequired if source_type: urlFetched server-side — SSRF-validated
titleno, max 200Labels the source for listing/deletion
json
{ "agent_id": "...", "title": "Pricing page", "chunks": 14 }

Content safety on ingestion

Both text and url ingestion pass through the same multilingual (English + Hebrew) content guard used elsewhere in the platform, in enforcement mode — a flagged document is hard-blocked, not merely logged. This matters because ingested content goes straight into an agent's system context: on a Hebrew-first product, an injection attempt written in Hebrew has to be caught by the same gate as one written in English, not fall through to an English-only pattern list.

If ingestion returns 503

Embedding requires Azure OpenAI credentials to be configured. If they aren't, this endpoint answers 503 rather than accepting your document and silently storing it without an embedding — a document that "saved successfully" but is never retrievable would be a much worse failure mode.

List sources

text
GET /agents/:id/knowledge
json
{ "data": [ { "title": "Pricing page", "chunks": 14, "created_at": "..." } ] }

Delete a source

text
DELETE /agents/:id/knowledge/*title

Note the *title wildcard, not :title. A source's title can legitimately contain a / — a url-sourced title derives from host/path (e.g. docs.acme.com/pricing), and a caller-supplied text title might too. A single-segment path parameter can't carry that; the wildcard captures the full remainder and the handler strips the leading slash. If you're constructing this URL yourself, don't URL-encode the slashes in the title — pass it through as the DELETE path directly.

Next

All pages