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

# Update knowledge base

> Updates a knowledge base by adding new sources and/or modifying its name. Supported file types include PDF, TXT, HTML, Markdown, and DOCX. Maximum file size is 25 MB.



## OpenAPI

````yaml patch /v1/knowledge-bases/{kbId}
openapi: 3.0.1
info:
  title: SigmaMind APIs
  description: OpenAPI documentation SigmaMind Agent Builder APIs
  version: '1.0'
servers:
  - url: https://api.sigmamind.ai
    description: SigmaMind AI Agent Builder APIs
security:
  - apiKeyAuth: []
tags:
  - name: Chats
    description: >-
      Endpoints for creating and managing text-based chat sessions with an
      agent. A session is started by specifying an agent and an opening message.
      Returns a chatId used in all subsequent get, update, completion, and
      end-session calls.
  - name: Calls
    description: >-
      Endpoints for creating and managing outbound phone calls. A call is
      initiated by specifying an agent, caller number, and destination number —
      dynamic variables can be included to personalise the agent's behaviour.
      Returns a callId used in all subsequent get and delete operations.
  - name: Phone Numbers
    description: >-
      Endpoints for managing phone numbers used in outbound and inbound calls.
      Supports purchasing a new number through SigmaMind or importing an
      existing number via SIP trunking (BYO). Each number can be assigned
      separate inbound and outbound agents.
  - name: Campaigns
    description: >-
      Endpoints for creating and managing outbound call campaigns. A campaign
      dials a CSV-uploaded contact list using a selected agent and caller
      number, with support for immediate or scheduled launch. Returns a
      campaignId used in all subsequent get, update, and delete operations.
  - name: Agents
    description: >-
      Endpoints for creating and managing single prompt agents. An agent is
      configured with a system prompt, voice settings, and optional tools.
      Returns an agentId used in all subsequent update, call, and simulation
      operations.
  - name: Integrations
    description: >-
      Endpoints for creating and managing third-party integrations (e.g.
      Shopify, Cal.com). An integration links your account to an external
      service and acts as the parent resource for auth credentials and API
      tools. Returns an integrationId used in all subsequent auth and tool
      operations.
  - name: Integration Auth
    description: >-
      Endpoints for managing authentication credentials for a third-party
      integration. Supports API Key, Basic, and Bearer token credential types —
      scoped to an integration and injected automatically by tools when
      executing. Returns an authId used in all subsequent get, update, and
      delete operations.
  - name: Integration Tools
    description: >-
      Endpoints for creating and managing API tools backed by a third-party
      integration. Each tool defines an HTTP endpoint, method, and parameter
      schema — scoped to an integration and using its stored auth credentials
      when executing. Returns a toolId used in all subsequent get, update,
      delete, and execute operations.
  - name: Webhooks
    description: >-
      Endpoints for registering and managing webhooks. A webhook delivers
      real-time event notifications via HTTP POST when selected events occur on
      a specific agent — each webhook is scoped to one agent and one or more
      event types. Payloads are signed with an HMAC secret — verify the
      signature on your server to confirm authenticity.
  - name: Test Cases
    description: >-
      Endpoints for creating and managing simulation test cases for an agent. A
      test case defines a conversation scenario — including user persona, goals,
      and expected behaviour — used to generate a synthetic conversation with
      the agent. Returns a testCaseId used in all subsequent get, update,
      delete, and batch-run operations.
  - name: Batch Runs
    description: >-
      Endpoints for creating and managing batch runs of simulation test cases. A
      batch run executes multiple test cases in parallel against a selected
      agent and aggregates the results for review. Returns a batchId used in all
      subsequent get and list test-run operations.
  - name: Test Runs
    description: >-
      Endpoints for retrieving test run results within a batch. Each test run
      represents a single test case execution within a batch run, identified by
      a jobId. Use batchId and agentId to scope results to the correct batch.
  - name: API Keys
    description: >-
      Endpoints for creating and managing API keys used to authenticate public
      API requests. Each key must be included in the X-API-Key request header.
      Returns a keyId used in all subsequent get, revoke, and delete operations.
  - name: QA Rules
    description: >-
      Endpoints for creating and managing quality assurance rules applied to
      agent conversations. A QA rule defines evaluation criteria used to
      automatically assess conversation quality. Returns a qaRuleId used in all
      subsequent get, update,  and delete operations.
  - name: QA Issues
    description: >-
      Endpoints for retrieving and managing quality assurance issues flagged
      across agent conversations. A QA issue is created with status 'Fail' when
      a conversation violates one or more QA rules — capturing the offending
      rule reference. It is created with status 'Success' when the conversation
      passes the evaluation criteria of QA rule(s). Returns a qaIssueId used in
      all subsequent get operations.
