---
title: "Generic Train Knowledge Base"
method: POST
path: "/v1/knowledge-bases/{knowledge_base_id}/generic_train"
tags: ["V1 - Knowledge Bases"]
---

# Generic Train Knowledge Base

`POST /v1/knowledge-bases/{knowledge_base_id}/generic_train`

## Request

- Base URL: `https://api.app.noxus.ai` (the document declares no server; this is the origin it was published from)
- URL: `https://api.app.noxus.ai/v1/knowledge-bases/{knowledge_base_id}/generic_train`
- Auth: API key in header `X-API-Key`

## Path parameters

- `knowledge_base_id` string, uuid, required

## Query parameters

- `prefix` string: The path prefix where to upload

## Request body

- Source
  - `source` union, required
    - DocumentSource
      - `source_type` 'Document'
      - `subtype` string, nullable
      - `config_cls` unknown
      - `config` DocumentSourceConfig, required
        - `files` File[]
          - `id` string, nullable
          - `uri` string, required
          - `name` string, required
          - `content_type` string
          - `size` integer, nullable
          - `content_metadata` union
            - PdfMetadata: Structural metadata for a PDF file. ``page_labels`` is only set when the document's labels differ from plain 1..N numbering (cover pages, roman numerals), mapping physical page index to label.
              - …
            - SpreadsheetMetadata: Structural metadata for a spreadsheet (Excel) file.
              - …
            - TabularMetadata: Structural metadata for a delimited-text (CSV/TSV) file.
              - …
            - ImageMetadata: Structural metadata for an image file.
              - …
            - PresentationMetadata: Structural metadata for a presentation (PowerPoint) file.
              - …
            - DocumentMetadata: Structural metadata for a word-processing document (Word). ``page_count`` is the authoring app's cached count from ``docProps/app.xml`` — present only for Word-authored files, ``None`` when the document came from another tool (Google Docs, LibreOffice, python-docx) that does not write the cache. ``word_count`` / ``paragraph_count`` are derived from the body text and always populated.
              - …
          - `source_type` 'Document' | 'Google Drive' | 'Notion' | 'Website' | 'OneDrive' | 'Slack' | 'Linear' | 'Github' | 'Teams' | 'Sharepoint' | 'ServiceNow' | 'Custom'
          - `source_metadata` union
            - SourceMetadata: 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.
              - …
            - object
      - `integration` string, nullable
      - `image` string
      - `name` string
      - `exposed` boolean
    - GoogleDriveSource
      - `source_type` 'Google Drive'
      - `subtype` string, nullable
      - `config_cls` unknown
      - `config` GoogleDriveSourceConfig, required: text_display_1: str = Parameter( default="", display=ConfigTextDisplay( title="Select files to add to knowledge base", text="", ), )
        - `connection` string, nullable
        - `files` GoogleFile[], required: File or folder to read
          - `id` string, required
          - `name` string, required
          - `mime_type` string, nullable
          - `image` string, nullable
      - `integration` string, nullable
      - `image` string
      - `name` string
      - `exposed` boolean
    - OneDriveSource
      - `source_type` 'OneDrive'
      - `subtype` string, nullable
      - `config_cls` unknown
      - `config` OneDriveSourceConfig, required: text_display_1: str = Parameter( default="", display=ConfigTextDisplay( title="Select files to add to knowledge base", text="", ), )
        - `connection` string, nullable
        - `files` OneDriveFile[], required: Document to read
          - `id` string, required
          - `name` string, required
          - `mime_type` string, nullable
          - `image` string, nullable
          - `url` string, nullable
          - `drive_id` string, nullable
          - `site_name` string, nullable
      - `integration` string, nullable
      - `image` string
      - `name` string
      - `exposed` boolean
    - SharepointSource
      - `source_type` 'Sharepoint'
      - `subtype` string, nullable
      - `config_cls` unknown
      - `config` SharepointSourceConfig, required: text_display_1: str = Parameter( default="", display=ConfigTextDisplay( title="Select files to add to knowledge base", text="", ), )
        - `connection` string, nullable
        - `files` OneDriveFile[], required: Document to read
          - `id` string, required
          - `name` string, required
          - `mime_type` string, nullable
          - `image` string, nullable
          - `url` string, nullable
          - `drive_id` string, nullable
          - `site_name` string, nullable
      - `integration` string, nullable
      - `image` string
      - `name` string
      - `exposed` boolean
    - WebsiteSource
      - `source_type` 'Website'
      - `subtype` string, nullable
      - `config_cls` unknown
      - `config` WebsiteSourceConfig, required
        - `urls` WebsiteWithDepth[], required: URLs to scrape
          - `url` string, required
          - `depth` integer, required
          - `max_urls` integer
      - `integration` string, nullable
      - `image` string
      - `name` string
      - `exposed` boolean
    - ServiceNowKnowledgeBaseSource
      - `source_type` 'ServiceNow'
      - `subtype` string, nullable
      - `config_cls` unknown
      - `config` ServiceNowKnowledgeBaseSourceConfig, required
        - `connection` string, nullable
        - `knowledge_base_id` string: ServiceNow Knowledge Base ID (optional - leave empty for all)
        - `published_only` boolean: Only include published articles
      - `integration` string, nullable
      - `image` string
      - `name` string
      - `exposed` boolean
    - CustomSource
      - `source_type` 'Custom'
      - `subtype` string, nullable
      - `config_cls` unknown
      - `config` CustomSourceConfig, required
      - `integration` string, nullable
      - `image` string
      - `name` string
      - `exposed` boolean
    - PluginDataSourceKB
      - `source_type` 'plugin_datasource'
      - `subtype` string, nullable
      - `config_cls` unknown
      - `config` PluginDataSourceKBConfig, required: 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.
      - `integration` string, nullable
      - `image` string
      - `name` string
      - `exposed` boolean

## Response `200`

Successful Response

- string[]

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/noxus/apis/noxus-backend.md) - [All operations](https://skmtc.dev/noxus/apis/noxus-backend/llms.txt) - [OpenAPI document](https://skmtc.dev/noxus/apis/noxus-backend/revisions/0e37810b7ad5?raw)
