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

# Generic Train Knowledge Base



## OpenAPI

````yaml post /v1/knowledge-bases/{knowledge_base_id}/generic_train
openapi: 3.1.0
info:
  title: Noxus Backend
  description: >-
    Backend API for the Noxus Platform. More information can be found at
    https://docs.noxus.ai
  version: 1.1.0
servers: []
security: []
paths:
  /v1/knowledge-bases/{knowledge_base_id}/generic_train:
    post:
      tags:
        - V1 - Knowledge Bases
      summary: Generic Train Knowledge Base
      operationId: generic_train_knowledge_base
      parameters:
        - name: knowledge_base_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Knowledge Base Id
        - name: prefix
          in: query
          required: false
          schema:
            type: string
            description: The path prefix where to upload
            default: /
            title: Prefix
          description: The path prefix where to upload
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Source'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  type: string
                  format: uuid
                title: Response Generic Train Knowledge Base
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyHeader: []
components:
  schemas:
    Source:
      properties:
        source:
          oneOf:
            - $ref: '#/components/schemas/DocumentSource'
            - $ref: '#/components/schemas/GoogleDriveSource'
            - $ref: '#/components/schemas/OneDriveSource'
            - $ref: '#/components/schemas/SharepointSource'
            - $ref: '#/components/schemas/WebsiteSource'
            - $ref: '#/components/schemas/ServiceNowKnowledgeBaseSource'
            - $ref: '#/components/schemas/CustomSource'
            - $ref: '#/components/schemas/PluginDataSourceKB'
          title: Source
          discriminator:
            propertyName: source_type
            mapping:
              Custom:
                $ref: '#/components/schemas/CustomSource'
              Document:
                $ref: '#/components/schemas/DocumentSource'
              Google Drive:
                $ref: '#/components/schemas/GoogleDriveSource'
              OneDrive:
                $ref: '#/components/schemas/OneDriveSource'
              ServiceNow:
                $ref: '#/components/schemas/ServiceNowKnowledgeBaseSource'
              Sharepoint:
                $ref: '#/components/schemas/SharepointSource'
              Website:
                $ref: '#/components/schemas/WebsiteSource'
              plugin_datasource:
                $ref: '#/components/schemas/PluginDataSourceKB'
      type: object
      required:
        - source
      title: Source
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    DocumentSource:
      properties:
        source_type:
          type: string
          const: Document
          title: Source Type
          default: Document
        subtype:
          anyOf:
            - type: string
            - type: 'null'
          title: Subtype
        config_cls:
          title: Config Cls
        config:
          $ref: '#/components/schemas/DocumentSourceConfig'
        integration:
          anyOf:
            - type: string
            - type: 'null'
          title: Integration
        image:
          type: string
          title: Image
          default: ''
        name:
          type: string
          title: Name
          default: File
        exposed:
          type: boolean
          title: Exposed
          default: false
      type: object
      required:
        - config
      title: DocumentSource
    GoogleDriveSource:
      properties:
        source_type:
          type: string
          const: Google Drive
          title: Source Type
          default: Google Drive
        subtype:
          anyOf:
            - type: string
            - type: 'null'
          title: Subtype
        config_cls:
          title: Config Cls
        config:
          $ref: '#/components/schemas/GoogleDriveSourceConfig'
        integration:
          anyOf:
            - type: string
            - type: 'null'
          title: Integration
        image:
          type: string
          title: Image
          default: >-
            https://storage.googleapis.com/image-storage-spot-manual/logos/google-drive.svg
        name:
          type: string
          title: Name
          default: Google Drive
        exposed:
          type: boolean
          title: Exposed
          default: true
      type: object
      required:
        - config
      title: GoogleDriveSource
    OneDriveSource:
      properties:
        source_type:
          type: string
          const: OneDrive
          title: Source Type
          default: OneDrive
        subtype:
          anyOf:
            - type: string
            - type: 'null'
          title: Subtype
        config_cls:
          title: Config Cls
        config:
          $ref: '#/components/schemas/OneDriveSourceConfig'
        integration:
          anyOf:
            - type: string
            - type: 'null'
          title: Integration
        image:
          type: string
          title: Image
          default: >-
            https://storage.googleapis.com/image-storage-spot-manual/logos/onedrive.png
        name:
          type: string
          title: Name
          default: OneDrive
        exposed:
          type: boolean
          title: Exposed
          default: true
      type: object
      required:
        - config
      title: OneDriveSource
    SharepointSource:
      properties:
        source_type:
          type: string
          const: Sharepoint
          title: Source Type
          default: Sharepoint
        subtype:
          anyOf:
            - type: string
            - type: 'null'
          title: Subtype
        config_cls:
          title: Config Cls
        config:
          $ref: '#/components/schemas/SharepointSourceConfig'
        integration:
          anyOf:
            - type: string
            - type: 'null'
          title: Integration
        image:
          type: string
          title: Image
          default: >-
            https://storage.googleapis.com/image-storage-spot-manual/logos/sharepoint.png
        name:
          type: string
          title: Name
          default: Sharepoint
        exposed:
          type: boolean
          title: Exposed
          default: true
      type: object
      required:
        - config
      title: SharepointSource
    WebsiteSource:
      properties:
        source_type:
          type: string
          const: Website
          title: Source Type
          default: Website
        subtype:
          anyOf:
            - type: string
            - type: 'null'
          title: Subtype
        config_cls:
          title: Config Cls
        config:
          $ref: '#/components/schemas/WebsiteSourceConfig'
        integration:
          anyOf:
            - type: string
            - type: 'null'
          title: Integration
        image:
          type: string
          title: Image
          default: icon:Globe
        name:
          type: string
          title: Name
          default: Website
        exposed:
          type: boolean
          title: Exposed
          default: true
      type: object
      required:
        - config
      title: WebsiteSource
    ServiceNowKnowledgeBaseSource:
      properties:
        source_type:
          type: string
          const: ServiceNow
          title: Source Type
          default: ServiceNow
        subtype:
          anyOf:
            - type: string
            - type: 'null'
          title: Subtype
        config_cls:
          title: Config Cls
        config:
          $ref: '#/components/schemas/ServiceNowKnowledgeBaseSourceConfig'
        integration:
          anyOf:
            - type: string
            - type: 'null'
          title: Integration
        image:
          type: string
          title: Image
          default: >-
            https://storage.googleapis.com/image-storage-spot-manual/logos/servicenow.png
        name:
          type: string
          title: Name
          default: ServiceNow
        exposed:
          type: boolean
          title: Exposed
          default: true
      type: object
      required:
        - config
      title: ServiceNowKnowledgeBaseSource
    CustomSource:
      properties:
        source_type:
          type: string
          const: Custom
          title: Source Type
          default: Custom
        subtype:
          anyOf:
            - type: string
            - type: 'null'
          title: Subtype
        config_cls:
          title: Config Cls
        config:
          $ref: '#/components/schemas/CustomSourceConfig'
        integration:
          anyOf:
            - type: string
            - type: 'null'
          title: Integration
        image:
          type: string
          title: Image
          default: icon:Globe
        name:
          type: string
          title: Name
          default: Custom
        exposed:
          type: boolean
          title: Exposed
          default: true
      type: object
      required:
        - config
      title: CustomSource
    PluginDataSourceKB:
      properties:
        source_type:
          type: string
          const: plugin_datasource
          title: Source Type
          default: plugin_datasource
        subtype:
          anyOf:
            - type: string
            - type: 'null'
          title: Subtype
        config_cls:
          title: Config Cls
        config:
          $ref: '#/components/schemas/PluginDataSourceKBConfig'
        integration:
          anyOf:
            - type: string
            - type: 'null'
          title: Integration
        image:
          type: string
          title: Image
          default: icon:Puzzle
        name:
          type: string
          title: Name
          default: Plugin Datasource
        exposed:
          type: boolean
          title: Exposed
          default: false
      type: object
      required:
        - config
      title: PluginDataSourceKB
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    DocumentSourceConfig:
      properties:
        files:
          items:
            $ref: '#/components/schemas/File-Input'
          type: array
          title: Files
          display:
            can_select_multiple_files: false
            col_span: 12
            isPublic: false
            is_disabled: false
            is_subconfig: false
            label: Files
            needs_confirmation: false
            show_optional_label: false
            type: file_array
            variant: regular
          tab: Configuration
          tool_mode: hidden
      type: object
      title: DocumentSourceConfig
    GoogleDriveSourceConfig:
      properties:
        connection:
          anyOf:
            - type: string
            - type: 'null'
          title: Connection
          display:
            col_span: 12
            integration_type: gdrive
            is_disabled: false
            is_subconfig: false
            label: Gdrive Connection
            needs_confirmation: false
            show_optional_label: false
            type: credential_picker
          field_type: config
          tab: Configuration
          tool_mode: hidden
        files:
          items:
            $ref: '#/components/schemas/GoogleFile'
          type: array
          title: Files
          description: File or folder to read
          display:
            col_span: 12
            file_type: >-
              application/pdf,text/plain,application/vnd.google-apps.document,application/vnd.google-apps.presentation,application/json,application/vnd.google-apps.folder,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.openxmlformats-officedocument.presentationml.presentation,image/jpeg,image/png,image/gif,image/webp,image/svg+xml,application/vnd.google-apps.spreadsheet
            is_disabled: false
            is_subconfig: false
            label: Path(s)
            multi_select: true
            needs_confirmation: false
            setIncludeFolders: false
            show_optional_label: false
            type: gdrive_picker
          placeholder:
            id: '123'
            name: '123'
          tab: Configuration
          tool_mode: hidden
      type: object
      required:
        - files
      title: GoogleDriveSourceConfig
      description: |-
        text_display_1: str = Parameter(
            default="",
            display=ConfigTextDisplay(
                title="Select files to add to knowledge base",
                text="",
            ),
        )
    OneDriveSourceConfig:
      properties:
        connection:
          anyOf:
            - type: string
            - type: 'null'
          title: Connection
          display:
            col_span: 12
            integration_type: onedrive
            is_disabled: false
            is_subconfig: false
            label: Onedrive Connection
            needs_confirmation: false
            show_optional_label: false
            type: credential_picker
          field_type: config
          tab: Configuration
          tool_mode: hidden
        files:
          items:
            $ref: '#/components/schemas/OneDriveFile'
          type: array
          title: Files
          description: Document to read
          display:
            col_span: 12
            file_type: folder
            is_disabled: false
            is_subconfig: false
            label: ''
            multi_select: true
            name: OneDrive
            needs_confirmation: false
            set_include_folders: true
            show_optional_label: false
            type: onedrive_picker
          placeholder:
            - id: '123'
              image: '123'
              name: '123'
          tab: Configuration
          tool_mode: hidden
      type: object
      required:
        - files
      title: OneDriveSourceConfig
      description: |-
        text_display_1: str = Parameter(
            default="",
            display=ConfigTextDisplay(
                title="Select files to add to knowledge base",
                text="",
            ),
        )
    SharepointSourceConfig:
      properties:
        connection:
          anyOf:
            - type: string
            - type: 'null'
          title: Connection
          display:
            col_span: 12
            integration_type: sharepoint
            is_disabled: false
            is_subconfig: false
            label: Sharepoint Connection
            needs_confirmation: false
            show_optional_label: false
            type: credential_picker
          field_type: config
          tab: Configuration
          tool_mode: hidden
        files:
          items:
            $ref: '#/components/schemas/OneDriveFile'
          type: array
          title: Files
          description: Document to read
          display:
            col_span: 12
            file_type: folder
            is_disabled: false
            is_subconfig: false
            label: ''
            multi_select: true
            name: Sharepoint
            needs_confirmation: false
            set_include_folders: true
            show_optional_label: false
            type: onedrive_picker
          placeholder:
            - id: '123'
              image: '123'
              name: '123'
          tab: Configuration
          tool_mode: hidden
      type: object
      required:
        - files
      title: SharepointSourceConfig
      description: |-
        text_display_1: str = Parameter(
            default="",
            display=ConfigTextDisplay(
                title="Select files to add to knowledge base",
                text="",
            ),
        )
    WebsiteSourceConfig:
      properties:
        urls:
          items:
            $ref: '#/components/schemas/WebsiteWithDepth'
          type: array
          title: Urls
          description: URLs to scrape
          display:
            col_span: 12
            is_disabled: false
            is_subconfig: false
            label: Website URLs
            max_depth: 2
            needs_confirmation: false
            show_optional_label: false
            type: config_scrape_website_list
          tab: Configuration
          tool_mode: hidden
      type: object
      required:
        - urls
      title: WebsiteSourceConfig
    ServiceNowKnowledgeBaseSourceConfig:
      properties:
        connection:
          anyOf:
            - type: string
            - type: 'null'
          title: Connection
          display:
            col_span: 12
            integration_type: servicenow
            is_disabled: false
            is_subconfig: false
            label: Servicenow Connection
            needs_confirmation: false
            show_optional_label: false
            type: credential_picker
          field_type: config
          tab: Configuration
          tool_mode: hidden
        knowledge_base_id:
          type: string
          title: Knowledge Base Id
          description: ServiceNow Knowledge Base ID (optional - leave empty for all)
          default: ''
          display:
            col_span: 12
            is_code: false
            is_disabled: false
            is_subconfig: false
            is_textarea: false
            label: Knowledge Base ID
            needs_confirmation: false
            number_of_lines: 1
            placeholder: Leave empty for all
            show_optional_label: false
            show_refresh: false
            type: text
          tab: Configuration
          tool_mode: hidden
        published_only:
          type: boolean
          title: Published Only
          description: Only include published articles
          default: true
          display:
            col_span: 12
            is_disabled: false
            is_subconfig: false
            label: Published Only
            needs_confirmation: false
            show_optional_label: false
            toggle_position: right
            type: toggle
          tab: Configuration
          tool_mode: hidden
      type: object
      title: ServiceNowKnowledgeBaseSourceConfig
    CustomSourceConfig:
      properties: {}
      additionalProperties: true
      type: object
      title: CustomSourceConfig
    PluginDataSourceKBConfig:
      properties: {}
      additionalProperties: true
      type: object
      title: PluginDataSourceKBConfig
      description: >-
        KB config for a plugin-provided datasource.


        Carries ``{plugin_id, datasource_name}`` plus the plugin datasource's
        own

        config fields; ``extra="allow"`` keeps them all. Ingestion resolves the

        generic ``plugin_datasource`` node (source_type == its node_name) via

        ``_fetch_via_datasource_node``, so ``to_files`` is never reached — this

        entry exists so ``Source``/``KB_CONFIG_PARSEABLE`` accepts the
        source_type.
    File-Input:
      properties:
        id:
          anyOf:
            - type: string
            - type: 'null'
          title: Id
        uri:
          type: string
          title: Uri
        name:
          type: string
          title: Name
        content_type:
          type: string
          title: Content Type
          default: text/plain
        size:
          anyOf:
            - type: integer
            - type: 'null'
          title: Size
        content_metadata:
          anyOf:
            - oneOf:
                - $ref: '#/components/schemas/PdfMetadata'
                - $ref: '#/components/schemas/SpreadsheetMetadata'
                - $ref: '#/components/schemas/TabularMetadata'
              discriminator:
                propertyName: kind
                mapping:
                  pdf:
                    $ref: '#/components/schemas/PdfMetadata'
                  spreadsheet:
                    $ref: '#/components/schemas/SpreadsheetMetadata'
                  tabular:
                    $ref: '#/components/schemas/TabularMetadata'
            - type: 'null'
          title: Content Metadata
        source_type:
          $ref: '#/components/schemas/SourceType'
          default: Document
        source_metadata:
          anyOf:
            - $ref: '#/components/schemas/SourceMetadata'
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Source Metadata
      additionalProperties: true
      type: object
      required:
        - uri
        - name
      title: File
    GoogleFile:
      properties:
        id:
          type: string
          title: Id
        name:
          type: string
          title: Name
        mime_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Mime Type
        image:
          anyOf:
            - type: string
            - type: 'null'
          title: Image
      type: object
      required:
        - id
        - name
      title: GoogleFile
    OneDriveFile:
      properties:
        id:
          type: string
          title: Id
        name:
          type: string
          title: Name
        mime_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Mime Type
        image:
          anyOf:
            - type: string
            - type: 'null'
          title: Image
        url:
          anyOf:
            - type: string
            - type: 'null'
          title: Url
        drive_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Drive Id
        site_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Site Name
      type: object
      required:
        - id
        - name
      title: OneDriveFile
    WebsiteWithDepth:
      properties:
        url:
          type: string
          title: Url
        depth:
          type: integer
          title: Depth
        max_urls:
          type: integer
          title: Max Urls
          default: 50
      type: object
      required:
        - url
        - depth
      title: WebsiteWithDepth
    PdfMetadata:
      properties:
        kind:
          type: string
          const: pdf
          title: Kind
          default: pdf
        page_count:
          type: integer
          title: Page Count
      type: object
      required:
        - page_count
      title: PdfMetadata
      description: Structural metadata for a PDF file.
    SpreadsheetMetadata:
      properties:
        kind:
          type: string
          const: spreadsheet
          title: Kind
          default: spreadsheet
        sheets:
          items:
            $ref: '#/components/schemas/SheetInfo'
          type: array
          title: Sheets
      type: object
      required:
        - sheets
      title: SpreadsheetMetadata
      description: Structural metadata for a spreadsheet (Excel) file.
    TabularMetadata:
      properties:
        kind:
          type: string
          const: tabular
          title: Kind
          default: tabular
        row_count:
          type: integer
          title: Row Count
        column_count:
          type: integer
          title: Column Count
      type: object
      required:
        - row_count
        - column_count
      title: TabularMetadata
      description: Structural metadata for a delimited-text (CSV/TSV) file.
    SourceType:
      type: string
      enum:
        - Document
        - Google Drive
        - Notion
        - Website
        - OneDrive
        - Slack
        - Linear
        - Github
        - Teams
        - Sharepoint
        - ServiceNow
        - Custom
      title: SourceType
    SourceMetadata:
      properties:
        rel_path:
          anyOf:
            - type: string
            - type: 'null'
          title: Rel Path
        external_id:
          anyOf:
            - type: string
            - type: 'null'
          title: External Id
        file_created_date:
          anyOf:
            - type: string
            - type: 'null'
          title: File Created Date
        file_modified_date:
          anyOf:
            - type: string
            - type: 'null'
          title: File Modified Date
        original_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Original Url
        source_label:
          anyOf:
            - type: string
            - type: 'null'
          title: Source Label
        source_image:
          anyOf:
            - type: string
            - type: 'null'
          title: Source Image
      additionalProperties: true
      type: object
      title: SourceMetadata
      description: |-
        Base class for source metadata across different source types.

        ``external_id`` is the source's stable id for this item (Drive
        file id, OneDrive item id, URL for websites, etc.). Datasource
        ``download_file`` implementations stamp it explicitly, and the
        DB materialisation trigger projects it onto
        ``KnowledgeBaseDocument.m_source_external_id`` — which is the
        join key the KB sync engine uses to find existing docs by their
        source id.
    SheetInfo:
      properties:
        name:
          type: string
          title: Name
        dimensions:
          type: string
          title: Dimensions
      type: object
      required:
        - name
        - dimensions
      title: SheetInfo
      description: Per-worksheet metadata for a spreadsheet file.
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: X-API-Key

````