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

# Update a knowledge base chat

> Partially updates a knowledge base chat. Only the provided fields are updated; omitted fields remain unchanged. The model name field is not accepted.



## OpenAPI

````yaml /api-reference/openapi.json patch /KnowledgeBaseChat/{chatId}
openapi: 3.0.1
info:
  title: Starleads public API documentation
  description: >
    Welcome to the Starleads Public API documentation. This API provides public
    access to Starleads services, allowing developers and growth-hackers to
    interact with campaign-related data.

    ***

    ### Base endpoint

    ```https://api.starleads.co```

    ***

    ### Errors

    The API uses standard HTTP status codes to indicate the success or failure
    of the API call. In case of failure, the body of the response will be JSON
    in the following format:

    ```

    {
      "type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",
      "title": "Bad Request",
      "status": 400,
      "detail": "No campaign exists with campaignId : 11111111"
    }

    ```

    The ```type``` property is a link to a general description of the error
    type.

    ***

    ### Authentification

    Authentication for the API is handled with an API key that must be provided
    as a ```X-Api-Key``` header for every request.<br>

    **API keys are supposed to be a secret that only the client and server know.
    Please remember to not share them with anyone.**<br>

    You can find your API keys when authenticated in your Starleads profile
    :<br> ![Api key menu option](../images/api-menu-option-screenshot.png)
  version: v1
  x-logo:
    url: https://api.starleads.co/images/starleads-logo.png
servers: []
security: []
tags:
  - name: Agent
    description: >-
      Manage your AI agent's prompt and knowledge base chat connection. These
      endpoints allow you to read and update the prompt that drives your agent's
      behavior, and connect or detach a knowledge base chat.
  - name: Campaign
    description: >-
      Manage campaigns. A campaign orchestrates outbound calls or web
      interactions using an AI agent. Campaigns are created inactive and can be
      activated separately.
  - name: CampaignField
    description: >-
      CampaignFields enables users to specify customizable fields within their
      campaigns. These fields serve as placeholders (e.g., ```{lastname}```)
      that can be dynamically filled with corresponding data when creating
      prompts, providing flexibility in tailoring campaign content based on
      specific variables.<br>**Those are the keys of the ```databag``` field of
      the request payload to add a new ```CampaignItem``` to a campaign.**
  - name: CampaignItem
    description: Represents prospects entries related to a campaign
  - name: Dataset
    description: >-
      Manage datasets for the RAG (Retrieval-Augmented Generation) knowledge
      base. Datasets are containers for documents that are parsed and used for
      knowledge retrieval by AI agents.
  - name: Document
    description: >-
      Manage documents within datasets. Upload, list, update, download, and
      delete documents. Trigger and stop document parsing to extract knowledge
      from uploaded files.
  - name: KnowledgeBaseChat
    description: >-
      Manage knowledge base chats. A chat connects one or more datasets to
      provide RAG-powered question answering. Chats can be connected to agents
      to enhance their capabilities with knowledge retrieval.
  - name: KnowledgeGraph
    description: >-
      Manage knowledge graphs on datasets. Enable, build, query, and delete
      knowledge graphs to extract structured entity relationships from dataset
      documents. Available on the Business plan.
paths:
  /KnowledgeBaseChat/{chatId}:
    patch:
      tags:
        - KnowledgeBaseChat
      summary: Update a knowledge base chat
      description: >-
        Partially updates a knowledge base chat. Only the provided fields are
        updated; omitted fields remain unchanged. The model name field is not
        accepted.
      operationId: UpdateKnowledgeBaseChat
      parameters:
        - name: X-Api-Key
          in: header
          description: Api key to pass as a `X-Api-Key` request header.
          required: true
          schema:
            type: string
        - name: chatId
          in: path
          description: ID of the knowledge base chat.
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PatchChatRequest'
            example:
              name: Updated KB
              datasetIds:
                - ds_abc123
                - ds_def456
              llmSettings:
                temperature: 0.5
      responses:
        '200':
          description: Chat updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicChat'
        '400':
          description: Bad Request — validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '401':
          description: Unauthorized — invalid or missing API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '404':
          description: Not Found — chat not found or belongs to another company
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '502':
          description: Bad Gateway — service or RAGFlow communication error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
components:
  schemas:
    PatchChatRequest:
      type: object
      description: Partial update for a chat. Only provided fields will be updated
      properties:
        name:
          type: string
          description: 'Chat name (if provided: 1-255 chars)'
          nullable: true
        datasetIds:
          type: array
          items:
            type: string
          description: Dataset IDs to connect
          nullable: true
        llmSettings:
          $ref: '#/components/schemas/PublicLlmSettings'
        promptSettings:
          $ref: '#/components/schemas/PromptSettings'
      additionalProperties: false
    PublicChat:
      type: object
      description: Public representation of a knowledge base chat
      properties:
        id:
          type: string
          description: Chat identifier
        name:
          type: string
          description: Chat name
        datasetIds:
          type: array
          items:
            type: string
          description: Connected dataset IDs
          nullable: true
        datasetNames:
          type: array
          items:
            type: string
          description: Connected dataset names (read-only)
          nullable: true
        connectedAgentCount:
          type: integer
          format: int32
          description: Number of agents using this chat
          nullable: true
        llmSettings:
          $ref: '#/components/schemas/PublicLlmSettings'
        promptSettings:
          $ref: '#/components/schemas/PromptSettings'
        createdAt:
          type: string
          format: date-time
          description: Creation timestamp
        updatedAt:
          type: string
          format: date-time
          description: Last update timestamp
          nullable: true
      additionalProperties: false
    ProblemDetails:
      type: object
      properties:
        type:
          type: string
          nullable: true
        title:
          type: string
          nullable: true
        status:
          type: integer
          format: int32
          nullable: true
        detail:
          type: string
          nullable: true
        instance:
          type: string
          nullable: true
      additionalProperties: {}
    PublicLlmSettings:
      type: object
      description: LLM configuration parameters exposed to the API (excludes model name)
      properties:
        temperature:
          type: number
          format: float
          description: Sampling temperature
          nullable: true
        topP:
          type: number
          format: float
          description: Top-p sampling parameter
          nullable: true
        presencePenalty:
          type: number
          format: float
          description: Presence penalty
          nullable: true
        frequencyPenalty:
          type: number
          format: float
          description: Frequency penalty
          nullable: true
      additionalProperties: false
    PromptSettings:
      type: object
      description: RAG prompt configuration
      properties:
        similarityThreshold:
          type: number
          format: float
          description: Minimum similarity score
          nullable: true
        keywordsSimilarityWeight:
          type: number
          format: float
          description: Weight for keyword similarity
          nullable: true
        topN:
          type: integer
          format: int32
          description: Number of top results
          nullable: true
        prompt:
          type: string
          description: System prompt template
          nullable: true
        opener:
          type: string
          description: Conversation opener
          nullable: true
        emptyResponse:
          type: string
          description: Response when no results found
          nullable: true
        showQuote:
          type: boolean
          description: Whether to show source quotes
          nullable: true
        rerankModel:
          type: string
          description: Reranking model identifier
          nullable: true
      additionalProperties: false

````