paths:
  /v1/knowledge-bases/{kbId}:
    patch:
      tags:
        - Knowledge bases
      summary: Update knowledge base
      description: >-
        Updates a knowledge base by adding new sources and/or modifying its
        name. Supported file types include PDF, TXT, HTML, Markdown, and DOCX.
        Maximum file size is 25 MB.
      operationId: updateMultipart
      parameters:
        - name: kbId
          in: path
          description: Knowledge base id to change.
          required: true
          schema:
            type: string
          example: kb_6sbr3tbMX757M0VD
        - name: knowledge_base_name
          in: query
          description: New name, if you want to rename. Names do not need to be unique.
          required: false
          schema:
            type: string
          example: Sample KB v2
        - name: knowledge_base_texts
          in: query
          description: >-
            Optional new text sources. Send as one form field whose value is a
            JSON array string. Example:
            `knowledge_base_texts=["Hello",{"title":"Q","text":"A"}]`.
          required: false
          schema:
            type: string
          example:
            - Updated note
        - name: knowledge_base_urls
          in: query
          description: >-
            Optional new URL sources. Send as one form field whose value is a
            JSON array of URL strings (not native repeated fields). Example:
            `knowledge_base_urls=["https://example.com/docs"]`.
          required: false
          schema:
            type: string
          example:
            - https://example.com/new
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                knowledge_base_files:
                  type: array
                  description: >-
                    Optional files, field may be repeated. Allowed file types:
                    PDF, TXT, HTML, Markdown, DOCX. Max file size - 25 MB
                  items:
                    type: string
                    format: binary
      responses:
        '200':
          description: Updated knowledge base.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/KnowledgeBaseResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                default:
                  value:
                    error: Bad Request
                    message: Invalid request parameters
                    path: /v1/knowledge-bases
                    status: 400
                    timestamp: '2026-05-14T14:27:22.199Z'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                default:
                  value:
                    error: Unauthorized
                    message: X-API-Key is missing or invalid
                    path: /v1/knowledge-bases
                    status: 401
                    timestamp: '2026-05-14T14:27:22.199Z'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                default:
                  value:
                    error: Forbidden
                    message: Access denied for this resource
                    path: /v1/knowledge-bases
                    status: 403
                    timestamp: '2026-05-14T14:27:22.199Z'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                default:
                  value:
                    error: Not Found
                    message: The requested resource was not found
                    path: /v1/knowledge-bases
                    status: 404
                    timestamp: '2026-05-14T14:27:22.199Z'
        '413':
          description: Payload Too Large
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                default:
                  value:
                    error: Payload Too Large
                    message: An uploaded file exceeds the per-file size limit (25 MB).
                    path: /v1/knowledge-bases
                    status: 413
                    timestamp: '2026-05-14T14:27:22.199Z'
        '415':
          description: Unsupported Media Type
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                default:
                  value:
                    error: Unsupported Media Type
                    message: >-
                      Uploaded file type is not supported. Allowed: PDF, TXT,
                      HTML, Markdown, DOCX.
                    path: /v1/knowledge-bases
                    status: 415
                    timestamp: '2026-05-14T14:27:22.199Z'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                default:
                  value:
                    error: Internal Server Error
                    message: Something went wrong on the server
                    path: /v1/knowledge-bases
                    status: 500
                    timestamp: '2026-05-14T14:27:22.199Z'
components:
  schemas:
    KnowledgeBaseResponse:
      required:
        - createdAt
        - files
        - kbId
        - name
        - updatedAt
      type: object
      properties:
        kbId:
          maxLength: 64
          minLength: 1
          type: string
          description: >-
            Use this id in the URL when fetching, updating, or deleting this
            knowledge base.
          example: kb_6sbr3tbMX757M0VD
        name:
          maxLength: 512
          type: string
          description: Knowledge base name
          example: Support FAQs
        files:
          type: array
          description: Ordered sources; each item has documentId, type, and content.
          items:
            $ref: '#/components/schemas/KnowledgeBaseFileResponse'
        createdAt:
          type: string
          description: When the knowledge base was created.
          format: date-time
          example: '2026-05-06T11:15:02.073Z'
        updatedAt:
          type: string
          description: When the knowledge base or its sources were last changed.
          format: date-time
          example: '2026-05-06T11:15:02.073Z'
      description: A knowledge base and its sources.
    Error:
      type: object
      properties:
        timestamp:
          type: string
          description: Error timestamp in ISO format
          format: date-time
        status:
          type: integer
          description: HTTP status code
          example: 400
        error:
          type: string
          description: Error type or HTTP status message
          example: Bad Request
        message:
          type: string
          description: Detailed error message
          example: Email is required
        path:
          type: string
          description: Request path where error occurred
          example: /v1/users
        validationErrors:
          type: object
          description: Field validation errors (if any)
          example: |-
            {
              "email": "Email is required",
              "name": "Name is too short"
            }
      description: Standard error response
    KnowledgeBaseFileResponse:
      required:
        - content
        - documentId
        - type
      type: object
      properties:
        documentId:
          maxLength: 128
          minLength: 1
          pattern: ^[a-zA-Z0-9_-]{1,128}$
          type: string
          description: >-
            Stable id for this source; use when updating or deleting a single
            document.
          example: doc_a1b2c3d4e5f67890
        type:
          type: string
          description: Source row kind. In JSON request and response bodies.
          example: url
          enum:
            - file
            - url
            - text
        content:
          type: string
          description: Stored link, path, or text for this source.
          example: https://docs.example.com/guide
      description: One source inside a knowledge base.
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      description: >-
        Authenticate every request by passing your API key in the `X-API-Key`
        header. To get your key, go to Dashboard → API Keys and create or copy
        your Production API key.
      name: X-API-Key
      in: header

````