---
title: "Update Knowledge Base"
method: PATCH
path: "/datasets/{dataset_id}"
tags: ["Knowledge Bases"]
---

# Update Knowledge Base

`PATCH /datasets/{dataset_id}`

Updates a knowledge base. Only the fields included in the request body are changed.

## Path parameters

- `dataset_id` string, uuid, required

## Request body

- object
  - `name` string — Name of the knowledge base.
  - `description` string — Description of the knowledge base.
  - `indexing_technique` 'high_quality' | 'economy', nullable — `high_quality` uses embedding models for precise search; `economy` uses keyword-based indexing.
  - `permission` 'only_me' | 'all_team_members' | 'partial_members' — Controls who can access this knowledge base. `only_me` restricts to the creator, `all_team_members` grants access to the entire workspace, `partial_members` grants access to specified members.
  - `embedding_model` string — Embedding model name. Use the `model` field from [Get Available Models](/en/api-reference/models/get-available-models) with `model_type=text-embedding`.
  - `embedding_model_provider` string — Embedding model provider identifier, formatted as `organization/plugin_name/provider_name` (e.g. `langgenius/openai/openai`). A bare name like `openai` expands to `langgenius/<name>/<name>` and works only for langgenius-published plugins. Get valid values from the `provider` field of [Get Available Models](/en/api-reference/models/get-available-models) with `model_type=text-embedding`.
  - `retrieval_model` RetrievalModel
    - `search_method` 'keyword_search' | 'semantic_search' | 'full_text_search' | 'hybrid_search', required — Search method used for retrieval.
    - `reranking_enable` boolean, required — Whether reranking is enabled.
    - `reranking_model` object — Reranking model configuration.
      - `reranking_provider_name` string — Reranking model provider identifier, formatted as `organization/plugin_name/provider_name` (e.g. `langgenius/cohere/cohere`). A bare name like `cohere` expands to `langgenius/<name>/<name>` and works only for langgenius-published plugins. Get valid values from the `provider` field of [Get Available Models](/en/api-reference/models/get-available-models) with `model_type=rerank`.
      - `reranking_model_name` string — Name of the reranking model.
    - `reranking_mode` 'reranking_model' | 'weighted_score', nullable — Reranking mode. Required when `reranking_enable` is `true`.
    - `top_k` integer, required — Maximum number of results to return.
    - `score_threshold_enabled` boolean, required — Whether score threshold filtering is enabled.
    - `score_threshold` number, nullable — Minimum similarity score for results. Only effective when `score_threshold_enabled` is `true`.
    - `weights` object, nullable — Weight configuration for hybrid search.
      - `weight_type` 'semantic_first' | 'keyword_first' | 'customized' — Strategy for balancing semantic and keyword search weights.
      - `vector_setting` object — Semantic search weight settings.
        - `vector_weight` number — Weight assigned to semantic (vector) search results.
        - `embedding_provider_name` string — Provider of the embedding model used for vector search.
        - `embedding_model_name` string — Name of the embedding model used for vector search.
      - `keyword_setting` object — Keyword search weight settings.
        - `keyword_weight` number — Weight assigned to keyword search results.
    - `metadata_filtering_conditions` object, nullable — Restrict retrieval to chunks whose document metadata matches the given conditions. Conditions are evaluated server-side against document metadata fields.
      - `logical_operator` 'and' | 'or', nullable — How to combine multiple conditions.
      - `conditions` object[], nullable — List of metadata conditions to evaluate.
        - `name` string, required — Metadata field name to compare against.
        - `comparison_operator` 'contains' | 'not contains' | 'start with' | 'end with' | 'is' | 'is not' | 'empty' | 'not empty' | 'in' | 'not in' | '=' | '≠' | '>' | '<' | '≥' | '≤' | 'before' | 'after', required — Comparison to apply, by metadata type: - String or array metadata: `contains`, `not contains`, `start with`, `end with`, `is`, `is not`, `empty`, `not empty`, `in`, `not in` - Numeric metadata: `=`, `≠`, `>`, `<`, `≥`, `≤` - Time metadata: `before`, `after`
        - `value` union — Value to compare against. Type depends on `comparison_operator`: string for most string operators, array of strings for `in` and `not in`, number for numeric operators, and omitted for `empty` and `not empty`.
          - string
          - string[]
          - number
  - `partial_member_list` object[] — List of team members with access when `permission` is `partial_members`.
    - `user_id` string — ID of the team member to grant access.
  - `external_retrieval_model` object — Retrieval settings for external knowledge bases.
    - `top_k` integer — Maximum number of results to return.
    - `score_threshold` number — Minimum similarity score threshold for filtering results.
    - `score_threshold_enabled` boolean — Whether score threshold filtering is enabled.
  - `external_knowledge_id` string — ID of the external knowledge base.
  - `external_knowledge_api_id` string — ID of the external knowledge API connection.

## Response `200`

Knowledge base updated successfully.

