Knowledge Base API
Svantic exposes a full REST API for managing knowledge bases programmatically. All endpoints usePOST with JSON request bodies.
For the complete request/response schemas, see the API Reference.
Lifecycle
| Endpoint | Purpose |
|---|---|
POST /knowledge_base/new | Create a knowledge base. Returns a job_id for tracking |
POST /knowledge_base/get | List all knowledge bases for the tenant |
POST /knowledge_base/get_by_id | Get detail for a single knowledge base by namespace |
POST /knowledge_base/update | Update config or metadata |
POST /knowledge_base/delete | Delete a knowledge base and all its data |
Content
| Endpoint | Purpose |
|---|---|
POST /knowledge_base/ingest | Ingest text content (markdown, plain text) into a namespace |
POST /knowledge_base/query | Semantic search — returns ranked results with scores |
POST /knowledge_base/refresh | Regenerate all embeddings (async, returns job_id) |
Observability
| Endpoint | Purpose |
|---|---|
POST /knowledge_base/get_stats | Chunk and source counts for a namespace |
POST /knowledge_base/get_sources | List all ingested sources (documents) |
POST /knowledge_base/delete_source | Remove a specific source and its chunks |
POST /knowledge_base/get_status | Poll processing job status (ingest, refresh, create) |
Examples
Create a Knowledge Base
Ingest Content
Semantic Search
Check Stats
Poll Job Status
Long-running operations (create, ingest large content, refresh) return ajob_id. Poll until completion:
Request Schemas
Create
| Field | Type | Required | Description |
|---|---|---|---|
namespace | string | Yes | Unique namespace identifier |
display_name | string | No | Human-readable name |
description | string | No | Description of the knowledge base |
config | object | No | Retrieval configuration (top_k, min_score, etc.) |
Ingest
| Field | Type | Required | Description |
|---|---|---|---|
namespace | string | Yes | Target knowledge base namespace |
source_id | string | Yes | Unique identifier for the source document |
content | string | Yes | Text content to ingest (markdown, plain text) |
tags | string[] | No | Tags for filtering during retrieval |
source_type | string | No | Content type hint (e.g. “markdown”, “text”) |
metadata | object | No | Arbitrary metadata attached to the source |
Query
| Field | Type | Required | Description |
|---|---|---|---|
namespace | string | Yes | Knowledge base to search |
query | string | Yes | Natural language search query |
top_k | integer | No | Number of results to return |
