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

# ナレッジベースを更新

> 既存のナレッジベースの名前、説明、権限、または検索設定を更新します。リクエストボディで指定されたフィールドのみが更新されます。



## OpenAPI

````yaml /ja/api-reference/openapi_knowledge.json patch /datasets/{dataset_id}
openapi: 3.0.1
info:
  title: ナレッジAPI
  description: >-
    ナレッジベース、ドキュメント、チャンク、メタデータ、タグの管理（作成、取得、設定を含む）のための API です。**注意：**単一のナレッジベース
    API キーは、同じアカウント配下のすべての可視ナレッジベースを操作する権限を持ちます。データセキュリティにご注意ください。
  version: 1.0.0
servers:
  - url: https://{api_base_url}
    description: Knowledge API のベース URL です。セルフホスト環境では、独自の API ベース URL に置き換えてください。
    variables:
      api_base_url:
        default: api.dify.ai/v1
        description: API ベース URL のホストとパス（`https://` を除く）。
security:
  - ApiKeyAuth: []
tags:
  - name: データセット
    description: ナレッジベースの作成、設定、取得を含むナレッジベース管理の操作です。
  - name: ドキュメント
    description: ナレッジベース内のドキュメントの作成、更新、管理のための操作です。
  - name: チャンク
    description: ドキュメントチャンクと子チャンクの管理のための操作です。
  - name: メタデータ
    description: ナレッジベースのメタデータフィールドとドキュメントメタデータ値の管理のための操作です。
  - name: タグ管理
    description: ナレッジベースタグとタグバインディングの管理のための操作です。
  - name: モデル
    description: 利用可能なモデルを取得するための操作です。
  - name: ナレッジパイプライン
    description: データソースプラグインとパイプライン実行を含むナレッジパイプラインの管理と実行のための操作です。
paths:
  /datasets/{dataset_id}:
    patch:
      tags:
        - データセット
      summary: ナレッジベースを更新
      description: 既存のナレッジベースの名前、説明、権限、または検索設定を更新します。リクエストボディで指定されたフィールドのみが更新されます。
      operationId: updateDataset
      parameters:
        - name: dataset_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: ナレッジベース ID です。
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  minLength: 1
                  maxLength: 40
                  description: ナレッジベース名。
                description:
                  type: string
                  maxLength: 400
                  description: ナレッジベースの説明です。
                indexing_technique:
                  type: string
                  enum:
                    - high_quality
                    - economy
                  nullable: true
                  description: >-
                    `high_quality` は埋め込みモデルを使用した精密検索、`economy`
                    はキーワードベースのインデキシングです。
                permission:
                  type: string
                  enum:
                    - only_me
                    - all_team_members
                    - partial_members
                  description: >-
                    このナレッジベースにアクセスできるユーザーを制御します。`only_me`
                    は作成者のみに制限、`all_team_members`
                    はワークスペース全体にアクセスを許可、`partial_members` は指定されたメンバーにアクセスを許可します。
                embedding_model:
                  type: string
                  description: >-
                    埋め込みモデル名です。[利用可能なモデルを取得](/api-reference/モデル/利用可能なモデルを取得) で
                    `model_type=text-embedding` を指定した際の `model` フィールドの値を使用します。
                embedding_model_provider:
                  type: string
                  description: >-
                    埋め込みモデルプロバイダーです。[利用可能なモデルを取得](/api-reference/モデル/利用可能なモデルを取得)
                    で `model_type=text-embedding` を指定した際の `provider`
                    フィールドの値を使用します。
                retrieval_model:
                  $ref: '#/components/schemas/RetrievalModel'
                  description: 検索モデルの設定です。このナレッジベースをクエリする際のチャンクの検索方法とランキング方法を制御します。
                partial_member_list:
                  type: array
                  description: '`permission` が `partial_members` の場合にアクセス権を持つチームメンバーのリストです。'
                  items:
                    type: object
                    properties:
                      user_id:
                        type: string
                        description: アクセス権を付与するチームメンバーの ID です。
                external_retrieval_model:
                  type: object
                  description: 外部ナレッジベースの検索設定です。
                  properties:
                    top_k:
                      type: integer
                      description: 返す結果の最大数です。
                    score_threshold:
                      type: number
                      description: 結果フィルタリング用の最小関連性スコア閾値です。
                    score_threshold_enabled:
                      type: boolean
                      description: スコア閾値フィルタリングが有効かどうかです。
                external_knowledge_id:
                  type: string
                  description: 外部ナレッジベースの ID です。
                external_knowledge_api_id:
                  type: string
                  description: 外部ナレッジ API 接続の ID です。
      responses:
        '200':
          description: ナレッジベースが正常に更新されました。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Dataset'
              examples:
                success:
                  summary: レスポンス例
                  value:
                    id: c42e2a6e-40b3-4330-96f8-f1e4d768e8c9
                    name: Product Documentation
                    description: プロダクト API 技術ドキュメント
                    provider: vendor
                    permission: only_me
                    data_source_type: null
                    indexing_technique: high_quality
                    app_count: 0
                    document_count: 0
                    word_count: 0
                    created_by: ad313dd6-ef04-4dd1-a5b0-c0f0b9e2e7e4
                    author_name: admin
                    created_at: 1741267200
                    updated_by: ad313dd6-ef04-4dd1-a5b0-c0f0b9e2e7e4
                    updated_at: 1741267200
                    embedding_model: text-embedding-3-small
                    embedding_model_provider: openai
                    embedding_available: true
                    retrieval_model_dict:
                      search_method: semantic_search
                      reranking_enable: false
                      reranking_mode: null
                      reranking_model:
                        reranking_provider_name: ''
                        reranking_model_name: ''
                      weights: null
                      top_k: 3
                      score_threshold_enabled: false
                      score_threshold: null
                    tags: []
                    doc_form: text_model
                    external_knowledge_info: null
                    external_retrieval_model: null
                    doc_metadata: []
                    built_in_field_enabled: true
                    pipeline_id: null
                    runtime_mode: null
                    chunk_structure: null
                    icon_info: null
                    summary_index_setting: null
                    is_published: false
                    total_documents: 0
                    total_available_documents: 0
                    enable_api: true
                    is_multimodal: false
        '403':
          description: '`forbidden` : このナレッジベースにアクセスする権限がありません。'
          content:
            application/json:
              examples:
                forbidden:
                  summary: forbidden
                  value:
                    status: 403
                    code: forbidden
                    message: Insufficient permissions to access this knowledge base.
        '404':
          description: '`not_found` : ナレッジベースが見つかりません。'
          content:
            application/json:
              examples:
                not_found:
                  summary: not_found
                  value:
                    status: 404
                    code: not_found
                    message: Dataset not found.
