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

# Update knowledge base

> Rename a knowledge base and add, edit or remove its sources in one call.

Steps run in this order: name and description, sources added, sources edited, snapshots restored, connected service updates accepted, sources removed.
If a step fails, earlier steps stay applied and the error lists them under `applied`. This operation can change workspace data or trigger an external side effect; review the request before sending it and do not retry blindly after a timeout.



## OpenAPI

````yaml /openapi.json patch /api/v1/public/knowledge-bases/{kb_id}
openapi: 3.1.0
info:
  description: >-
    Customer-facing API for managing outreach, leads, conversations, voice
    agents, knowledge bases, analytics, and webhooks.
  title: Sendora Public API
  version: 1.0.0
servers:
  - description: Production
    url: https://api.sendora.ai
security: []
tags:
  - description: Leads, lead lists, importing, enriching and finding new prospects.
    name: Leads
  - description: Build, run and measure outreach, and enroll leads.
    name: Campaigns
  - description: Read and send messages, and manage who must not be contacted.
    name: Conversations
  - description: >-
      Voice and chat agents, their tools, knowledge bases, voices and website
      widgets.
    name: Agents
  - description: >-
      Start calls, and manage phone numbers, SMS registration, sending accounts
      and email domains.
    name: Calls and numbers
  - description: Webhooks, jobs, analytics and the Copilot assistant.
    name: Platform
  - description: Manage client workspaces, plans and branding.
    name: Agency
paths:
  /api/v1/public/knowledge-bases/{kb_id}:
    patch:
      tags:
        - Agents
      summary: Update knowledge base
      description: >-
        Rename a knowledge base and add, edit or remove its sources in one call.


        Steps run in this order: name and description, sources added, sources
        edited, snapshots restored, connected service updates accepted, sources
        removed.

        If a step fails, earlier steps stay applied and the error lists them
        under `applied`. This operation can change workspace data or trigger an
        external side effect; review the request before sending it and do not
        retry blindly after a timeout.
      operationId: update_kb_api_v1_public_knowledge_bases__kb_id__patch
      parameters:
        - description: >-
            The knowledge base's id: the `id` from List or get knowledge bases.
            It is also the last part of that page's address in the app.
          in: path
          name: kb_id
          required: true
          schema:
            title: Kb Id
            type: string
        - in: header
          name: X-API-Key
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-Api-Key
        - in: header
          name: Authorization
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Authorization
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/KBPatchBody'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/KBDetail'
          description: Successful Response
        '401':
          description: The X-API-Key header is missing, invalid, expired, or revoked.
        '402':
          description: >-
            The workspace is suspended for billing, or the request would exceed
            a plan or usage limit.
        '403':
          description: >-
            The key is valid but lacks the required scope, or the workspace has
            no active plan, lacks the entitlement, or has this feature turned
            off or view-only.
        '404':
          description: >-
            The resource does not exist or is not owned by the authenticated
            workspace.
        '410':
          description: The workspace behind this key has been deleted.
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: Validation Error
        '500':
          description: >-
            An unexpected Sendora error occurred. Retry only if the operation is
            safe to repeat.
        '503':
          description: >-
            An entitlement or billing check is temporarily unavailable. Retry
            after the Retry-After interval.
      security:
        - ApiKeyAuth: []
      x-codeSamples:
        - label: cURL
          lang: bash
          source: >-
            curl -X PATCH
            'https://api.sendora.ai/api/v1/public/knowledge-bases/YOUR_ID' -H
            "X-API-Key: $SENDORA_API_KEY" -H "Content-Type: application/json" \
              -d '{"name":"example","description":"example","add_sources":[{"type":"text"}]}'
        - label: Python
          lang: python
          source: >-
            import requests


            url = 'https://api.sendora.ai/api/v1/public/knowledge-bases/YOUR_ID'

            headers = {'X-API-Key': '$SENDORA_API_KEY'}

            response = requests.patch(url, headers=headers, json={'name':
            'example', 'description': 'example', 'add_sources': [{'type':
            'text'}]})

            response.raise_for_status()

            print(response.json())
        - label: JavaScript
          lang: javascript
          source: >-
            const response = await
            fetch("https://api.sendora.ai/api/v1/public/knowledge-bases/YOUR_ID",
            {
              method: "PATCH",
              headers: { 'X-API-Key': process.env.SENDORA_API_KEY, 'Content-Type': 'application/json' },
              body: JSON.stringify({"name": "example", "description": "example", "add_sources": [{"type": "text"}]}),
            });

            if (!response.ok) throw new Error(await response.text());

            console.log(await response.json());
        - label: Go
          lang: go
          source: >-
            req, err := http.NewRequest("PATCH",
            "https://api.sendora.ai/api/v1/public/knowledge-bases/YOUR_ID",
            bytes.NewBufferString(`{"name": "example", "description": "example",
            "add_sources": [{"type": "text"}]}`))

            if err != nil { log.Fatal(err) }

            req.Header.Set("X-API-Key", os.Getenv("SENDORA_API_KEY"))

            req.Header.Set("Content-Type", "application/json")

            resp, err := http.DefaultClient.Do(req)

            if err != nil { log.Fatal(err) }

            defer resp.Body.Close()
