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

# Update knowledge base

> Rename or re-describe a knowledge base collection (the KB entity/collection API; the plural `/knowledge-bases` path). Admins only (`knowledge_base:write`). Only the supplied fields change; sending `description: ""` clears the description while omitting a key leaves it unchanged. Scope `knowledge_base:write`.



## OpenAPI

````yaml /api-reference/openapi.json patch /knowledge-bases/{knowledge_base_id}
openapi: 3.1.0
info:
  title: Lehar API
  version: v0
  description: >-
    Customer-facing REST API for the Lehar voice-AI platform. Platform-admin
    endpoints are intentionally excluded from this reference. Regenerate with
    `npm run sync:openapi`.
servers:
  - url: https://api.lehar.ai/ca/api/v0
security:
  - ApiKeyAuth: []
  - BearerAuth: []
paths:
  /knowledge-bases/{knowledge_base_id}:
    patch:
      tags:
        - Knowledge Base
      summary: Update knowledge base
      description: >-
        Rename or re-describe a knowledge base collection (the KB
        entity/collection API; the plural `/knowledge-bases` path). Admins only
        (`knowledge_base:write`). Only the supplied fields change; sending
        `description: ""` clears the description while omitting a key leaves it
        unchanged. Scope `knowledge_base:write`.
      operationId: >-
        update_knowledge_base_ca_api_v0_knowledge_bases__knowledge_base_id__patch
      parameters:
        - name: knowledge_base_id
          in: path
          required: true
          description: Id of the knowledge base collection to update.
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  maxLength: 200
                  description: >-
                    New display name. When present it must be a non-empty string
                    of at most 200 characters.
                description:
                  type: string
                  maxLength: 2000
                  description: >-
                    New description; an empty string clears it. Omit the key to
                    leave the description unchanged.
            example:
              name: Support FAQ (v2)
              description: Updated answers for common customer questions
      responses:
        '200':
          description: >-
            Updated knowledge base. `document_count` is null on this response
            (not recomputed).
          content:
            application/json:
              example:
                id: kb_01jq8x9m2h4z7c0r5v3b8t6n1e
                name: Support FAQ (v2)
                description: Updated answers for common customer questions
                created_by_user_id: usr_01jq8x9m2h4z7c0r5v3b8t6n1e
                document_count: null
                created_at: '2026-09-02T10:15:00Z'
                updated_at: '2026-09-02T11:02:00Z'
        '400':
          description: >-
            customer_id is missing, the body is not a JSON object, or
            name/description fail validation (empty name, name over 200 chars,
            description over 2000 chars).
          content:
            application/json:
              example:
                error:
                  code: invalid_request
                  message: name must be a non-empty string
        '401':
          description: No valid authentication was supplied.
          content:
            application/json:
              example:
                error:
                  code: unauthorized
                  message: Authentication required
        '403':
          description: The caller lacks `knowledge_base:write` (admin-tier).
          content:
            application/json:
              example:
                error:
                  code: forbidden
                  message: Scope 'knowledge_base:write' is required
        '404':
          description: No knowledge base with that id exists in the caller's workspace.
          content:
            application/json:
              example:
                error:
                  code: not_found
                  message: Knowledge base not found
        '409':
          description: Renaming would collide with an existing knowledge base name.
          content:
            application/json:
              example:
                error:
                  code: conflict
                  message: A knowledge base named 'Support FAQ (v2)' already exists
        '500':
          description: Unexpected server error.
          content:
            application/json:
              example:
                error:
                  code: internal_error
                  message: An unexpected error occurred
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY
    BearerAuth:
      type: http
      scheme: bearer

````