> ## 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.

# ナレッジベース設定を取得

> ナレッジベースの埋め込みモデル、検索設定、準備状況、および [ナレッジベース設定を更新](/ja/api-reference/settings/update-knowledge-base-settings) で送信する `revision` を返します。

API でモデルを設定できるタイミングについては、[モデルと検索設定の変更](/ja/api-reference/guides/knowledge-base#change-models-or-retrieval-settings) を参照してください。



## OpenAPI

````yaml /ja/api-reference/openapi_service.json get /knowledge-fs/spaces/{knowledge_base_id}/settings
openapi: 3.0.1
info:
  description: >-
    Dify アプリケーションとナレッジベースのための REST API です。アプリケーション系エンドポイントはアプリの API
    キーで、ナレッジ系エンドポイントはナレッジベースの API キーで認証します。
  title: Dify サービス API
  version: 1.0.0
servers:
  - description: Dify サービス API のベース URL です。セルフホスト環境では、独自の API ベース URL に置き換えてください。
    url: https://{api_base_url}
    variables:
      api_base_url:
        default: api.dify.ai/v1
        description: API ベース URL のホストとパス（`https://` を除く）。
security:
  - ApiKeyAuth: []
tags:
  - description: チャットメッセージとインタラクションに関連する操作です。
    name: チャットメッセージ
  - description: ファイルのアップロードとプレビューの操作です。
    name: ファイル操作
  - description: エンドユーザー情報に関連する操作です。
    name: エンドユーザー
  - description: ユーザーフィードバックの操作です。
    name: メッセージフィードバック
  - description: 会話管理に関連する操作です。
    name: 会話管理
  - description: テキスト読み上げと音声認識の操作です。
    name: 音声・テキスト変換
  - description: アプリケーション設定と情報を取得する操作です。
    name: アプリケーション設定
  - description: ダイレクト返信用のアノテーション管理に関連する操作です。
    name: アノテーション管理
  - description: 人間の入力を要する一時停止中のワークフローの再開操作です。
    name: 人間の入力
  - description: ワークフローの実行と管理のための操作です。
    name: ワークフロー実行
  - description: テキスト生成に関連する操作です。
    name: 完了メッセージ
  - description: ナレッジベースの作成、設定、取得を含むナレッジベース管理の操作です。
    name: ナレッジベース
  - description: ナレッジベース内のドキュメントの作成、更新、管理のための操作です。
    name: ドキュメント
  - description: ドキュメントチャンクと子チャンクの管理のための操作です。
    name: チャンク
  - description: ナレッジベースのメタデータフィールドとドキュメントメタデータ値の管理のための操作です。
    name: メタデータ
  - description: ナレッジベースタグとタグバインディングの管理のための操作です。
    name: タグ管理
  - description: 利用可能なモデルを取得するための操作です。
    name: モデル
  - description: データソースプラグインとパイプライン実行を含むナレッジパイプラインの管理と実行のための操作です。
    name: ナレッジパイプライン
  - description: ナレッジベースに質問し、回答をストリーミングで受け取ります。
    name: クエリ
  - description: クエリが何を検索したか、またその理由を確認します。
    name: クエリ記録
  - description: リサーチの質問をバックグラウンドで実行し、その結果を取得します。
    name: リサーチタスク
  - description: ナレッジベースのドキュメントと、そのファイル、リビジョン、チャンクを読み取り、ドキュメントにメタデータのラベルを付けます。
    name: ドキュメントとチャンク
  - description: インデックス処理の追跡、キャンセル、再試行と、ナレッジベースのバックグラウンドタスクの一覧表示を行います。
    name: インデックスタスク
  - description: ドキュメントファイル、ファイルのバッチ、またはソースの削除を、完了するまで追跡します。
    name: 削除ジョブ
  - description: ナレッジベースにデータを供給するソース、その同期スケジュール、接続を管理します。
    name: ソース
  - description: ソースの即時同期、ウェブサイトのページまたはプロバイダーのアイテムのインポート、実行の追跡、キャンセル、再試行を行います。
    name: ソースの同期とインポート
  - description: ナレッジベースのモデルと検索設定の読み取りと変更、および変更によって始まる移行の追跡を行います。
    name: 設定
paths:
  /knowledge-fs/spaces/{knowledge_base_id}/settings:
    get:
      tags:
        - Settings
      summary: ナレッジベース設定を取得
      description: >-
        ナレッジベースの埋め込みモデル、検索設定、準備状況、および
        [ナレッジベース設定を更新](/ja/api-reference/settings/update-knowledge-base-settings)
        で送信する `revision` を返します。


        API
        でモデルを設定できるタイミングについては、[モデルと検索設定の変更](/ja/api-reference/guides/knowledge-base#change-models-or-retrieval-settings)
        を参照してください。
      operationId: getKnowledgeBaseSettings
      parameters:
        - description: >-
            ナレッジベース ID です。ナレッジベースの **API アクセス** ダイアログに表示されるサービス API
            エンドポイントの最後のセグメント（`…/knowledge-fs/spaces/<knowledge base
            ID>`）です。アドレスバーでは `/datasets/new/` の後のセグメントです。
          in: path
          name: knowledge_base_id
          required: true
          schema:
            format: uuid
            type: string
      responses:
        '200':
          content:
            application/json:
              examples:
                setup_required:
                  summary: レスポンス例 - セットアップが必要
                  value:
                    active_profile_available: false
                    active_profile_revisions:
                      embedding: null
                      retrieval: null
                    capabilities:
                      deep: false
                      index: false
                      ingest: false
                      query: false
                      research: false
                      source_sync: false
                    configuration_state: setup-required
                    embedding: null
                    issues:
                      - code: missing
                        field: embedding
                        retryable: false
                      - code: missing
                        field: reasoning
                        retryable: false
                      - code: missing
                        field: rerank
                        retryable: false
                    retrieval: null
                    revision: 1
                success:
                  summary: レスポンス例 - モデルがアクティブ
                  value:
                    active_profile_available: true
                    active_profile_revisions:
                      embedding: 2
                      retrieval: 3
                    capabilities:
                      deep: true
                      index: true
                      ingest: true
                      query: true
                      research: true
                      source_sync: true
                    configuration_state: active
                    embedding:
                      dimension: 1536
                      model: text-embedding-3-small
                      plugin_id: langgenius/openai
                      provider: openai
                      revision: 2
                      vector_space_id: >-
                        embedding-space-sha256:4f7c2d9a1b3e5f60718293a4b5c6d7e8f9a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4
                    issues: []
                    retrieval:
                      default_mode: fast
                      reasoning_model:
                        dimension: null
                        model: gpt-4.1-mini
                        plugin_id: langgenius/openai
                        provider: openai
                        revision: null
                        vector_space_id: null
                      rerank:
                        enabled: true
                        model:
                          model: rerank-v3.5
                          pluginId: langgenius/cohere
                          provider: cohere
                      revision: 3
                      score_threshold:
                        enabled: false
                        stage: mode-final
                        value: null
                      top_k: 10
                    revision: 7
              schema:
                $ref: '#/components/schemas/KnowledgeBaseSettings'
          description: ナレッジベースの設定です。
        '401':
          content:
            application/json:
              examples:
                knowledge_fs_invalid_credential:
                  summary: knowledge_fs_invalid_credential
                  value:
                    code: knowledge_fs_invalid_credential
                    message: Invalid Agent Knowledge Base service credential.
                    status: 401
                unauthorized_1:
                  summary: unauthorized (header missing)
                  value:
                    code: unauthorized
                    message: >-
                      Authorization header must be provided and start with
                      'Bearer'
                    status: 401
                unauthorized_2:
                  summary: unauthorized (key unknown)
                  value:
                    code: unauthorized
                    message: Access token is invalid
                    status: 401
          description: >-
            - `unauthorized`：`Authorization` ヘッダーがないか、キーが不明であるか、ナレッジベースの API
            キーではありません。

            - `knowledge_fs_invalid_credential`：キーは有効ですが、キーのワークスペースにこの ID
            のナレッジベースが存在しないか、キーがワークスペースに紐付いていません。
        '403':
          content:
            application/json:
              examples:
                forbidden:
                  summary: forbidden (rate limit)
                  value:
                    code: forbidden
                    message: >-
                      Sorry, you have reached the knowledge base request rate
                      limit of your subscription.
                    status: 403
                knowledge_fs_access_denied:
                  summary: knowledge_fs_access_denied
                  value:
                    code: knowledge_fs_access_denied
                    message: Agent Knowledge Base operation is not allowed.
                    status: 403
          description: >-
            -
            `knowledge_fs_access_denied`：キーのアクセス範囲がほかのナレッジベースに限定されているか、このナレッジベースで
            **API アクセス** がオフになっています。または、ナレッジベースがアクティブではありません。

            - `forbidden`：Dify Cloud
            で、ワークスペースがサブスクリプションで定められたナレッジベースのリクエストレート制限に達しました。読み取りを含め、すべての呼び出しがカウントされます。
        '404':
          content:
            application/json:
              examples:
                knowledge_fs_resource_not_found:
                  summary: knowledge_fs_resource_not_found
                  value:
                    code: knowledge_fs_resource_not_found
                    failure:
                      category: not_found
                      code: KNOWLEDGE_FS_NOT_FOUND
                      message: >-
                        The requested Agent Knowledge Base resource was not
                        found.
                      retryPolicy: never
                      traceId: 9b7d3e1a-4c2f-4a8e-b6d0-5f1e2c3d4a5b
                    message: The requested Agent Knowledge Base resource was not found.
                    status: 404
                not_found:
                  summary: not_found (feature off)
                  value:
                    code: not_found
                    message: >-
                      The requested URL was not found on the server. If you
                      entered the URL manually please check your spelling and
                      try again.
                    status: 404
          description: |-
            - `knowledge_fs_resource_not_found`：ナレッジベース ID が認識されません。
            - `not_found`：このデプロイ環境では Agent ナレッジベース機能が無効になっています。
        '502':
          content:
            application/json:
              examples:
                knowledge_fs_upstream_unavailable:
                  summary: knowledge_fs_upstream_unavailable
                  value:
                    code: knowledge_fs_upstream_unavailable
                    message: Agent Knowledge Base is unavailable.
                    status: 502
                knowledge_fs_upstream_unavailable_upstream:
                  summary: knowledge_fs_upstream_unavailable (internal error)
                  value:
                    code: knowledge_fs_upstream_unavailable
                    failure:
                      action: contact_admin
                      category: internal
                      code: KNOWLEDGE_FS_INTERNAL_ERROR
                      message: >-
                        Agent Knowledge Base could not complete the operation.
                        Try again, or contact an administrator with the error
                        reference.
                      retryPolicy: manual
                      traceId: 9b7d3e1a-4c2f-4a8e-b6d0-5f1e2c3d4a5b
                    message: >-
                      Agent Knowledge Base could not complete the operation. Try
                      again, or contact an administrator with the error
                      reference.
                    status: 502
          description: >-
            -
            `knowledge_fs_upstream_unavailable`：時間内に応答が返らなかったか、応答を読み取れませんでした。しばらく待ってから再試行してください。
        '503':
          content:
            application/json:
              examples:
                knowledge_fs_operation_unavailable:
                  summary: knowledge_fs_operation_unavailable
                  value:
                    code: knowledge_fs_operation_unavailable
                    message: Agent Knowledge Base operation is not available.
                    status: 503
                knowledge_fs_operation_unavailable_upstream:
                  summary: knowledge_fs_operation_unavailable (temporary)
                  value:
                    code: knowledge_fs_operation_unavailable
                    failure:
                      action: retry
                      category: dependency
                      code: KNOWLEDGE_FS_UNAVAILABLE
                      message: >-
                        A service required by Agent Knowledge Base is
                        temporarily unavailable.
                      retryPolicy: manual
                      traceId: 5e2a9c17-3b4d-4f60-8a1b-2c3d4e5f6a7b
                    message: >-
                      A service required by Agent Knowledge Base is temporarily
                      unavailable.
                    status: 503
          description: >-
            - `knowledge_fs_operation_unavailable`：このワークスペースで Agent
            ナレッジベース機能が設定されていないか、このデプロイ環境ではこの操作を利用できません。または、リクエストの認可中に、このナレッジベースに対するキーのアクセス権が変更されました。再試行してください。

            -
            `knowledge_fs_operation_unavailable`：現在このリクエストを処理できません。`failure.retryPolicy`
            に従ってください。
components:
  schemas:
    KnowledgeBaseSettings:
      properties:
        active_profile_available:
          description: >-
            埋め込みモデルと検索設定の両方がアクティブな場合は `true`
            です。最初のドキュメントのインデックス処理が済むとアクティブになります。
          type: boolean
        active_profile_revisions:
          description: >-
            アクティブなモデルのリビジョンです。最初のドキュメントのインデックス処理が済むまでは、いずれも `null`
            です。プロファイルがアクティブになった後は、[ナレッジベース設定を更新](/ja/api-reference/settings/update-knowledge-base-settings)
            による変更は設定の移行として実行されます。
          properties:
            embedding:
              description: アクティブな埋め込みモデルのリビジョンです。
              nullable: true
              type: integer
            retrieval:
              description: アクティブな検索設定のリビジョンです。
              nullable: true
              type: integer
          type: object
        capabilities:
          description: >-
            公開済みの設定で各機能を使える状態かどうかを示します。3 つのフラグは検索の深度に対応し、`query` は `fast` を表します。


            特定の深度で使えるかどうかを確認するには、その深度を `mode` として明示的に送信し、対応するフラグを確認してください。`mode`
            を省略したクエリの深度を判断するために、保留中の `retrieval.default_mode` を使用しないでください。
          properties:
            deep:
              description: '`deep` の深度でクエリを実行できます。'
              type: boolean
            index:
              description: ドキュメントのインデックス処理を実行できます。モデルがアクティブです。
              type: boolean
            ingest:
              description: >-
                ドキュメントを追加できます。モデルがアクティブであるか、保留中の設定が揃っていて、最初のドキュメントでアクティブ化できる状態です。
              type: boolean
            query:
              description: '`fast` の深度でクエリを実行できます。'
              type: boolean
            research:
              description: '`research` の深度でクエリを実行できます。'
              type: boolean
            source_sync:
              description: ソースを同期できます。条件は `ingest` と同じです。
              type: boolean
          type: object
        configuration_state:
          description: >-
            埋め込みモデルと完全な検索設定（有効なリランクモデルを含む）が保存されている場合は `active` です。いずれかが欠けている場合は
            `setup-required` です。最初のドキュメントのインデックス処理中に、保留中の設定が検証に失敗した場合は
            `validation-failed` です。失敗した設定は `issues` に示されます。
          type: string
        embedding:
          description: >-
            埋め込みモデルです。保留中の選択が保存されている場合はその選択、それ以外の場合はアクティブなモデルです。保留中の選択は、クエリが現在使用しているモデルと異なる場合があります。設定されていない場合は
            `null` です。


            `dimension`、`revision`、`vector_space_id` は参考情報であり、これらを受け取る操作はありません。
          nullable: true
          properties:
            dimension:
              description: ベクトルの次元数で、モデルの初回使用時に確認されます。モデルがアクティブになるまでは `null` です。
              nullable: true
              type: integer
            model:
              description: モデル名です。
              type: string
            plugin_id:
              description: モデルを提供するプラグインです。`organization/plugin_name` の形式で指定します。
              type: string
            provider:
              description: プラグイン内のプロバイダー名です。
              type: string
            revision:
              description: アクティブな埋め込みモデルのリビジョンです。モデルがアクティブになるまでは `null` です。
              nullable: true
              type: integer
            vector_space_id:
              description: モデルのベクトルの保存先を識別します。モデルがアクティブになるまでは `null` です。
              nullable: true
              type: string
          type: object
        issues:
          description: ナレッジベースが使用可能になるのを妨げている問題です。問題がない場合は空です。
          items:
            properties:
              code:
                description: >-
                  設定の問題点です：


                  - `missing`：選択されていないか、リランクが無効です。

                  -
                  `validation_failed`、`unavailable`、`incompatible`：保留中の設定が検証に失敗しました。`incompatible`
                  の場合は、モデルが対応するタスク、埋め込みの次元数、選択したモデルをプロバイダーが返したかどうかを確認してください。

                  - `binding_missing`：公開済みのコンテンツが、設定されたモデルを使用できる状態になっていません。Dify
                  でインデックス処理の進捗を確認してください。

                  - `publication` に対する
                  `unavailable`：公開済みのコンテンツが、すべての深度に対応できる状態になっていません。
                type: string
              field:
                description: >-
                  対象の設定で、`embedding`、`reasoning`、`rerank`、`publication`（公開済みのコンテンツ）のいずれかです。
                type: string
              retryable:
                description: 設定を変更しなくても、時間をおいて再試行すれば問題が解消するかどうかです。
                type: boolean
            type: object
          type: array
        retrieval:
          description: >-
            検索設定です。保留中の選択が保存されている場合はその選択、それ以外の場合はアクティブな設定です。保留中の選択は、クエリが現在使用している設定と異なる場合があります。設定されていない場合は
            `null` です。
          nullable: true
          properties:
            default_mode:
              description: >-
                返された検索設定におけるデフォルトの深度で、`fast`、`deep`、`research` のいずれかです。`mode`
                を省略したクエリは、公開済みのデフォルトを使用します。保留中の設定が返されている場合、公開済みのデフォルトはこの値と異なることがあります。
              type: string
            reasoning_model:
              description: >-
                システムの推論モデルです。`dimension`、`revision`、`vector_space_id` は常に `null`
                です。
              properties:
                dimension:
                  description: 常に `null` です。
                  nullable: true
                  type: integer
                model:
                  description: モデル名です。
                  type: string
                plugin_id:
                  description: モデルを提供するプラグインです。`organization/plugin_name` の形式で指定します。
                  type: string
                provider:
                  description: プラグイン内のプロバイダー名です。
                  type: string
                revision:
                  description: 常に `null` です。
                  nullable: true
                  type: integer
                vector_space_id:
                  description: 常に `null` です。
                  nullable: true
                  type: string
              type: object
            rerank:
              description: >-
                リランクモデルです。このレスポンスのほかの部分とは異なり、`model` オブジェクトではキャメルケースのキー
                `pluginId` が使われます。
              properties:
                enabled:
                  description: 検索されたチャンクをリランクするかどうかです。
                  type: boolean
                model:
                  description: 選択されたリランクモデルです。リランクモデルが設定されていない場合は `null` です。
                  nullable: true
                  properties:
                    model:
                      description: モデル名です。
                      type: string
                    pluginId:
                      description: モデルを提供するプラグインです。`organization/plugin_name` の形式で指定します。
                      type: string
                    provider:
                      description: プラグイン内のプロバイダー名です。
                      type: string
                  type: object
              type: object
            revision:
              description: アクティブな検索設定のリビジョンです。設定が保留中の間は `null` です。
              nullable: true
              type: integer
            score_threshold:
              description: スコアの低いチャンクを除外するスコアしきい値です。
              properties:
                enabled:
                  description: しきい値を適用するかどうかです。
                  type: boolean
                stage:
                  description: >-
                    しきい値を適用する段階です。`mode-final` は、実行される検索の深度の最終スコアに適用します。`fast` と
                    `deep` ではリランクスコア、`research` では PageIndex スコアです。`rerank`
                    は同じ設定の旧名称です。
                  type: string
                value:
                  description: しきい値となるスコアで、0 から 1 の値です。設定されていない場合は `null` です。
                  nullable: true
                  type: number
              type: object
            top_k:
              description: 1 回の検索で返すチャンクの最大数です。
              type: integer
          type: object
        revision:
          description: >-
            設定のリビジョンです。[ナレッジベース設定を更新](/ja/api-reference/settings/update-knowledge-base-settings)
            で `expectedRevision` として送信します。このレスポンスにあるほかのリビジョンのフィールドは、この値とは別物です。
          type: integer
      type: object
  securitySchemes:
    ApiKeyAuth:
      bearerFormat: API_KEY
      description: >-
        すべてのリクエストは API キーで認証します：`Authorization: Bearer
        {API_KEY}`。アプリのエンドポイントにはアプリの API キーを、ナレッジのエンドポイントにはナレッジベースの API
        キーを使用します（[Dify API クイックスタート](/ja/api-reference/guides/get-started)）。


        キーはサーバーサイドで保管し、クライアントコードには決して埋め込まないでください。キーが欠落または無効なリクエストは HTTP
        `401`（`unauthorized`）で失敗します。
      scheme: bearer
      type: http

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.