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

# Get Knowledge Base Settings

> Returns the knowledge base's embedding model, retrieval settings, readiness, and the `revision` to send in [Update Knowledge Base Settings](/en/api-reference/settings/update-knowledge-base-settings).

For when models can be set over the API, see [Change Models or Retrieval Settings](/en/api-reference/guides/knowledge-base#change-models-or-retrieval-settings).



## OpenAPI

````yaml /en/api-reference/openapi_service.json get /knowledge-fs/spaces/{knowledge_base_id}/settings
openapi: 3.0.1
info:
  description: >-
    REST API for Dify applications and knowledge bases. Application endpoints
    authenticate with an app API key; knowledge endpoints authenticate with a
    dataset API key.
  title: Dify Service API
  version: 1.0.0
servers:
  - description: >-
      Base URL of the Dify Service API. For self-hosted deployments, replace it
      with your own API base URL.
    url: https://{api_base_url}
    variables:
      api_base_url:
        default: api.dify.ai/v1
        description: Host and path of the API base URL, without the `https://` prefix.
security:
  - ApiKeyAuth: []
tags:
  - description: Operations related to chat messages and interactions.
    name: Chat Messages
  - description: File upload and preview operations.
    name: Files
  - description: Operations related to end user information.
    name: End Users
  - description: User feedback operations.
    name: Feedback
  - description: Operations related to managing conversations.
    name: Conversations
  - description: Text-to-Speech and Speech-to-Text operations.
    name: Audio
  - description: Operations to retrieve application settings and information.
    name: Applications
  - description: Operations related to managing annotations for direct replies.
    name: Annotations
  - description: Endpoints for resuming paused workflows that require human input.
    name: Human Input
  - description: Operations for executing and managing workflows.
    name: Workflow Runs
  - description: Operations related to text generation and completion.
    name: Completion Messages
  - description: >-
      Operations for managing knowledge bases, including creation,
      configuration, and retrieval.
    name: Knowledge Bases
  - description: >-
      Operations for creating, updating, and managing documents within a
      knowledge base.
    name: Documents
  - description: Operations for managing document chunks and child chunks.
    name: Chunks
  - description: >-
      Operations for managing knowledge base metadata fields and document
      metadata values.
    name: Metadata
  - description: Operations for managing knowledge base tags and tag bindings.
    name: Tags
  - description: Operations for retrieving available models.
    name: Models
  - description: >-
      Operations for managing and running knowledge pipelines, including
      datasource plugins and pipeline execution.
    name: Knowledge Pipeline
  - description: Ask a knowledge base a question and stream the answer.
    name: Queries
  - description: Inspect what a query retrieved and why.
    name: Query Records
  - description: Run a research question in the background and collect its results.
    name: Research Tasks
  - description: >-
      Read the documents in a knowledge base, their files, revisions, and
      chunks; label documents with metadata.
    name: Documents and Chunks
  - description: >-
      Follow, cancel, or retry indexing, and list the knowledge base's
      background tasks.
    name: Indexing Tasks
  - description: >-
      Follow the deletion of a document file, a batch of files, or a source
      until it finishes.
    name: Deletion Jobs
  - description: >-
      Manage the sources that feed a knowledge base, their sync schedules, and
      their connections.
    name: Sources
  - description: >-
      Sync a source now, import website pages or provider items, and follow,
      cancel, or retry the runs.
    name: Source Syncs and Imports
  - description: >-
      Read and change the knowledge base's models and retrieval settings, and
      follow the migration a change starts.
    name: Settings
paths:
  /knowledge-fs/spaces/{knowledge_base_id}/settings:
    get:
      tags:
        - Settings
      summary: Get Knowledge Base Settings
      description: >-
        Returns the knowledge base's embedding model, retrieval settings,
        readiness, and the `revision` to send in [Update Knowledge Base
        Settings](/en/api-reference/settings/update-knowledge-base-settings).


        For when models can be set over the API, see [Change Models or Retrieval
        Settings](/en/api-reference/guides/knowledge-base#change-models-or-retrieval-settings).
      operationId: getKnowledgeBaseSettings
      parameters:
        - description: >-
            Knowledge base ID: the last segment of the Service API endpoint
            shown in the knowledge base's **API Access** dialog
            (`…/knowledge-fs/spaces/<knowledge base ID>`), and the segment after
            `/datasets/new/` in the address bar.
          in: path
          name: knowledge_base_id
          required: true
          schema:
            format: uuid
            type: string
      responses:
        '200':
          content:
            application/json:
              examples:
                setup_required:
                  summary: Response Example - Setup required
                  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: Response Example - Models live
                  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: The knowledge base's settings.
        '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`: the `Authorization` header is missing, or the key
            is unknown or not a knowledge base API key.

            - `knowledge_fs_invalid_credential`: the key is valid, but no
            knowledge base with this ID exists in the key's workspace, or the
            key is not tied to a workspace.
        '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`: the key is scoped to other knowledge
            bases, **API access** is off for this knowledge base, or the
            knowledge base is not active.

            - `forbidden`: on Dify Cloud, the workspace has reached the
            knowledge base request rate limit of its subscription. Every call
            counts, reads included.
        '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`: the knowledge base ID isn't
            recognized.

            - `not_found`: the Agent Knowledge Base feature is turned off on
            this deployment.
        '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`: no answer came back in time,
            or the answer couldn't be read. Retry after a pause.
        '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`: the Agent Knowledge Base
            feature is not set up for this workspace, this operation is not
            available on the deployment, or the key's access to this knowledge
            base changed while the request was being authorized. Try again.

            - `knowledge_fs_operation_unavailable`: the request can't be served
            right now. Follow `failure.retryPolicy`.
components:
  schemas:
    KnowledgeBaseSettings:
      properties:
        active_profile_available:
          description: >-
            `true` when both an embedding model and retrieval settings are live,
            which happens after the first document is indexed.
          type: boolean
        active_profile_revisions:
          description: >-
            Revisions of the live models. Each is `null` until the first
            document is indexed. Once a profile is active, a change through
            [Update Knowledge Base
            Settings](/en/api-reference/settings/update-knowledge-base-settings)
            runs as a migration.
          properties:
            embedding:
              description: Revision of the live embedding model.
              nullable: true
              type: integer
            retrieval:
              description: Revision of the live retrieval settings.
              nullable: true
              type: integer
          type: object
        capabilities:
          description: >-
            Readiness of the published settings. Three flags stand for retrieval
            depths, with `query` standing for `fast`.


            To check readiness for a specific depth, send that depth explicitly
            as `mode` and check its flag. Do not use a pending
            `retrieval.default_mode` to identify the depth of a query that omits
            `mode`.
          properties:
            deep:
              description: Queries at `deep` depth can run.
              type: boolean
            index:
              description: Documents can be indexed. The models are live.
              type: boolean
            ingest:
              description: >-
                Documents can be added. The models are live, or complete pending
                settings are ready to be activated by the first document.
              type: boolean
            query:
              description: Queries at `fast` depth can run.
              type: boolean
            research:
              description: Queries at `research` depth can run.
              type: boolean
            source_sync:
              description: Sources can sync. Same condition as `ingest`.
              type: boolean
          type: object
        configuration_state:
          description: >-
            `active` when an embedding model and complete retrieval settings
            (with an enabled rerank model) are stored. `setup-required` when
            either is missing. `validation-failed` when the pending settings
            failed validation while the first document was indexed. `issues`
            names the settings that failed.
          type: string
        embedding:
          description: >-
            Embedding model. The pending selection when one is stored, otherwise
            the live model. A pending selection can differ from the model
            queries use now. `null` when none is set.


            Its `dimension`, `revision`, and `vector_space_id` are
            informational, and no operation takes them.
          nullable: true
          properties:
            dimension:
              description: >-
                Vector dimension, observed when the model is first used. `null`
                until the model is live.
              nullable: true
              type: integer
            model:
              description: Model name.
              type: string
            plugin_id:
              description: Plugin that provides the model, as `organization/plugin_name`.
              type: string
            provider:
              description: Provider name inside the plugin.
              type: string
            revision:
              description: >-
                Revision of the live embedding model. `null` until the model is
                live.
              nullable: true
              type: integer
            vector_space_id:
              description: >-
                Identifies where the model's vectors are stored. `null` until
                the model is live.
              nullable: true
              type: string
          type: object
        issues:
          description: >-
            What keeps the knowledge base from being ready. Empty when nothing
            does.
          items:
            properties:
              code:
                description: >-
                  What is wrong with the setting:


                  - `missing`: the selection is absent, or rerank is disabled.

                  - `validation_failed`, `unavailable`, or `incompatible`: the
                  pending settings failed validation. For `incompatible`, check
                  the model's supported task, embedding dimension, and whether
                  the provider returned the selected model.

                  - `binding_missing`: the published content is not ready to use
                  the configured models. Check indexing progress in Dify.

                  - `unavailable` on `publication`: the published content is not
                  ready for every depth.
                type: string
              field:
                description: >-
                  The setting concerned: `embedding`, `reasoning`, `rerank`, or
                  `publication` (the published content).
                type: string
              retryable:
                description: >-
                  Whether waiting and retrying can clear the issue without a
                  settings change.
                type: boolean
            type: object
          type: array
        retrieval:
          description: >-
            Retrieval settings. The pending selection when one is stored,
            otherwise the live settings. A pending selection can differ from the
            settings queries use now. `null` when none is set.
          nullable: true
          properties:
            default_mode:
              description: >-
                Default depth in the returned retrieval settings: `fast`,
                `deep`, or `research`. When a query omits `mode`, it uses the
                published default, which can differ from this value if pending
                settings are returned.
              type: string
            reasoning_model:
              description: >-
                System reasoning model. Its `dimension`, `revision`, and
                `vector_space_id` are always `null`.
              properties:
                dimension:
                  description: Always `null`.
                  nullable: true
                  type: integer
                model:
                  description: Model name.
                  type: string
                plugin_id:
                  description: >-
                    Plugin that provides the model, as
                    `organization/plugin_name`.
                  type: string
                provider:
                  description: Provider name inside the plugin.
                  type: string
                revision:
                  description: Always `null`.
                  nullable: true
                  type: integer
                vector_space_id:
                  description: Always `null`.
                  nullable: true
                  type: string
              type: object
            rerank:
              description: >-
                Rerank model. Its `model` object uses the camelCase key
                `pluginId`, unlike the rest of this response.
              properties:
                enabled:
                  description: Whether retrieved chunks are reranked.
                  type: boolean
                model:
                  description: Rerank model selection. `null` when no rerank model is set.
                  nullable: true
                  properties:
                    model:
                      description: Model name.
                      type: string
                    pluginId:
                      description: >-
                        Plugin that provides the model, as
                        `organization/plugin_name`.
                      type: string
                    provider:
                      description: Provider name inside the plugin.
                      type: string
                  type: object
              type: object
            revision:
              description: >-
                Revision of the live retrieval settings. `null` while the
                settings are pending.
              nullable: true
              type: integer
            score_threshold:
              description: Score cutoff that drops low-scoring chunks.
              properties:
                enabled:
                  description: Whether the cutoff applies.
                  type: boolean
                stage:
                  description: >-
                    Where the cutoff applies. `mode-final` applies it to the
                    final score of the depth that runs: the rerank score at
                    `fast` and `deep`, the PageIndex score at `research`.
                    `rerank` is the same thing under its old name.
                  type: string
                value:
                  description: The cutoff score, 0 to 1. `null` when not set.
                  nullable: true
                  type: number
              type: object
            top_k:
              description: Maximum number of chunks each search returns.
              type: integer
          type: object
        revision:
          description: >-
            Settings revision. Send it as `expectedRevision` in [Update
            Knowledge Base
            Settings](/en/api-reference/settings/update-knowledge-base-settings).
            The other revision fields in this response are not that value.
          type: integer
      type: object
  securitySchemes:
    ApiKeyAuth:
      bearerFormat: API_KEY
      description: >-
        Every request authenticates with an API key: `Authorization: Bearer
        {API_KEY}`. App endpoints take an app API key; knowledge endpoints take
        a knowledge base API key ([Get
        Started](/en/api-reference/guides/get-started)).


        Keep keys server-side; never embed them in client code. Requests with a
        missing or invalid key fail with HTTP `401` (`unauthorized`).
      scheme: bearer
      type: http

````

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