components:
  schemas:
    RetrievalModel:
      type: object
      required:
        - search_method
        - reranking_enable
        - top_k
        - score_threshold_enabled
      properties:
        search_method:
          type: string
          description: 検索に使用される検索メソッドです。
          enum:
            - keyword_search
            - semantic_search
            - full_text_search
            - hybrid_search
        reranking_enable:
          type: boolean
          description: リランキングが有効かどうかです。
        reranking_model:
          type: object
          description: リランキングモデルの設定です。
          properties:
            reranking_provider_name:
              type: string
              description: リランキングモデルのプロバイダー名です。
            reranking_model_name:
              type: string
              description: リランキングモデル名です。
        reranking_mode:
          type: string
          enum:
            - reranking_model
            - weighted_score
          nullable: true
          description: リランキングモードです。`reranking_enable` が `true` の場合は必須です。
        top_k:
          type: integer
          description: 返す結果の最大数です。
        score_threshold_enabled:
          type: boolean
          description: スコア閾値フィルタリングが有効かどうかです。
        score_threshold:
          type: number
          nullable: true
          description: 結果の最小関連性スコアです。`score_threshold_enabled` が `true` の場合にのみ有効です。
        weights:
          type: object
          nullable: true
          description: ハイブリッド検索の重み設定です。
          properties:
            weight_type:
              type: string
              description: セマンティック検索とキーワード検索の重みを調整するための戦略です。
              enum:
                - semantic_first
                - keyword_first
                - customized
            vector_setting:
              type: object
              description: セマンティック検索の重み設定です。
              properties:
                vector_weight:
                  type: number
                  description: セマンティック（ベクトル）検索結果に割り当てられた重みです。
                embedding_provider_name:
                  type: string
                  description: ベクトル検索に使用される埋め込みモデルのプロバイダーです。
                embedding_model_name:
                  type: string
                  description: ベクトル検索に使用される埋め込みモデルの名前です。
            keyword_setting:
              type: object
              description: キーワード検索の重み設定です。
              properties:
                keyword_weight:
                  type: number
                  description: キーワード検索結果に割り当てられた重みです。
        metadata_filtering_conditions:
          type: object
          nullable: true
          description: ドキュメントのメタデータが指定した条件に一致するチャンクのみを取得対象に絞り込みます。条件はサーバーサイドで評価されます。
          properties:
            logical_operator:
              type: string
              enum:
                - and
                - or
              default: and
              nullable: true
              description: 複数の条件を組み合わせる方法です。
            conditions:
              type: array
              nullable: true
              description: 評価するメタデータ条件のリストです。
              items:
                type: object
                required:
                  - name
                  - comparison_operator
                properties:
                  name:
                    type: string
                    description: 比較対象とするメタデータフィールド名です。
                  comparison_operator:
                    type: string
                    description: >-
                      適用する比較方法です。文字列演算子（`contains`、`not contains`、`start
                      with`、`end with`、`is`、`is not`、`empty`、`not
                      empty`、`in`、`not
                      in`）は文字列または配列のメタデータに作用します。数値演算子（`=`、`≠`、`>`、`<`、`≥`、`≤`）は数値メタデータに作用します。時刻演算子（`before`、`after`）は時刻メタデータに作用します。
                    enum:
                      - contains
                      - not contains
                      - start with
                      - end with
                      - is
                      - is not
                      - empty
                      - not empty
                      - in
                      - not in
                      - '='
                      - ≠
                      - '>'
                      - <
                      - ≥
                      - ≤
                      - before
                      - after
                  value:
                    nullable: true
                    description: >-
                      比較対象の値です。型は `comparison_operator`
                      によって異なります。ほとんどの文字列演算子では文字列、`in` および `not in`
                      では文字列配列、数値演算子では数値、`empty` および `not empty` では省略します。
                    oneOf:
                      - type: string
                      - type: array
                        items:
                          type: string
                      - type: number
    Dataset:
      type: object
      properties:
        id:
          type: string
          description: ナレッジベースの一意識別子です。
        name:
          type: string
          description: ナレッジベースの表示名です。ワークスペース内で一意です。
        description:
          type: string
          description: ナレッジベースの目的または内容を説明するオプションのテキストです。
        provider:
          type: string
          description: プロバイダータイプです。内部管理の場合は `vendor`、外部ナレッジベース接続の場合は `external` です。
        permission:
          type: string
          description: >-
            このナレッジベースにアクセスできるユーザーを制御します。指定可能な値：`only_me`、`all_team_members`、`partial_members`。
        data_source_type:
          type: string
          description: ドキュメントのデータソースタイプです。まだ設定されていない場合は `null` です。
        indexing_technique:
          type: string
          description: '`high_quality` は埋め込みモデルを使用した精密検索、`economy` はキーワードベースのインデキシングです。'
        app_count:
          type: integer
          description: 現在このナレッジベースを使用しているアプリケーションの数です。
        document_count:
          type: integer
          description: ナレッジベース内のドキュメント総数です。
        word_count:
          type: integer
          description: 全ドキュメントの合計単語数です。
        created_by:
          type: string
          description: ナレッジベースを作成したユーザーの ID です。
        author_name:
          type: string
          description: 作成者の表示名です。
        created_at:
          type: number
          description: 作成タイムスタンプ（Unix エポック、秒単位）です。
        updated_by:
          type: string
          description: ナレッジベースを最後に更新したユーザーの ID です。
        updated_at:
          type: number
          description: 最終更新タイムスタンプ（Unix エポック、秒単位）です。
        embedding_model:
          type: string
          description: インデックス作成に使用される埋め込みモデルの名前です。
        embedding_model_provider:
          type: string
          description: >-
            埋め込みモデルプロバイダーです。[利用可能なモデルを取得](/api-reference/モデル/利用可能なモデルを取得) で
            `model_type=text-embedding` を指定した際の `provider` フィールドの値を使用します。
        embedding_available:
          type: boolean
          description: 設定された埋め込みモデルが現在利用可能かどうかです。
        retrieval_model_dict:
          type: object
          description: ナレッジベースの検索設定です。
          properties:
            search_method:
              type: string
              description: >-
                検索に使用する検索方法です。`keyword_search` はキーワードマッチング、`semantic_search`
                は埋め込みベースの類似度検索、`full_text_search` は全文インデックス検索、`hybrid_search`
                はセマンティックとキーワードの組み合わせ検索を示します。
            reranking_enable:
              type: boolean
              description: リランキングが有効かどうかです。
            reranking_mode:
              type: string
              nullable: true
              description: >-
                リランキングモードです。`reranking_model` はモデルベースのリランキング、`weighted_score`
                はスコアベースの重み付けを示します。リランキングが無効の場合は `null` です。
            reranking_model:
              type: object
              description: リランキングモデルの設定です。
              properties:
                reranking_provider_name:
                  type: string
                  description: リランキングモデルのプロバイダー名です。
                reranking_model_name:
                  type: string
                  description: リランキングモデル名です。
            weights:
              type: object
              nullable: true
              description: ハイブリッド検索の重み設定です。
              properties:
                weight_type:
                  type: string
                  description: セマンティック検索とキーワード検索の重みを調整するための戦略です。
                vector_setting:
                  type: object
                  description: セマンティック検索の重み設定です。
                  properties:
                    vector_weight:
                      type: number
                      description: セマンティック（ベクトル）検索結果に割り当てられた重みです。
                    embedding_provider_name:
                      type: string
                      description: ベクトル検索に使用される埋め込みモデルのプロバイダーです。
                    embedding_model_name:
                      type: string
                      description: ベクトル検索に使用される埋め込みモデルの名前です。
                keyword_setting:
                  type: object
                  description: キーワード検索の重み設定です。
                  properties:
                    keyword_weight:
                      type: number
                      description: キーワード検索結果に割り当てられた重みです。
            top_k:
              type: integer
              description: 返す結果の最大数です。
            score_threshold_enabled:
              type: boolean
              description: スコア閾値フィルタリングが有効かどうかです。
            score_threshold:
              type: number
              description: 結果の最小関連性スコアです。`score_threshold_enabled` が `true` の場合にのみ有効です。
        summary_index_setting:
          type: object
          nullable: true
          description: サマリーインデックスの設定です。
          properties:
            enable:
              type: boolean
              description: サマリーインデックスが有効かどうかです。
            model_name:
              type: string
              description: 要約生成に使用されるモデルの名前です。
            model_provider_name:
              type: string
              description: 要約生成モデルのプロバイダーです。
            summary_prompt:
              type: string
              description: 要約生成に使用されるプロンプトテンプレートです。
        tags:
          type: array
          description: このナレッジベースに関連付けられたタグです。
          items:
            type: object
            properties:
              id:
                type: string
                description: タグ識別子です。
              name:
                type: string
                description: Tag name.
              type:
                type: string
                description: タグタイプです。ナレッジベースタグの場合は常に `knowledge` です。
        doc_form:
          type: string
          description: >-
            ドキュメントのチャンキングモードです。`text_model` は標準テキストチャンキング、`hierarchical_model`
            は親子構造、`qa_model` は QA ペア抽出を示します。
        external_knowledge_info:
          type: object
          nullable: true
          description: 外部ナレッジベースの接続詳細です。`provider` が `external` の場合に存在します。
          properties:
            external_knowledge_id:
              type: string
              description: 外部ナレッジベースの ID です。
            external_knowledge_api_id:
              type: string
              description: 外部ナレッジ API 接続の ID です。
            external_knowledge_api_name:
              type: string
              description: 外部ナレッジ API の表示名です。
            external_knowledge_api_endpoint:
              type: string
              description: 外部ナレッジ API のエンドポイント URL です。
        external_retrieval_model:
          type: object
          nullable: true
          description: 外部ナレッジベースの検索設定です。内部ナレッジベースの場合は `null` です。
          properties:
            top_k:
              type: integer
              description: 外部ナレッジベースから返す結果の最大数です。
            score_threshold:
              type: number
              description: 最小関連性スコアのしきい値です。
            score_threshold_enabled:
              type: boolean
              description: スコア閾値フィルタリングが有効かどうかです。
        doc_metadata:
          type: array
          description: ナレッジベースのメタデータフィールド定義です。
          items:
            type: object
            properties:
              id:
                type: string
                description: メタデータフィールドの識別子です。
              name:
                type: string
                description: メタデータフィールド名です。
              type:
                type: string
                description: メタデータフィールドの値の種類です。
        built_in_field_enabled:
          type: boolean
          description: 組み込みメタデータフィールド（例：`document_name`、`uploader`）が有効かどうかです。
        pipeline_id:
          type: string
          nullable: true
          description: カスタム処理パイプラインが設定されている場合のパイプライン ID です。
        runtime_mode:
          type: string
          nullable: true
          description: ランタイム処理モードです。
        chunk_structure:
          type: string
          nullable: true
          description: チャンク構造の設定です。
        icon_info:
          type: object
          nullable: true
          description: ナレッジベースのアイコン表示設定です。
          properties:
            icon_type:
              type: string
              description: アイコンの種類です。
            icon:
              type: string
              description: アイコン識別子または絵文字です。
            icon_background:
              type: string
              description: アイコンの背景色です。
            icon_url:
              type: string
              description: カスタムアイコン画像の URL です。
        is_published:
          type: boolean
          description: ナレッジベースが公開済みかどうかです。
        total_documents:
          type: integer
          description: ドキュメントの合計数です。
        total_available_documents:
          type: integer
          description: 有効で利用可能なドキュメントの数です。
        enable_api:
          type: boolean
          description: このナレッジベースで API アクセスが有効かどうかです。
        is_multimodal:
          type: boolean
          description: マルチモーダルコンテンツ処理が有効かどうかです。
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer
      bearerFormat: API_KEY
      description: >-
        API Key 認証です。すべての API リクエストにおいて、`Authorization` HTTP ヘッダーに `Bearer `
        プレフィックスを付けた API Key を含めてください。例：`Authorization: Bearer {API_KEY}`。**API
        Key はサーバーサイドに保存し、クライアントサイドで共有・保存しないことを強く推奨します。API Key
        の漏洩は深刻な結果につながる可能性があります。**

````