> ## 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 Document

> Update the name and/or content of a document.



## OpenAPI

````yaml /api-reference/openapi.json patch /v1/convai/knowledge-base/{documentation_id}
openapi: 3.1.0
info:
  title: Threetone API Documentation
  description: >-
    This is the documentation for the Threetone API. You can use this API to use
    our service programmatically with API keys sent in the x-api-key header. You
    can create and manage API keys in the dashboard at
    https://threetone.in/app/developers/api-keys.
  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 Document
      description: Update the name and/or content 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_route'
      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:
                      $ref: '#/components/schemas/GetKnowledgeBaseURLResponseModel'
                    file:
                      $ref: '#/components/schemas/GetKnowledgeBaseFileResponseModel'
                    text:
                      $ref: '#/components/schemas/GetKnowledgeBaseTextResponseModel'
                    folder:
                      $ref: '#/components/schemas/GetKnowledgeBaseFolderResponseModel'
                title: Response Update Document Route
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    Body_update_document_route:
      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.
      type: object
      title: Body_update_document_route
    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.
        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.
        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.
        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.
        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
    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

````