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

# Edit knowledge base content

> Replaces the content with your edited text as a new version. Get the current text from [Get knowledge base](/api-reference/knowledge-bases/get-knowledge-base), change it and send the whole text back.

<Note>
The edited version is selected automatically once indexing completes. Until then, agents read the previous version. If indexing fails, the previous version stays current.
</Note>




## OpenAPI

````yaml /api-reference/rest/openapi.yaml put /v1/knowledge-bases/{knowledgeId}/markdown
openapi: 3.1.0
info:
  title: Zero Runtime REST API
  version: '1.0'
  description: >-
    Create, configure, version and deploy agents, and wire SIP telephony to
    them.
servers:
  - url: https://api.zeroruntime.ai
security:
  - token: []
tags:
  - name: Agents
  - name: Versions
  - name: Deployment
  - name: Phone numbers
  - name: Routing rules
  - name: Calls
  - name: Batch calls
  - name: Knowledge bases
  - name: Knowledge base folders
paths:
  /v1/knowledge-bases/{knowledgeId}/markdown:
    parameters:
      - $ref: '#/components/parameters/knowledgeId'
    put:
      tags:
        - Knowledge bases
      summary: Edit knowledge base content
      description: >
        Replaces the content with your edited text as a new version. Get the
        current text from [Get knowledge
        base](/api-reference/knowledge-bases/get-knowledge-base), change it and
        send the whole text back.


        <Note>

        The edited version is selected automatically once indexing completes.
        Until then, agents read the previous version. If indexing fails, the
        previous version stays current.

        </Note>
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - markdown
              properties:
                markdown:
                  type: string
                  minLength: 1
                  description: >-
                    The full new content. It replaces the current text; it isn't
                    merged with it.
                note:
                  type: string
                  maxLength: 200
                  description: A short description of the change, shown on the version.
                  example: Updated refund window to 30 days
            example:
              markdown: |-
                # Refunds

                Items can be returned within 30 days of delivery.
              note: Updated refund window to 30 days
      responses:
        '200':
          description: The knowledge base, describing the new version while it's indexed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/KnowledgeBase'
              example:
                knowledgeId: k7x2m
                name: Return policy
                type: txt
                status: processing
                statusReason: null
                failureCode: null
                sizeInBytes: null
                pageCount: null
                sectionCount: null
                charCount: null
                folderId: null
                currentVersion: 1
                latestVersion: 2
                createdAt: '2026-10-13T09:30:00.000Z'
                updatedAt: '2026-10-13T10:02:00.000Z'
        '400':
          description: >-
            The body didn't validate. `markdown` is missing or empty, or `note`
            is over 200 characters.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/KnowledgeBaseValidationError'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          description: The knowledge base isn't yours or is deleted.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Message'
              example:
                message: Knowledge base not found
        '409':
          description: |
            The knowledge base can't be edited yet. One of:

            - `Knowledge base is still processing and cannot be edited yet`
            - `Knowledge base has no markdown to update`
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Message'
              example:
                message: Knowledge base is still processing and cannot be edited yet
components:
  parameters:
    knowledgeId:
      name: knowledgeId
      in: path
      required: true
      schema:
        type: string
      example: k7x2m
  schemas:
    KnowledgeBase:
      type: object
      description: Status and size fields describe the current version.
      properties:
        knowledgeId:
          type: string
          description: 5 characters
          lowercase letters and digits. Attach it to an agent with `knowledgeBaseIds`.: null
          example: k7x2m
        name:
          type: string
          example: pricing.pdf
        type:
          type: string
          enum:
            - pdf
            - txt
            - csv
            - json
            - docx
            - md
            - url
        status:
          $ref: '#/components/schemas/KnowledgeBaseStatus'
        statusReason:
          type:
            - string
            - 'null'
          description: Why processing failed.
        failureCode:
          type:
            - string
            - 'null'
          description: For example `upload_failed` or `job_not_scheduled`.
        sizeInBytes:
          type:
            - integer
            - 'null'
          description: '`0` for website knowledge bases.'
        pageCount:
          type:
            - integer
            - 'null'
        sectionCount:
          type:
            - integer
            - 'null'
        charCount:
          type:
            - integer
            - 'null'
        folderId:
          type:
            - string
            - 'null'
          description: '`null` when it''s at the top level.'
        currentVersion:
          type: integer
          description: The version agents read from.
        latestVersion:
          type: integer
          description: The newest version. It may still be processing
          or may have failed.: null
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    KnowledgeBaseValidationError:
      type: object
      properties:
        message:
          type: string
          example: Invalid payload
        errors:
          type: object
          description: Every problem found, grouped by field.
          properties:
            formErrors:
              type: array
              items:
                type: string
            fieldErrors:
              type: object
              additionalProperties:
                type: array
                items:
                  type: string
    Message:
      type: object
      properties:
        message:
          type: string
    KnowledgeBaseStatus:
      type: string
      enum:
        - processing
        - ready
        - failed
      description: |
        - `processing`: being parsed and indexed. Not available to agents yet.
        - `ready`: indexed and available to agents.
        - `failed`: processing stopped. `statusReason` says why.
    Error:
      type: object
      properties:
        error:
          type: string
  responses:
    Unauthorized:
      description: Missing or invalid `Authorization` header.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    token:
      type: apiKey
      in: header
      name: Authorization
      description: Your API token, sent raw (no `Bearer` prefix).
      x-default: <auth-token>

````

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