Knowledge base CRUD

Available via both the workspace prefix (/w/kb) and the gateway prefix (/v1/kb).

Create a KB

curl -X POST https://your-gateway/v1/kb \
  -H "Authorization: Bearer $KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "product-docs"}'

List KBs

curl https://your-gateway/v1/kb \
  -H "Authorization: Bearer $KEY"

Delete a KB

curl -X DELETE https://your-gateway/v1/kb/$KB_ID \
  -H "Authorization: Bearer $KEY"

Document management

Add a document

curl -X POST https://your-gateway/v1/kb/$KB_ID/documents \
  -H "Authorization: Bearer $KEY" \
  -F "file=@document.pdf"
Documents are automatically chunked, embedded, and stored in your configured vector store.

List documents

curl https://your-gateway/v1/kb/$KB_ID/documents \
  -H "Authorization: Bearer $KEY"

Delete a document

curl -X DELETE https://your-gateway/v1/kb/$KB_ID/documents/$DOC_ID \
  -H "Authorization: Bearer $KEY"

Query a KB

curl -X POST https://your-gateway/v1/kb/$KB_ID/query \
  -H "Authorization: Bearer $KEY" \
  -H "Content-Type: application/json" \
  -d '{"query": "How do I configure authentication?", "top_k": 5}'

Response

{
  "results": [
    {
      "content": "Authentication is configured via the auth section...",
      "score": 0.92,
      "document_id": "doc_123",
      "metadata": {"source": "config-guide.md", "chunk_index": 3}
    }
  ]
}

URL and YouTube ingest (workspace)

Ingest a web page or YouTube video transcript directly into a KB:
curl -X POST https://your-gateway/w/ingest/url \
  -H "Cookie: session=..." \
  -H "Content-Type: application/json" \
  -d '{"kb_id": "<uuid>", "url": "https://example.com/article"}'

Response (201 Created)

{
  "id": "<uuid>",
  "kb_id": "<uuid>",
  "name": "Article title or URL",
  "chunk_count": 12,
  "sha256": "...",
  "source_id": "https://example.com/article"
}

Document sets

Named collections of KBs for grouped retrieval and access control:
MethodPathDescription
GET/v1/docsetsList document sets
POST/v1/docsetsCreate a document set
GET/v1/docsets/{id}Get a document set
PUT/v1/docsets/{id}Update a document set
DELETE/v1/docsets/{id}Delete a document set
Admin-scoped equivalents are available at /admin/docsets/*.