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

# Update a knowledge base

> Update an existing knowledge base by ID.

<Note>
  The embedding model cannot be changed after creation — only the name,
  description, extraction settings, and trigger can be updated.
</Note>




## OpenAPI

````yaml /openapi.yaml put /kb/manage
openapi: 3.1.0
info:
  title: AsterAgents API
  version: 1.0.0
  description: >
    API for AsterAgents platform operations.


    - **Admin endpoints** (`/admin/*`) require organization admin privileges
    (`org:admin` role)

    - **Agent endpoints** (`/agents`) require agent management permissions or
    `org:admin` role

    - **Knowledge base endpoints** (`/kb/*`) require standard authentication

    - **Skills endpoints** (`/skills/*`) require standard authentication

    - **File endpoints** (`/upload/*`, `/kb/files`, `/skills/files`) require
    standard authentication
  contact:
    name: AsterAgents Support
    url: https://asteragents.com/support
servers:
  - url: https://asteragents.com/api
    description: Production
  - url: http://localhost:3000/api
    description: Local development
security:
  - bearerAuth: []
tags:
  - name: Users
    description: Manage active organization users
  - name: Invitations
    description: Manage organization invitations
  - name: Files
    description: Upload and manage files
  - name: Knowledge Bases
    description: Manage knowledge bases and their files
  - name: Knowledge Base Management
    description: Create, update, and delete knowledge bases
  - name: Agents
    description: Create, update, and delete agents
  - name: Agent Tags
    description: Organize agents with tags
  - name: Tools
    description: Discover the tool catalog available to your organization
  - name: Skills
    description: Manage agent skills
  - name: Skill Files
    description: Manage bundled files for skills
  - name: Conversations
    description: Invoke agents and retrieve conversation history and messages
  - name: Scheduled Tasks
    description: Schedule agents to run automatically on a cron schedule
paths:
  /kb/manage:
    put:
      tags:
        - Knowledge Base Management
      summary: Update a knowledge base
      description: |
        Update an existing knowledge base by ID.

        <Note>
          The embedding model cannot be changed after creation — only the name,
          description, extraction settings, and trigger can be updated.
        </Note>
      operationId: updateKnowledgeBase
      parameters:
        - name: id
          in: query
          required: true
          description: The ID of the knowledge base to update
          schema:
            type: integer
            example: 1
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - name
              properties:
                name:
                  type: string
                  description: Knowledge base name
                  example: Updated Documentation
                description:
                  type: string
                  nullable: true
                  description: Optional description
                extractionModel:
                  type: string
                  nullable: true
                  description: Optional extraction model
                extractionSchema:
                  type: object
                  nullable: true
                  description: Optional extraction schema
                trigger:
                  $ref: '#/components/schemas/KnowledgeBaseTrigger'
      responses:
        '200':
          description: Knowledge base updated successfully
          content:
            application/json:
              schema:
                type: object
                required:
                  - success
                  - knowledgeBase
                properties:
                  success:
                    type: boolean
                  knowledgeBase:
                    $ref: '#/components/schemas/KnowledgeBase'
        '400':
          $ref: '#/components/responses/BadRequest'
        '404':
          description: Knowledge base not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error: Knowledge base not found
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  schemas:
    KnowledgeBaseTrigger:
      type: object
      description: >
        Trigger configuration that automatically runs an agent when new files
        are added.

        Set `enabled: true` with an `agentId` and `prompt` to activate.
      properties:
        enabled:
          type: boolean
          description: Whether the trigger is active
          example: true
        agentId:
          type: integer
          description: ID of the agent to run (must belong to the same organization)
          example: 42
        prompt:
          type: string
          description: Instructions appended after document context when the agent runs
          example: Summarize this document and extract key topics
        createdAt:
          type: string
          format: date-time
          description: When the trigger was configured (set automatically)
    KnowledgeBase:
      type: object
      required:
        - id
        - name
        - embeddingModel
        - embeddingDimensions
        - createdAt
        - updatedAt
        - userId
        - fileCount
        - status
      properties:
        id:
          type: integer
          description: Unique knowledge base identifier
          example: 1
        name:
          type: string
          description: Knowledge base name
          example: Product Documentation
        description:
          type: string
          nullable: true
          description: Optional description
          example: All product docs and user guides
        embeddingModel:
          type: string
          description: Embedding model identifier
          example: openai:text-embedding-3-small
        embeddingDimensions:
          type: integer
          description: Vector dimensions for the embedding model
          example: 1536
        extractionModel:
          type: string
          nullable: true
          description: Model used for structured data extraction
        extractionSchema:
          type: object
          nullable: true
          description: JSON schema for structured data extraction
        source:
          type: string
          nullable: true
          description: Integration source (when set, KB is integration-managed)
          example: null
        trigger:
          nullable: true
          allOf:
            - $ref: '#/components/schemas/KnowledgeBaseTrigger'
        createdAt:
          type: string
          format: date-time
          description: When the knowledge base was created
          example: '2024-01-15T10:30:00.000Z'
        updatedAt:
          type: string
          format: date-time
          description: When the knowledge base was last updated
          example: '2024-01-15T10:30:00.000Z'
        userId:
          type: string
          description: Clerk user ID of the creator
          example: user_2ABC123DEF
        fileCount:
          type: integer
          description: Number of files in the knowledge base
          example: 12
        lastFileUploadedAt:
          type: string
          format: date-time
          nullable: true
          description: When the most recent file was uploaded
        totalSize:
          type: integer
          nullable: true
          description: Total size of all files in bytes
        status:
          type: string
          description: Knowledge base status
          enum:
            - empty
            - ready
          example: ready
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: string
          example: Bad Request
        details:
          type: array
          items:
            type: object
            additionalProperties: true
  responses:
    BadRequest:
      description: Bad Request - Invalid parameters or user not part of organization
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: User is not part of any organization
    InternalServerError:
      description: Internal Server Error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: Internal Server Error
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: |
        JWT token from Clerk authentication.

        Must be from a user with `org:admin` role.

````