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

# Update knowledge base document

> Update the name, content and/or auto-sync settings of a document.



## OpenAPI

````yaml /api-reference/openapi.json patch /v1/convai/knowledge-base/{documentation_id}
openapi: 3.1.0
info:
  title: Threetone API
  description: >-
    APIs for the Threetone Agents Platform and shared workspace resources.
    Authenticate programmatic requests with an API key in the x-api-key header.
  version: '1.0'
servers:
  - url: https://api.threetone.in
    description: Production
security: []
paths:
  /v1/convai/knowledge-base/{documentation_id}:
    patch:
      tags:
        - Agents Platform
      summary: Update knowledge base document
      description: Update the name, content and/or auto-sync settings of a document.
      operationId: update_document_route
      parameters:
        - name: documentation_id
          in: path
          required: true
          schema:
            type: string
            description: >-
              The id of a document from the knowledge base. This is returned on
              document addition.
            examples:
              - 21m00Tcm4TlvDq8ikWAM
            embed: true
            title: Documentation Id
          description: >-
            The id of a document from the knowledge base. This is returned on
            document addition.
        - name: x-api-key
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: >-
              Your API key for programmatic access. Send it in the x-api-key
              header; you can create and manage keys from the Developers page.
            title: X-Api-Key
          description: >-
            Your API key for programmatic access. Send it in the x-api-key
            header; you can create and manage keys from the Developers page.
      requestBody:
        content:
          application/json:
            schema:
              $ref: >-
                #/components/schemas/Body_Update_document_v1_convai_knowledge_base__documentation_id__patch
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/GetKnowledgeBaseURLResponseModel'
                  - $ref: '#/components/schemas/GetKnowledgeBaseFileResponseModel'
                  - $ref: '#/components/schemas/GetKnowledgeBaseTextResponseModel'
                  - $ref: '#/components/schemas/GetKnowledgeBaseFolderResponseModel'
                discriminator:
                  propertyName: type
                  mapping:
                    url: '#/components/schemas/GetKnowledgeBaseURLResponseModel'
                    file: '#/components/schemas/GetKnowledgeBaseFileResponseModel'
                    text: '#/components/schemas/GetKnowledgeBaseTextResponseModel'
                    folder: '#/components/schemas/GetKnowledgeBaseFolderResponseModel'
                title: >-
                  Response Update Document V1 Convai Knowledge Base 
                  Documentation Id  Patch
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    Body_Update_document_v1_convai_knowledge_base__documentation_id__patch:
      properties:
        name:
          anyOf:
            - type: string
              minLength: 1
            - type: 'null'
          title: Name
          description: A custom, human-readable name for the document.
        content:
          anyOf:
            - type: string
            - type: 'null'
          title: Content
          description: >-
            Updated content for the document. Only supported for text documents,
            URL documents with auto-sync disabled, and file documents that are
            not synced from an external source.
        enable_auto_sync:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Enable Auto Sync
          description: >-
            Whether the document or folder is refreshed automatically. Only
            applicable to URL documents, folders, and externally-synced files.
            Leave unset to keep the current value.
        auto_remove:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Auto Remove
          description: >-
            Whether to automatically remove the document once its source is no
            longer available. Only applicable when auto-sync is enabled. Leave
            unset to keep the current value.
        minimum_frequency_days:
          anyOf:
            - type: integer
              maximum: 180
              minimum: 1
            - type: 'null'
          title: Minimum Frequency Days
          description: >-
            Minimum frequency (in days) at which the document is refreshed. The
            actual interval may be shorter, never longer. Only applicable when
            auto-sync is enabled. Leave unset to keep the current value.
        tighten_only:
          type: boolean
          title: Tighten Only
          description: >-
            Folders only. When true, items already in the folder are only
            tightened to stay at least as strict as the folder, and keep any
            setting that is stricter than the folder's. When false, they are set
            to exactly the folder's auto-sync settings. Ignored for externally
            synced folders, whose contents always follow the folder's schedule.
          default: false
      type: object
      title: Body_Update_document_v1_convai_knowledge_base__documentation_id__patch
    GetKnowledgeBaseURLResponseModel:
      properties:
        id:
          type: string
          title: Id
        name:
          type: string
          title: Name
        metadata:
          $ref: '#/components/schemas/KnowledgeBaseDocumentMetadataResponseModel'
        supported_usages:
          items:
            $ref: '#/components/schemas/DocumentUsageModeEnum'
          type: array
          title: Supported Usages
        access_info:
          $ref: '#/components/schemas/ResourceAccessInfo'
        folder_parent_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Folder Parent Id
          description: >-
            The ID of the parent folder, or null if the document is at the root
            level.
        chunking_override:
          anyOf:
            - $ref: '#/components/schemas/ChunkingOverride'
            - type: 'null'
          description: >-
            Per-entity RAG chunking override. Null means inherit from ancestors
            or the embedding model default.
        folder_path:
          items:
            $ref: '#/components/schemas/KnowledgeBaseFolderPathSegmentResponseModel'
          type: array
          title: Folder Path
          description: >-
            The folder path segments leading to this entity, from root to parent
            folder.
        type:
          type: string
          const: url
          title: Type
        url:
          type: string
          title: Url
        extracted_inner_html:
          type: string
          title: Extracted Inner Html
        content_format:
          $ref: '#/components/schemas/ContentFormat'
          default: html
        auto_sync_info:
          anyOf:
            - $ref: '#/components/schemas/AutoSyncInfo'
            - type: 'null'
      type: object
      required:
        - id
        - name
        - metadata
        - supported_usages
        - access_info
        - type
        - url
        - extracted_inner_html
      title: GetKnowledgeBaseURLResponseModel
    GetKnowledgeBaseFileResponseModel:
      properties:
        id:
          type: string
          title: Id
        name:
          type: string
          title: Name
        metadata:
          $ref: '#/components/schemas/KnowledgeBaseDocumentMetadataResponseModel'
        supported_usages:
          items:
            $ref: '#/components/schemas/DocumentUsageModeEnum'
          type: array
          title: Supported Usages
        access_info:
          $ref: '#/components/schemas/ResourceAccessInfo'
        folder_parent_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Folder Parent Id
          description: >-
            The ID of the parent folder, or null if the document is at the root
            level.
        chunking_override:
          anyOf:
            - $ref: '#/components/schemas/ChunkingOverride'
            - type: 'null'
          description: >-
            Per-entity RAG chunking override. Null means inherit from ancestors
            or the embedding model default.
        folder_path:
          items:
            $ref: '#/components/schemas/KnowledgeBaseFolderPathSegmentResponseModel'
          type: array
          title: Folder Path
          description: >-
            The folder path segments leading to this entity, from root to parent
            folder.
        type:
          type: string
          const: file
          title: Type
        extracted_inner_html:
          type: string
          title: Extracted Inner Html
        content_format:
          $ref: '#/components/schemas/ContentFormat'
          default: html
        filename:
          type: string
          title: Filename
        external_sync_info:
          anyOf:
            - $ref: '#/components/schemas/ExternalFileSyncInfo'
            - type: 'null'
        auto_sync_info:
          anyOf:
            - $ref: '#/components/schemas/AutoSyncInfo'
            - type: 'null'
        refresh_status:
          anyOf:
            - $ref: '#/components/schemas/FileRefreshStatus'
            - type: 'null'
          description: >-
            In-flight or last refresh state for an externally-synced file. Used
            by clients to render sync progress and disable re-sync while a
            refresh is queued or processing.
        is_frozen:
          type: boolean
          title: Is Frozen
          default: false
      type: object
      required:
        - id
        - name
        - metadata
        - supported_usages
        - access_info
        - type
        - extracted_inner_html
        - filename
      title: GetKnowledgeBaseFileResponseModel
    GetKnowledgeBaseTextResponseModel:
      properties:
        id:
          type: string
          title: Id
        name:
          type: string
          title: Name
        metadata:
          $ref: '#/components/schemas/KnowledgeBaseDocumentMetadataResponseModel'
        supported_usages:
          items:
            $ref: '#/components/schemas/DocumentUsageModeEnum'
          type: array
          title: Supported Usages
        access_info:
          $ref: '#/components/schemas/ResourceAccessInfo'
        folder_parent_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Folder Parent Id
          description: >-
            The ID of the parent folder, or null if the document is at the root
            level.
        chunking_override:
          anyOf:
            - $ref: '#/components/schemas/ChunkingOverride'
            - type: 'null'
          description: >-
            Per-entity RAG chunking override. Null means inherit from ancestors
            or the embedding model default.
        folder_path:
          items:
            $ref: '#/components/schemas/KnowledgeBaseFolderPathSegmentResponseModel'
          type: array
          title: Folder Path
          description: >-
            The folder path segments leading to this entity, from root to parent
            folder.
        type:
          type: string
          const: text
          title: Type
        extracted_inner_html:
          type: string
          title: Extracted Inner Html
        content_format:
          $ref: '#/components/schemas/ContentFormat'
          default: html
      type: object
      required:
        - id
        - name
        - metadata
        - supported_usages
        - access_info
        - type
        - extracted_inner_html
      title: GetKnowledgeBaseTextResponseModel
    GetKnowledgeBaseFolderResponseModel:
      properties:
        id:
          type: string
          title: Id
        name:
          type: string
          title: Name
        metadata:
          $ref: '#/components/schemas/KnowledgeBaseDocumentMetadataResponseModel'
        supported_usages:
          items:
            $ref: '#/components/schemas/DocumentUsageModeEnum'
          type: array
          title: Supported Usages
        access_info:
          $ref: '#/components/schemas/ResourceAccessInfo'
        folder_parent_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Folder Parent Id
          description: >-
            The ID of the parent folder, or null if the document is at the root
            level.
        chunking_override:
          anyOf:
            - $ref: '#/components/schemas/ChunkingOverride'
            - type: 'null'
          description: >-
            Per-entity RAG chunking override. Null means inherit from ancestors
            or the embedding model default.
        folder_path:
          items:
            $ref: '#/components/schemas/KnowledgeBaseFolderPathSegmentResponseModel'
          type: array
          title: Folder Path
          description: >-
            The folder path segments leading to this entity, from root to parent
            folder.
        type:
          type: string
          const: folder
          title: Type
        children_count:
          type: integer
          title: Children Count
        document_count:
          type: integer
          title: Document Count
          description: >-
            Number of non-folder documents anywhere in this folder's subtree
            (recursive). Counting stops past 1000;
        auto_sync_info:
          anyOf:
            - $ref: '#/components/schemas/AutoSyncInfo'
            - type: 'null'
        external_sync_info:
          anyOf:
            - $ref: '#/components/schemas/ExternalFolderSyncInfo'
            - type: 'null'
        is_frozen:
          type: boolean
          title: Is Frozen
          default: false
        active_sync_job:
          anyOf:
            - $ref: '#/components/schemas/KbExternalSyncJob'
            - type: 'null'
          description: >-
            Most recent (in-flight or terminal) external sync job for this
            folder, if any. Used by clients to render sync progress.
      type: object
      required:
        - id
        - name
        - metadata
        - supported_usages
        - access_info
        - type
        - children_count
        - document_count
      title: GetKnowledgeBaseFolderResponseModel
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    KnowledgeBaseDocumentMetadataResponseModel:
      properties:
        created_at_unix_secs:
          type: integer
          title: Created At Unix Secs
        last_updated_at_unix_secs:
          type: integer
          title: Last Updated At Unix Secs
        size_bytes:
          type: integer
          title: Size Bytes
      type: object
      required:
        - created_at_unix_secs
        - last_updated_at_unix_secs
        - size_bytes
      title: KnowledgeBaseDocumentMetadataResponseModel
    DocumentUsageModeEnum:
      type: string
      enum:
        - prompt
        - auto
      title: DocumentUsageModeEnum
      default: auto
    ResourceAccessInfo:
      properties:
        is_creator:
          type: boolean
          title: Is Creator
          description: Whether the user making the request is the creator of the agent
        creator_name:
          type: string
          title: Creator Name
          description: Name of the agent's creator
        creator_email:
          type: string
          title: Creator Email
          description: Email of the agent's creator
        role:
          type: string
          enum:
            - admin
            - editor
            - commenter
            - viewer
          title: Role
          description: The role of the user making the request
        anonymous_access_level_override:
          anyOf:
            - type: string
              enum:
                - admin
                - editor
                - commenter
                - viewer
            - type: 'null'
          title: Anonymous Access Level Override
          description: >-
            The access level for anonymous users. If None, the resource is not
            shared publicly.
        access_source:
          anyOf:
            - type: string
              enum:
                - creator
                - explicit
                - workspace_admin
                - workspace_default
            - type: 'null'
          title: Access Source
          description: >-
            Why the requesting user has access to this resource. 'creator' =
            caller is the owner. 'explicit' = caller (or one of their workspace
            groups) is listed in role_to_group_ids beyond the workspace-wide
            everyone group. 'workspace_default' = the workspace-wide everyone
            group is listed in role_to_group_ids (every non-anon workspace
            member, including admins, sees this resource). 'workspace_admin' =
            caller is a workspace admin and the admin seat is the *only* path to
            access; reserved for docs nobody else can see. Lets the UI disclose
            why an admin-bypass viewer sees a doc that wasn't explicitly shared
            with them.
      type: object
      required:
        - is_creator
        - creator_name
        - creator_email
        - role
      title: ResourceAccessInfo
      example:
        access_source: creator
        creator_email: john.doe@example.com
        creator_name: John Doe
        is_creator: true
        role: admin
    ChunkingOverride:
      properties:
        max_chunk_size:
          anyOf:
            - type: integer
            - type: 'null'
          title: Max Chunk Size
          description: Maximum chunk size in tokens. Null uses the inherited value.
        overlap_percentage:
          anyOf:
            - type: integer
            - type: 'null'
          title: Overlap Percentage
          description: >-
            Chunk overlap as a percentage of the chunk size. Null uses the
            inherited value.
        custom_separators:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Custom Separators
          description: >-
            Custom text separators used when splitting. Null uses the inherited
            value.
      type: object
      required:
        - max_chunk_size
        - overlap_percentage
        - custom_separators
      title: ChunkingOverride
    KnowledgeBaseFolderPathSegmentResponseModel:
      properties:
        id:
          type: string
          title: Id
        name:
          anyOf:
            - type: string
            - type: 'null'
          title: Name
      type: object
      required:
        - id
        - name
      title: KnowledgeBaseFolderPathSegmentResponseModel
    ContentFormat:
      type: string
      enum:
        - html
        - markdown
      title: ContentFormat
      description: >-
        Canonical representation of a knowledge base document's stored content.


        HTML is the legacy default; documents created before this field existed
        are

        interpreted as HTML.
      default: html
    AutoSyncInfo:
      properties:
        minimum_frequency_days:
          type: integer
          maximum: 180
          minimum: 1
          title: Minimum Frequency Days
          description: >-
            Minimum frequency (in days) at which the document is refreshed. The
            actual interval may be shorter, never longer.
          default: 7
        auto_remove:
          type: boolean
          title: Auto Remove
          description: Whether to remove the document if the URL becomes unavailable
          default: false
        consec_failures:
          type: integer
          minimum: 0
          title: Consec Failures
          description: Number of consecutive sync failures
          default: 0
        next_refresh_by:
          anyOf:
            - type: integer
            - type: 'null'
          title: Next Refresh By
          description: >-
            Unix timestamp for the next scheduled sync or None (in case of
            folders)
      type: object
      title: AutoSyncInfo
    ExternalFileSyncInfo:
      properties:
        type:
          $ref: '#/components/schemas/ExternalSyncProvider'
          description: Provider identifier
        source_entity_id:
          type: string
          title: Source Entity Id
          description: Entity ID in the external system
        integration_connection_id:
          type: string
          title: Integration Connection Id
          description: Integration connection instance ID
        source_parent_entity_id:
          type: string
          title: Source Parent Entity Id
          description: Folder ID in the external system this file was synced from
        source_mime_type:
          type: string
          title: Source Mime Type
          description: Original MIME type in the external system
        source_modified_time:
          type: string
          format: date-time
          title: Source Modified Time
          description: Last modified time from the external system
        root_folder_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Root Folder Id
          description: >-
            KB folder ID of the sync root, used to query all entities under a
            sync tree
      type: object
      required:
        - type
        - source_entity_id
        - integration_connection_id
        - source_parent_entity_id
        - source_mime_type
        - source_modified_time
      title: ExternalFileSyncInfo
      description: Tracks the link back to the original file in an external source.
    FileRefreshStatus:
      properties:
        status:
          $ref: '#/components/schemas/CrawlStatus'
          default: queued
        enqueued_at:
          anyOf:
            - type: integer
            - type: 'null'
          title: Enqueued At
        started_at:
          anyOf:
            - type: integer
            - type: 'null'
          title: Started At
        completed_at:
          anyOf:
            - type: integer
            - type: 'null'
          title: Completed At
        last_synced_at:
          anyOf:
            - type: integer
            - type: 'null'
          title: Last Synced At
        error_message:
          anyOf:
            - type: string
            - type: 'null'
          title: Error Message
      type: object
      title: FileRefreshStatus
      description: In-flight/last refresh state for an externally-synced KB file.
    ExternalFolderSyncInfo:
      properties:
        type:
          $ref: '#/components/schemas/ExternalSyncProvider'
          description: Provider identifier
        source_entity_id:
          type: string
          title: Source Entity Id
          description: Entity ID in the external system
        integration_connection_id:
          type: string
          title: Integration Connection Id
          description: Integration connection instance ID
        root_folder_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Root Folder Id
          description: KB folder ID of the sync root. None means this folder is the root.
        sync_cursor:
          anyOf:
            - type: string
            - type: 'null'
          title: Sync Cursor
          description: Opaque cursor for incremental sync, interpreted by the provider
        last_sync_at:
          anyOf:
            - type: integer
            - type: 'null'
          title: Last Sync At
          description: Unix timestamp of last completed sync
      type: object
      required:
        - type
        - source_entity_id
        - integration_connection_id
      title: ExternalFolderSyncInfo
      description: Metadata for a KB folder that mirrors an external source folder.
    KbExternalSyncJob:
      properties:
        type:
          $ref: '#/components/schemas/ExternalSyncProvider'
        folder_id:
          type: string
          title: Folder Id
        integration_connection_id:
          type: string
          title: Integration Connection Id
        triggered_by:
          $ref: '#/components/schemas/ExternalSyncJobTrigger'
        status:
          $ref: '#/components/schemas/CrawlStatus'
          default: queued
        sync_type:
          anyOf:
            - $ref: '#/components/schemas/ExternalSyncJobType'
            - type: 'null'
        items_identified:
          type: integer
          title: Items Identified
          default: 0
        items_processed:
          type: integer
          title: Items Processed
          default: 0
        error_message:
          anyOf:
            - type: string
            - type: 'null'
          title: Error Message
        started_at:
          anyOf:
            - type: integer
            - type: 'null'
          title: Started At
        completed_at:
          anyOf:
            - type: integer
            - type: 'null'
          title: Completed At
        updated_at:
          type: integer
          title: Updated At
        id:
          type: string
          title: Id
        created_at:
          type: integer
          title: Created At
      type: object
      required:
        - type
        - folder_id
        - integration_connection_id
        - triggered_by
        - updated_at
        - id
        - created_at
      title: KbExternalSyncJob
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    ExternalSyncProvider:
      type: string
      enum:
        - google_drive
      title: ExternalSyncProvider
    CrawlStatus:
      type: string
      enum:
        - queued
        - processing
        - succeeded
        - failed
        - skipped
        - cancelled
      title: CrawlStatus
      default: queued
    ExternalSyncJobTrigger:
      type: string
      enum:
        - on_demand
        - on_connect
        - auto
      title: ExternalSyncJobTrigger
    ExternalSyncJobType:
      type: string
      enum:
        - full
        - incremental
      title: ExternalSyncJobType

````

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