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

# Alter Knowledge Base

**PUT `/api/projects/{project_name}/knowledge_bases/{kb_name}`**

This API endpoint alters an existing knowledge base using the `PUT` method.

<Tip>
  Learn more about knowledge bases following [this doc page](/mindsdb_sql/knowledge_bases/overview).
</Tip>

### Path Parameters

<ParamField body="project_name" type="string" required>
  Defines the project where the knowledge bases are located. Note that the default project name is `mindsdb`.
</ParamField>

<ParamField body="kb_name" type="string" required>
  Defines the knowledge base to be altered.
</ParamField>

### Body

<ParamField body="embedding_model" type="string">
  Defines the embedding model used to embed data in vector representation.
</ParamField>

<ParamField body="reranking_model" type="string">
  Defines the reranking model used to rerank the search results by relevance.
</ParamField>

<ParamField body="content_columns" type="string">
  Defines the columns that store content to be embedded.
</ParamField>

<ParamField body="metadata_columns" type="string">
  Defines the columns that are considered metadata.
</ParamField>

<ParamField body="id_column" type="string">
  Defines the column that uniquely identifies each row from the data inserted into the knowledge base.
</ParamField>

<ParamField body="preprocessing" type="string">
  Defines the data preprocessing parameters.
</ParamField>

### Response

<ResponseField name="id" type="string" required>
  Unique identifier for the knowledge base.
</ResponseField>

<ResponseField name="name" type="string" required>
  The name assigned to the knowledge base.
</ResponseField>

<ResponseField name="project_id" type="string" required>
  The ID of the project where the knowledge base resides.
</ResponseField>

<ResponseField name="vector_database" type="string" required>
  The vector store used for storing vector embeddings.
</ResponseField>

<ResponseField name="vector_database_table" type="string" required>
  The name of the collection or table within the vector database.
</ResponseField>

<ResponseField name="updated_at" type="string" required>
  Timestamp indicating when the knowledge base was last updated.
</ResponseField>

<ResponseField name="created_at" type="string" required>
  Timestamp indicating when the knowledge base was created.
</ResponseField>

<ResponseField name="query_id" type="string" required="false">
  Optional field for linking specific queries to this knowledge base.
</ResponseField>

<ResponseField name="embedding_model" type="string" required="false">
  The embedding model used to convert content into vector representations.
</ResponseField>

<ResponseField name="reranking_model" type="string" required="false">
  Optional model used to rerank search results based on relevance.
</ResponseField>

<ResponseField name="metadata_columns" type="list" required="false">
  Optional list of columns used for metadata-based filtering or enrichment.
</ResponseField>

<ResponseField name="content_columns" type="list" required="false">
  Optional list of columns treated as the main content for embedding and retrieval.
</ResponseField>

<ResponseField name="id_column" type="string" required="false">
  The name of the column that uniquely identifies each content row.
</ResponseField>

<ResponseField name="params" type="object" required="false">
  A nested object that contains additional configuration parameters.
</ResponseField>

<ResponseField name="params.created_embedding_model" type="string" required="false">
  The name of the embedding model associated with this knowledge base at creation time.
</ResponseField>

<RequestExample>
  ```shell Shell theme={null}
  curl -X PUT http://127.0.0.1:47334/api/projects/mindsdb/knowledge_bases/my_kb \
    -H "Content-Type: application/json" \
    -d '{
      "knowledge_base": {
        "embedding_model": {
          "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"
      }
    }'

  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "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"
    }
  }
  ```
</ResponseExample>
