curl -X POST http://127.0.0.1:47334/api/projects/mindsdb/knowledge_bases \
  -H "Content-Type: application/json" \
  -d '{
    "knowledge_base": {
      "name": "my_kb",
      "storage": {
        "database": "my_kb_chromadb",
        "table": "default_collection"
      },
      "embedding_model": {
        "provider": "openai",
        "model_name": "text-embedding-3-small",
        "api_key": "sk-xxx"
      },
      "reranking_model": {
        "provider": "openai",
        "model_name": "gpt-4o",
        "api_key": "sk-xxx"
      },
      "content_columns": ["notes"],
      "metadata_columns": ["product"],
      "id_column": "order_id"
    }
  }'

{
  "id": 2,
  "name": "my_kb",
  "project_id": 1,
  "vector_database": "my_kb_chromadb",
  "vector_database_table": "default_collection",
  "updated_at": "2025-06-26 10:24:06.311655",
  "created_at": "2025-06-26 10:24:06.311654",
  "query_id": null,
  "embedding_model": {
    "provider": "openai",
    "model_name": "text-embedding-3-small",
    "api_key": "******"
  },
  "reranking_model": {
    "provider": "openai",
    "model_name": "gpt-4o",
    "api_key": "******"
  },
  "metadata_columns": [
    "product"
  ],
  "content_columns": [
    "notes"
  ],
  "id_column": "order_id",
  "params": {
    "created_embedding_model": "kb_embedding_my_kbxxx"
  }
}

POST /api/projects/{project_name}/knowledge_bases

This API endpoint creates a knowledge base using the POST method.

Learn more about knowledge bases following this doc page.

Path Parameters

project_name
string
required

Defines the project where the knowledge bases are located. Note that the default project name is mindsdb.

Body

name
string
required

Name of the knowledge base.

storage
string

Underlying vector database that stores the embeddings.

embedding_model
string

Defines the embedding model used to embed data in vector representation.

reranking_model
string

Defines the reranking model used to rerank the search results by relevance.

content_columns
string

Defines the columns that store content to be embedded.

metadata_columns
string

Defines the columns that are considered metadata.

id_column
string

Defines the column that uniquely identifies each row from the data inserted into the knowledge base.

Response

id
string
required

Unique identifier for the knowledge base.

name
string
required

The name assigned to the knowledge base.

project_id
string
required

The ID of the project where the knowledge base resides.

vector_database
string
required

The vector store used for storing vector embeddings.

vector_database_table
string
required

The name of the collection or table within the vector database.

updated_at
string
required

Timestamp indicating when the knowledge base was last updated.

created_at
string
required

Timestamp indicating when the knowledge base was created.

query_id
string
required

Optional field for linking specific queries to this knowledge base.

embedding_model
string
required

The embedding model used to convert content into vector representations.

reranking_model
string
required

Optional model used to rerank search results based on relevance.

metadata_columns
list
required

Optional list of columns used for metadata-based filtering or enrichment.

content_columns
list
required

Optional list of columns treated as the main content for embedding and retrieval.

id_column
string
required

The name of the column that uniquely identifies each content row.

params
object
required

A nested object that contains additional configuration parameters.

params.created_embedding_model
string
required

The name of the embedding model associated with this knowledge base at creation time.

curl -X POST http://127.0.0.1:47334/api/projects/mindsdb/knowledge_bases \
  -H "Content-Type: application/json" \
  -d '{
    "knowledge_base": {
      "name": "my_kb",
      "storage": {
        "database": "my_kb_chromadb",
        "table": "default_collection"
      },
      "embedding_model": {
        "provider": "openai",
        "model_name": "text-embedding-3-small",
        "api_key": "sk-xxx"
      },
      "reranking_model": {
        "provider": "openai",
        "model_name": "gpt-4o",
        "api_key": "sk-xxx"
      },
      "content_columns": ["notes"],
      "metadata_columns": ["product"],
      "id_column": "order_id"
    }
  }'

{
  "id": 2,
  "name": "my_kb",
  "project_id": 1,
  "vector_database": "my_kb_chromadb",
  "vector_database_table": "default_collection",
  "updated_at": "2025-06-26 10:24:06.311655",
  "created_at": "2025-06-26 10:24:06.311654",
  "query_id": null,
  "embedding_model": {
    "provider": "openai",
    "model_name": "text-embedding-3-small",
    "api_key": "******"
  },
  "reranking_model": {
    "provider": "openai",
    "model_name": "gpt-4o",
    "api_key": "******"
  },
  "metadata_columns": [
    "product"
  ],
  "content_columns": [
    "notes"
  ],
  "id_column": "order_id",
  "params": {
    "created_embedding_model": "kb_embedding_my_kbxxx"
  }
}