- Dataset
  - `id` string — Unique identifier of the knowledge base.
  - `name` string — Display name of the knowledge base. Unique within the workspace.
  - `description` string — Optional text describing the purpose or contents of the knowledge base.
  - `provider` string — Provider type. `vendor` for internally managed, `external` for external knowledge base connections.
  - `permission` string — Controls who can access this knowledge base. Possible values: `only_me`, `all_team_members`, `partial_members`.
  - `data_source_type` string — Data source type of the documents, `null` if not yet configured.
  - `indexing_technique` string — `high_quality` uses embedding models for precise search; `economy` uses keyword-based indexing.
  - `app_count` integer — Number of applications currently using this knowledge base.
  - `document_count` integer — Total number of documents in the knowledge base.
  - `word_count` integer — Total word count across all documents.
  - `created_by` string — ID of the user who created the knowledge base.
  - `author_name` string — Display name of the creator.
  - `created_at` number — Creation timestamp (Unix epoch in seconds).
  - `updated_by` string — ID of the user who last updated the knowledge base.
  - `updated_at` number — Last update timestamp (Unix epoch in seconds).
  - `embedding_model` string — Name of the embedding model used for indexing.
  - `embedding_model_provider` string — Embedding model provider identifier, formatted as `organization/plugin_name/provider_name` (e.g. `langgenius/openai/openai`). Legacy knowledge bases may return the bare short form (e.g. `openai`).
  - `embedding_available` boolean — Whether the configured embedding model is currently available.
  - `retrieval_model_dict` object — Retrieval configuration for the knowledge base.
    - `search_method` string — Search method used for retrieval. `keyword_search` for keyword matching, `semantic_search` for embedding-based similarity, `full_text_search` for full-text indexing, `hybrid_search` for a combination of semantic and keyword approaches.
    - `reranking_enable` boolean — Whether reranking is enabled.
    - `reranking_mode` string, nullable — Reranking mode. `reranking_model` for model-based reranking, `weighted_score` for score-based weighting. `null` if reranking is disabled.
    - `reranking_model` object — Reranking model configuration.
      - `reranking_provider_name` string — Reranking model provider identifier, formatted as `organization/plugin_name/provider_name` (e.g. `langgenius/cohere/cohere`). Legacy knowledge bases may return the bare short form (e.g. `cohere`).
      - `reranking_model_name` string — Name of the reranking model.
    - `weights` object, nullable — Weight configuration for hybrid search.
      - `weight_type` string — Strategy for balancing semantic and keyword search weights.
      - `vector_setting` object — Semantic search weight settings.
        - `vector_weight` number — Weight assigned to semantic (vector) search results.
        - `embedding_provider_name` string — Provider of the embedding model used for vector search.
        - `embedding_model_name` string — Name of the embedding model used for vector search.
      - `keyword_setting` object — Keyword search weight settings.
        - `keyword_weight` number — Weight assigned to keyword search results.
    - `top_k` integer — Maximum number of results to return.
    - `score_threshold_enabled` boolean — Whether score threshold filtering is enabled.
    - `score_threshold` number — Minimum similarity score for results. Only effective when `score_threshold_enabled` is `true`.
  - `summary_index_setting` object, nullable — Summary index configuration.
    - `enable` boolean — Whether summary indexing is enabled.
    - `model_name` string — Name of the model used for generating summaries.
    - `model_provider_name` string — Provider of the summary generation model.
    - `summary_prompt` string — Prompt template used for summary generation.
  - `tags` object[] — Tags associated with this knowledge base.
    - `id` string — Tag identifier.
    - `name` string — Tag name.
    - `type` string — Tag type. Always `knowledge` for knowledge base tags.
  - `doc_form` string — Document chunking mode. `text_model` for standard text chunking, `hierarchical_model` for parent-child structure, `qa_model` for QA pair extraction.
  - `external_knowledge_info` object, nullable — Connection details for external knowledge bases. Present when `provider` is `external`.
    - `external_knowledge_id` string — ID of the external knowledge base.
    - `external_knowledge_api_id` string — ID of the external knowledge API connection.
    - `external_knowledge_api_name` string — Display name of the external knowledge API.
    - `external_knowledge_api_endpoint` string — Endpoint URL of the external knowledge API.
  - `external_retrieval_model` object, nullable — Retrieval settings for external knowledge bases. `null` for internal knowledge bases.
    - `top_k` integer — Maximum number of results to return from the external knowledge base.
    - `score_threshold` number — Minimum similarity score threshold.
    - `score_threshold_enabled` boolean — Whether score threshold filtering is enabled.
  - `doc_metadata` object[] — Metadata field definitions for the knowledge base.
    - `id` string — Metadata field identifier.
    - `name` string — Metadata field name.
    - `type` string — Metadata field value type.
  - `built_in_field_enabled` boolean — Whether built-in metadata fields (e.g., `document_name`, `uploader`) are enabled.
  - `pipeline_id` string, nullable — Pipeline ID, if a custom processing pipeline is configured.
  - `runtime_mode` string, nullable — Runtime processing mode.
  - `chunk_structure` string, nullable — Chunk structure configuration.
  - `icon_info` object, nullable — Icon display configuration for the knowledge base.
    - `icon_type` string — Type of icon.
    - `icon` string — Icon identifier or emoji.
    - `icon_background` string — Background color for the icon.
    - `icon_url` string — URL of a custom icon image.
  - `is_published` boolean — Whether the knowledge base is published.
  - `total_documents` integer — Total number of documents.
  - `total_available_documents` integer — Number of documents that are enabled and available.
  - `enable_api` boolean — Whether API access is enabled for this knowledge base.
  - `is_multimodal` boolean — Whether multimodal content processing is enabled.
  - `maintainer` string, nullable — Display name of the knowledge base maintainer. `null` if not set.
  - `partial_member_list` string[], nullable — Account IDs of members granted access when `permission` is `partial_members`. Always present on the update response; on the detail response, present only when `permission` is `partial_members`.

## Other responses

- `400` — `invalid_param` : The embedding or reranking model you specified is not configured or available.
- `403` — - `forbidden` : API access is not enabled for this knowledge base. - `forbidden` : Your subscription's knowledge base request rate limit has been reached.
- `404` — `not_found` : No knowledge base matches `dataset_id`.

---

[API](https://skmtc.net/langgenius/apis/dify-service-api.md) · [All operations](https://skmtc.net/langgenius/apis/dify-service-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/langgenius/dify-service-api/revisions/e49b3db72bad/schema)