components:
  schemas:
    KBPatchBody:
      properties:
        accept_provider_updates:
          anyOf:
            - items:
                $ref: '#/components/schemas/SourceVersion'
              maxItems: 50
              type: array
            - type: 'null'
          description: Make each source's synced update its working copy.
          title: Accept connected service Updates
        add_sources:
          anyOf:
            - items:
                $ref: '#/components/schemas/NewSource'
              maxItems: 50
              type: array
            - type: 'null'
          description: Add sources returned by the Sendora API.
          title: Add Sources
        description:
          anyOf:
            - maxLength: 2000
              type: string
            - type: 'null'
          description: Description returned by the Sendora API.
          title: Description
        name:
          anyOf:
            - maxLength: 200
              minLength: 1
              type: string
            - type: 'null'
          description: Name returned by the Sendora API.
          title: Name
        remove_source_ids:
          anyOf:
            - items:
                type: string
              maxItems: 50
              type: array
            - type: 'null'
          description: >-
            The sources to remove: `id` values from the `sources` of List or get
            knowledge bases.
          title: Remove Source Ids
        restore_snapshots:
          anyOf:
            - items:
                $ref: '#/components/schemas/SourceVersion'
              maxItems: 50
              type: array
            - type: 'null'
          description: Put each source's last synced copy back as its working copy.
          title: Restore Snapshots
        update_sources:
          anyOf:
            - items:
                $ref: '#/components/schemas/SourceChange'
              maxItems: 50
              type: array
            - type: 'null'
          description: Update sources returned by the Sendora API.
          title: Update Sources
      required: []
      title: KBPatchBody
      type: object
    KBDetail:
      properties:
        chunk_count:
          default: 0
          description: Chunk count returned by the Sendora API.
          title: Chunk Count
          type: integer
        created_at:
          description: Created at returned by the Sendora API.
          format: date-time
          title: Created At
          type: string
        description:
          anyOf:
            - type: string
            - type: 'null'
          description: Description returned by the Sendora API.
          title: Description
        id:
          description: The knowledge base's id. Pass it to any endpoint that takes `kb_id`.
          title: Id
          type: string
        is_company_default:
          default: false
          description: Is company default returned by the Sendora API.
          title: Is Company Default
          type: boolean
        name:
          description: Name returned by the Sendora API.
          title: Name
          type: string
        source_count:
          default: 0
          description: Source count returned by the Sendora API.
          title: Source Count
          type: integer
        sources:
          description: Sources returned by the Sendora API.
          items:
            $ref: '#/components/schemas/KBSourceOut'
          title: Sources
          type: array
        status:
          default: ready
          description: Status returned by the Sendora API.
          title: Status
          type: string
        updated_at:
          description: Updated at returned by the Sendora API.
          format: date-time
          title: Updated At
          type: string
        used_by_agents:
          default: []
          description: Used by agents returned by the Sendora API.
          items:
            $ref: '#/components/schemas/KBAgentUsage'
          title: Used By Agents
          type: array
      required:
        - id
        - name
        - created_at
        - updated_at
      title: KBDetail
      type: object
    HTTPValidationError:
      properties:
        detail:
          description: Detail returned by the Sendora API.
          items:
            $ref: '#/components/schemas/ValidationError'
          title: Detail
          type: array
      required: []
      title: HTTPValidationError
      type: object
    SourceVersion:
      properties:
        expected_version:
          description: The source's current indexing_version, so a stale step is refused.
          minimum: 0
          title: Expected Version
          type: integer
        source_id:
          description: >-
            The connected import source to read from, for imports that pull from
            a connected source. Leave empty when sending rows inline.
          title: Source Id
          type: string
      required:
        - source_id
        - expected_version
      title: SourceVersion
      type: object
    NewSource:
      properties:
        content:
          anyOf:
            - type: string
            - type: 'null'
          description: 'type text: the text to index.'
          title: Content
        title:
          anyOf:
            - type: string
            - type: 'null'
          description: Label for the source.
          title: Title
        type:
          description: Type returned by the Sendora API.
          enum:
            - text
            - url
          title: Type
          type: string
        url:
          anyOf:
            - type: string
            - type: 'null'
          description: 'type url: the page to crawl.'
          title: Url
      required:
        - type
      title: NewSource
      type: object
    SourceChange:
      properties:
        content:
          description: Content returned by the Sendora API.
          minLength: 1
          title: Content
          type: string
        expected_version:
          description: The version you last read, so two edits cannot overwrite each other.
          minimum: 0
          title: Expected Version
          type: integer
        source_id:
          description: >-
            The connected import source to read from, for imports that pull from
            a connected source. Leave empty when sending rows inline.
          title: Source Id
          type: string
        title:
          anyOf:
            - type: string
            - type: 'null'
          description: Title returned by the Sendora API.
          title: Title
      required:
        - source_id
        - content
        - expected_version
      title: SourceChange
      type: object
    KBSourceOut:
      properties:
        audience:
          default: agents
          description: Audience returned by the Sendora API.
          enum:
            - agents
            - internal
          title: Audience
          type: string
        chunk_count:
          default: 0
          description: Chunk count returned by the Sendora API.
          title: Chunk Count
          type: integer
        content_hash:
          anyOf:
            - type: string
            - type: 'null'
          description: Content hash returned by the Sendora API.
          title: Content Hash
        content_version:
          default: 0
          description: Content version returned by the Sendora API.
          title: Content Version
          type: integer
        created_at:
          description: Created at returned by the Sendora API.
          format: date-time
          title: Created At
          type: string
        duration_seconds:
          anyOf:
            - type: integer
            - type: 'null'
          description: Duration seconds returned by the Sendora API.
          title: Duration Seconds
        error_message:
          anyOf:
            - type: string
            - type: 'null'
          description: Error message returned by the Sendora API.
          title: Error Message
        external_id:
          anyOf:
            - type: string
            - type: 'null'
          description: The item's id in the service it was imported from.
          title: External Id
        external_metadata:
          default: {}
          description: External metadata returned by the Sendora API.
          title: External Metadata
          type: object
        external_url:
          anyOf:
            - type: string
            - type: 'null'
          description: External url returned by the Sendora API.
          title: External Url
        file_size:
          anyOf:
            - type: integer
            - type: 'null'
          description: File size returned by the Sendora API.
          title: File Size
        id:
          description: The source's id. Pass it to any endpoint that takes `source_id`.
          title: Id
          type: string
        is_user_edited:
          default: false
          description: Is user edited returned by the Sendora API.
          title: Is User Edited
          type: boolean
        kb_id:
          description: 'A knowledge base''s id: the `id` from List or get knowledge bases.'
          title: Kb Id
          type: string
        mime_type:
          anyOf:
            - type: string
            - type: 'null'
          description: Mime type returned by the Sendora API.
          title: Mime Type
        page_count:
          anyOf:
            - type: integer
            - type: 'null'
          description: Page count returned by the Sendora API.
          title: Page Count
        refresh_interval_hours:
          anyOf:
            - type: integer
            - type: 'null'
          description: Refresh interval hours returned by the Sendora API.
          title: Refresh Interval Hours
        source_type:
          description: Source type returned by the Sendora API.
          title: Source Type
          type: string
        status:
          description: Status returned by the Sendora API.
          title: Status
          type: string
        storage_url:
          anyOf:
            - type: string
            - type: 'null'
          description: Storage url returned by the Sendora API.
          title: Storage Url
        sync_state:
          default: local
          description: Sync state returned by the Sendora API.
          title: Sync State
          type: string
        title:
          description: Title returned by the Sendora API.
          title: Title
          type: string
        updated_at:
          description: Updated at returned by the Sendora API.
          format: date-time
          title: Updated At
          type: string
      required:
        - id
        - kb_id
        - source_type
        - title
        - status
        - created_at
        - updated_at
      title: KBSourceOut
      type: object
    KBAgentUsage:
      properties:
        id:
          description: The voice agent's id.
          title: Id
          type: string
        name:
          description: Name returned by the Sendora API.
          title: Name
          type: string
      required:
        - id
        - name
      title: KBAgentUsage
      type: object
    ValidationError:
      properties:
        loc:
          description: Loc returned by the Sendora API.
          items:
            anyOf:
              - type: string
              - type: integer
          title: Location
          type: array
        msg:
          description: Msg returned by the Sendora API.
          title: Message
          type: string
        type:
          description: Type returned by the Sendora API.
          title: Error Type
          type: string
      required:
        - loc
        - msg
        - type
      title: ValidationError
      type: object
  securitySchemes:
    ApiKeyAuth:
      description: Customer API key created in the Sendora dashboard.
      in: header
      name: X-API-Key
      type: apiKey

````

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