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

> 创建一个知识库目录

# Create Knowledge Folder



## OpenAPI

````yaml post /v1/knowledge/{knowledge_id}/folders
openapi: 3.1.0
info:
  title: spectra-server
  description: The API for Spectra Backend.
  version: 0.1.0
servers:
  - url: https://api-spectra.duplik.cn
security: []
paths:
  /v1/knowledge/{knowledge_id}/folders:
    post:
      tags:
        - Knowledge
      summary: Create Knowledge Folder
      operationId: create_knowledge_folder_v1_knowledge__knowledge_id__folders_post
      parameters:
        - name: knowledge_id
          in: path
          required: true
          schema:
            type: string
            title: Knowledge Id
        - name: user_id
          in: query
          required: false
          schema:
            type: string
            description: 用户ID
            title: User Id
          description: 用户ID
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FolderCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FolderRead'
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Bad Request
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Unprocessable Entity
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Internal Server Error
      security:
        - HTTPBearer: []
components:
  schemas:
    FolderCreate:
      properties:
        name:
          type: string
          maxLength: 256
          title: Name
        parent_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Parent Id
          description: parent folder id
      type: object
      required:
        - name
      title: FolderCreate
    FolderRead:
      properties:
        created_at:
          anyOf:
            - type: integer
            - type: 'null'
          title: Created At
        updated_at:
          anyOf:
            - type: integer
            - type: 'null'
          title: Updated At
        knowledge_id:
          type: string
          maxLength: 20
          title: Knowledge Id
        type:
          type: string
          maxLength: 128
          title: Type
          description: folder, pdf, txt ...
          default: folder
        parent_id:
          type: string
          maxLength: 20
          title: Parent Id
          default: ''
        parent_ids:
          items:
            type: string
          type: array
          title: Parent Ids
          description: Parent folder ID list
        name:
          anyOf:
            - type: string
              maxLength: 255
            - type: 'null'
          title: Name
          default: ''
        original_name:
          anyOf:
            - type: string
              maxLength: 255
            - type: 'null'
          title: Original Name
          description: file original name
          default: ''
        location:
          anyOf:
            - type: string
              maxLength: 1024
            - type: 'null'
          title: Location
          default: ''
        path:
          anyOf:
            - type: string
              maxLength: 1024
            - type: 'null'
          title: Path
          default: ''
        source_location:
          anyOf:
            - type: string
              maxLength: 1024
            - type: 'null'
          title: Source Location
          default: ''
        size:
          anyOf:
            - type: integer
            - type: 'null'
          title: Size
          description: File byte size
          default: 0
        source_type:
          type: string
          maxLength: 128
          title: Source Type
          default: tencent, web
        complete_flag:
          type: integer
          title: Complete Flag
          description: 'Complete flag, 0: init, 1: complete'
          default: 0
        folder_id:
          type: string
          title: Folder Id
      type: object
      required:
        - created_at
        - updated_at
        - knowledge_id
        - parent_ids
        - folder_id
      title: FolderRead
    ErrorResponse:
      properties:
        code:
          type: integer
          title: Code
        message:
          type: string
          title: Message
      type: object
      required:
        - code
        - message
      title: ErrorResponse
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````