---
title: "创建知识库"
method: POST
path: "/knowledge-bases"
tags: ["知识库"]
---

# 创建知识库

`POST /knowledge-bases`

创建新的知识库

## Request body

- GithubComTencentWeKnoraInternalTypesKnowledgeBase
  - `chunk_count` integer — Chunk count (not stored in database, calculated on query)
  - `chunking_config` GithubComTencentWeKnoraInternalTypesChunkingConfig
    - `chunk_overlap` integer — Chunk overlap
    - `chunk_size` integer — Chunk size
    - `enable_multimodal` boolean — EnableMultimodal (deprecated, kept for backward compatibility with old data)
    - `separators` string[] — Separators
  - `cos_config` GithubComTencentWeKnoraInternalTypesStorageConfig
    - `app_id` string — App ID
    - `bucket_name` string — Bucket Name
    - `path_prefix` string — Path Prefix
    - `provider` string — Provider
    - `region` string — Region
    - `secret_id` string — Secret ID
    - `secret_key` string — Secret Key
  - `created_at` string — Creation time of the knowledge base
  - `deleted_at` GormDeletedAt
    - `time` string
    - `valid` boolean — Valid is true if Time is not NULL
  - `description` string — Description of the knowledge base
  - `embedding_model_id` string — ID of the embedding model
  - `extract_config` GithubComTencentWeKnoraInternalTypesExtractConfig
    - `enabled` boolean
    - `nodes` GithubComTencentWeKnoraInternalTypesGraphNode[]
      - `attributes` string[]
      - `chunks` string[]
      - `name` string
    - `relations` GithubComTencentWeKnoraInternalTypesGraphRelation[]
      - `node1` string
      - `node2` string
      - `type` string
    - `tags` string[]
    - `text` string
  - `faq_config` GithubComTencentWeKnoraInternalTypesFAQConfig
    - `index_mode` 'question_only' | 'question_answer'
    - `question_index_mode` 'combined' | 'separate'
  - `id` string — Unique identifier of the knowledge base
  - `image_processing_config` GithubComTencentWeKnoraInternalTypesImageProcessingConfig
    - `model_id` string — Model ID
  - `is_processing` boolean — IsProcessing indicates if there is a processing import task (for FAQ type knowledge bases)
  - `is_temporary` boolean — Whether this knowledge base is temporary (ephemeral) and should be hidden from UI
  - `knowledge_count` integer — Knowledge count (not stored in database, calculated on query)
  - `name` string — Name of the knowledge base
  - `processing_count` integer — ProcessingCount indicates the number of knowledge items being processed (for document type knowledge bases)
  - `question_generation_config` GithubComTencentWeKnoraInternalTypesQuestionGenerationConfig
    - `enabled` boolean
    - `question_count` integer — Number of questions to generate per chunk (default: 3, max: 10)
  - `summary_model_id` string — Summary model ID
  - `tenant_id` integer — Tenant ID
  - `type` string — Type of the knowledge base (document, faq, etc.)
  - `updated_at` string — Last updated time of the knowledge base
  - `vlm_config` GithubComTencentWeKnoraInternalTypesVLMConfig
    - `api_key` string — API Key
    - `base_url` string — Base URL
    - `enabled` boolean
    - `interface_type` string — Interface Type: "ollama" or "openai"
    - `model_id` string
    - `model_name` string — 兼容老版本 Model Name

## Response `201`

创建的知识库

- object

## Other responses

- `400` — 请求参数错误

## Changes

- **2025-12-22** `e625bcd5b8b9` — 1 info
  - the endpoint scheme security `ApiKeyAuth` was added to the API
- **2025-12-16** `edf61e68559d` — 1 info
  - the endpoint scheme security `ApiKeyAuth` was removed from the API

[Change history](https://skmtc.dev/tencentblueking/apis/weknora-api/changes/knowledge-bases/post.md)

---

[API](https://skmtc.dev/tencentblueking/apis/weknora-api.md) · [All operations](https://skmtc.dev/tencentblueking/apis/weknora-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/tencentblueking/weknora-api/revisions/a7ea016b0504/schema)
