> ## Documentation Index
> Fetch the complete documentation index at: https://docs.brightstack.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Knowledge Bases

> Create and manage KBs, index content, search, and manage entities/relationships.

This guide covers how to create and manage Knowledge Bases (KBs), index and de-index content for semantic search, perform searches, and manage Entities and Relationships. For agent integration using MCP tools, see the MCP guide.

## Create and manage Knowledge Bases

Use the Catalog API to create, list, update, and delete KBs.

```http theme={null}
POST /v1/catalog/knowledge-bases
{
  "name": "product-docs",
  "displayName": "Product Documentation",
  "description": "Technical documentation and guides",
  "enabled": true
}
```

```http theme={null}
GET /v1/catalog/knowledge-bases
```

```http theme={null}
GET /v1/catalog/knowledge-bases/:idOrName
```

```http theme={null}
PATCH /v1/catalog/knowledge-bases/:idOrName
{
  "displayName": "Docs",
  "enabled": true
}
```

```http theme={null}
DELETE /v1/catalog/knowledge-bases/:idOrName
```

### Notes

* Each KB has an isolated vector collection.
* Default KB "general" exists for every organization.

## Index and de-index content

Index Entities asynchronously and Relationships synchronously into the KB’s vector store.

```http theme={null}
POST /v1/search/index
{
  "entity": {
    "type": "Document",
    "content": { "type": "text", "text": "This is the content..." },
    "properties": { "title": "Getting Started" }
  },
  "kb": "product-docs"
}
```

```http theme={null}
POST /v1/search/index/connect
{
  "relationship": { "type": "references" },
  "source": { "id": "ent_123" },
  "target": { "id": "ent_456" },
  "kb": "product-docs"
}
```

```http theme={null}
POST /v1/search/deindex
{
  "id": "ent_123",
  "objectType": "Entity", // or "Relationship"
  "kb": "product-docs"
}
```

### Tips

* Large files should be indexed asynchronously.
* Provide meaningful properties (e.g., title, category) to improve filtering.

## Search

Perform semantic search across Entities and Relationships within a KB.

```http theme={null}
POST /v1/search
{
  "query": "how to implement authentication",
  "kb": "product-docs",
  "limit": 10,
  "objectType": "Entity",
  "types": ["Document", "Guide"],
  "properties": { "category": "documentation" }
}
```

### Features

* Vector similarity ranking with configurable score threshold
* Filtering by object type, types, and properties
* Pagination with limit/offset

## Manage Entities and Relationships

Entities represent nodes (documents, objects) with content and metadata. Relationships connect Entities.

```http theme={null}
POST /v1/entities
{
  "knowledgeBaseId": "kb_abc123",
  "type": "Document",
  "externalId": "doc-123",
  "content": { "type": "text", "text": "This is the document content..." },
  "properties": { "title": "Getting Started", "category": "documentation" }
}
```

```http theme={null}
POST /v1/relationships
{
  "type": "references",
  "sourceId": "ent_123",
  "targetId": "ent_456",
  "properties": { "notes": "Cites paragraph 2" }
}
```

### Guidance

* Choose appropriate entity types; keep property schemas consistent.
* Use timestamps for time-aware queries.

## MCP tools (overview)

Agents can access KBs and perform search via MCP tools (covered in-depth separately). You can: list KBs, run semantic search, and execute query models from an agent environment.

See the MCP guide for setup and examples.
