Browse this section
API reference

Knowledge bases

Create knowledge bases, connect sources and manage access.

The knowledge base object

{
  "id": "kb_01j9x3k2m7",
  "name": "ops-eu",
  "description": "Operations policies, SOPs and supplier data",
  "region": "eu-north-1",
  "document_count": 4210,
  "chunk_count": 12408,
  "last_synced_at": "2026-09-19T08:12:04Z",
  "created_at": "2026-03-20T09:00:00Z"
}

Endpoints

MethodPathPurpose
GET/knowledge-basesList
POST/knowledge-basesCreate
GET/knowledge-bases/{id}Retrieve
PATCH/knowledge-bases/{id}Update name/description/settings
DELETE/knowledge-bases/{id}Delete (and its documents)
GET/knowledge-bases/{id}/sourcesList sources
POST/knowledge-bases/{id}/sourcesAdd a source
POST/knowledge-bases/{id}/sources/{source_id}/syncTrigger a sync
DELETE/knowledge-bases/{id}/sources/{source_id}Remove a source
GET/knowledge-bases/{id}/accessList grants
PUT/knowledge-bases/{id}/accessReplace grants

Create

curl -X POST https://api.brewmycode.com/v1/knowledge-bases \
  -H "Authorization: Bearer $BMC_API_KEY" -H "Content-Type: application/json" \
  -d '{ "name": "ops-eu", "description": "Operations policies, SOPs and supplier data" }'

Add a source

Sources that need OAuth are authorised in the web app; the API can add sources for connectors that use stored credentials (databases, websites, API-key systems) and can manage scope for any source.

curl -X POST https://api.brewmycode.com/v1/knowledge-bases/kb_01j9x3k2m7/sources \
  -H "Authorization: Bearer $BMC_API_KEY" -H "Content-Type: application/json" \
  -d '{
    "connector": "website",
    "config": { "start_urls": ["https://help.example.com/"], "include_paths": ["/articles/"], "schedule": "daily" }
  }'

Grants

curl -X PUT https://api.brewmycode.com/v1/knowledge-bases/kb_01j9x3k2m7/access \
  -H "Authorization: Bearer $BMC_API_KEY" -H "Content-Type: application/json" \
  -d '{
    "users": ["marja@example.com"],
    "groups": ["operations"],
    "channels": ["slack:C0123ABC"],
    "agents": ["agt_01j9…"]
  }'