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

# Update mutable fields on a knowledge base

> Update mutable fields on a knowledge base.

Only ``name`` and ``description`` can be updated.  The embedding
model configuration is pinned at creation time and cannot be
changed.

Args:
    body (`UpdateKnowledgeBaseRequest`):
        The fields to update; omitted fields stay unchanged.
    knowledge_base_id (`str`):
        The knowledge base to update.
    user_id (`str`):
        Injected authenticated user ID.
    service (`KnowledgeBaseService`):
        Injected knowledge base service.

Returns:
    `KnowledgeBaseView`:
        The knowledge base record after the update.



## OpenAPI

````yaml /versions/2.0.4dev/en/deploy/openapi.json patch /knowledge_bases/{knowledge_base_id}
openapi: 3.1.0
info:
  title: AgentScope
  version: 2.0.3
servers: []
security: []
paths:
  /knowledge_bases/{knowledge_base_id}:
    patch:
      tags:
        - knowledge_bases
      summary: Update mutable fields on a knowledge base
      description: |-
        Update mutable fields on a knowledge base.

        Only ``name`` and ``description`` can be updated.  The embedding
        model configuration is pinned at creation time and cannot be
        changed.

        Args:
            body (`UpdateKnowledgeBaseRequest`):
                The fields to update; omitted fields stay unchanged.
            knowledge_base_id (`str`):
                The knowledge base to update.
            user_id (`str`):
                Injected authenticated user ID.
            service (`KnowledgeBaseService`):
                Injected knowledge base service.

        Returns:
            `KnowledgeBaseView`:
                The knowledge base record after the update.
      operationId: update_knowledge_base_knowledge_bases__knowledge_base_id__patch
      parameters:
        - name: knowledge_base_id
          in: path
          required: true
          schema:
            type: string
            description: The knowledge base id.
            title: Knowledge Base Id
          description: The knowledge base id.
        - name: x-user-id
          in: header
          required: true
          schema:
            type: string
            description: >-
              Caller's user ID. Temporary header-based identity; will be
              replaced by JWT auth.
            title: X-User-Id
          description: >-
            Caller's user ID. Temporary header-based identity; will be replaced
            by JWT auth.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateKnowledgeBaseRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/KnowledgeBaseView'
        '404':
          description: Not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    UpdateKnowledgeBaseRequest:
      properties:
        name:
          anyOf:
            - type: string
            - type: 'null'
          title: Name
          description: New display name; omit to leave unchanged.
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
          description: New free-form description; omit to leave unchanged.
      type: object
      title: UpdateKnowledgeBaseRequest
      description: |-
        Request body for updating a knowledge base.

        Only mutable fields can be set here.  The embedding model
        configuration is pinned at creation time and cannot be changed —
        switching it would invalidate every previously inserted vector.
    KnowledgeBaseView:
      properties:
        id:
          type: string
          title: Id
          description: The knowledge base identifier.
        name:
          type: string
          title: Name
          description: Display name of the knowledge base.
        description:
          type: string
          title: Description
          description: Free-form description.
        embedding_model_config:
          $ref: '#/components/schemas/EmbeddingModelConfig'
          description: Embedding model configuration pinned at creation.
        created_at:
          type: string
          format: date-time
          title: Created At
          description: Creation timestamp.
        updated_at:
          type: string
          format: date-time
          title: Updated At
          description: Last-update timestamp.
      type: object
      required:
        - id
        - name
        - description
        - embedding_model_config
        - created_at
        - updated_at
      title: KnowledgeBaseView
      description: |-
        A knowledge base record as exposed to API clients.

        Mirrors :class:`KnowledgeBaseRecord` with the internal
        ``user_id`` / ``collection_name`` fields stripped — clients have
        no business introspecting either.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    EmbeddingModelConfig:
      properties:
        type:
          type: string
          title: Type
        credential_id:
          type: string
          title: Credential Id
        model:
          type: string
          title: Model
        dimensions:
          type: integer
          exclusiveMinimum: 0
          title: Dimensions
        parameters:
          additionalProperties: true
          type: object
          title: Parameters
      type: object
      required:
        - type
        - credential_id
        - model
        - dimensions
      title: EmbeddingModelConfig
      description: |-
        Configuration for constructing an embedding model from a credential.

        Mirrors :class:`ChatModelConfig` but targets
        :class:`~agentscope.embedding.EmbeddingModelBase` subclasses.
        Used by :class:`KnowledgeBaseRecord` to persist the user's
        embedding model selection.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````