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

# Create Knowledge File

> Create a new knowledge file and initialize chunked upload.



## OpenAPI

````yaml /openapi.json post /v1/knowledge-files
openapi: 3.1.0
info:
  title: FastAPI
  version: 0.1.0
servers:
  - url: https://api.bey.dev
security: []
paths:
  /v1/knowledge-files:
    post:
      tags:
        - Knowledge Files
      summary: Create Knowledge File
      description: Create a new knowledge file and initialize chunked upload.
      operationId: create_knowledge_file_v1_knowledge_files_post
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateKnowledgeFileRequest'
      responses:
        '201':
          description: Created Knowledge File
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/KnowledgeFileResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyHeader: []
components:
  schemas:
    CreateKnowledgeFileRequest:
      oneOf:
        - $ref: '#/components/schemas/CreateTextKnowledgeFileRequest'
        - $ref: '#/components/schemas/CreatePdfKnowledgeFileRequest'
      discriminator:
        propertyName: format
        mapping:
          pdf:
            $ref: '#/components/schemas/CreatePdfKnowledgeFileRequest'
          text:
            $ref: '#/components/schemas/CreateTextKnowledgeFileRequest'
    KnowledgeFileResponse:
      oneOf:
        - $ref: '#/components/schemas/ToUploadKnowledgeFileResponse'
        - $ref: '#/components/schemas/AvailableKnowledgeFileResponse'
      discriminator:
        propertyName: status
        mapping:
          available:
            $ref: '#/components/schemas/AvailableKnowledgeFileResponse'
          to-upload:
            $ref: '#/components/schemas/ToUploadKnowledgeFileResponse'
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    CreateTextKnowledgeFileRequest:
      properties:
        name:
          type: string
          maxLength: 100
          minLength: 1
          title: Name
          examples:
            - Hitchhiker's Guide to the Galaxy
        format:
          type: string
          const: text
          title: Format
        content:
          type: string
          maxLength: 100000
          minLength: 1
          title: Content
      type: object
      required:
        - name
        - format
        - content
      title: CreateTextKnowledgeFileRequest
      description: Request model for creating a text knowledge file.
    CreatePdfKnowledgeFileRequest:
      properties:
        name:
          type: string
          maxLength: 100
          minLength: 1
          title: Name
          examples:
            - Hitchhiker's Guide to the Galaxy
        format:
          type: string
          const: pdf
          title: Format
        upload_num_chunks:
          type: integer
          maximum: 1000
          exclusiveMinimum: 0
          title: Upload Num Chunks
      type: object
      required:
        - name
        - format
        - upload_num_chunks
      title: CreatePdfKnowledgeFileRequest
      description: Request model for creating a PDF knowledge file.
    ToUploadKnowledgeFileResponse:
      properties:
        id:
          type: string
          title: Id
          description: Unique identifier of the object in the database.
          examples:
            - 01234567-89ab-cdef-0123-456789abcdef
        name:
          type: string
          maxLength: 100
          minLength: 1
          title: Name
          examples:
            - Hitchhiker's Guide to the Galaxy
        format:
          $ref: '#/components/schemas/KnowledgeFileFormat'
        status:
          type: string
          const: to-upload
          title: Status
          default: to-upload
      type: object
      required:
        - id
        - name
        - format
      title: ToUploadKnowledgeFileResponse
      description: Response model for a knowledge file that is to be uploaded.
    AvailableKnowledgeFileResponse:
      properties:
        id:
          type: string
          title: Id
          description: Unique identifier of the object in the database.
          examples:
            - 01234567-89ab-cdef-0123-456789abcdef
        name:
          type: string
          maxLength: 100
          minLength: 1
          title: Name
          examples:
            - Hitchhiker's Guide to the Galaxy
        format:
          $ref: '#/components/schemas/KnowledgeFileFormat'
        status:
          type: string
          const: available
          title: Status
          default: available
        text:
          type: string
          title: Text
      type: object
      required:
        - id
        - name
        - format
        - text
      title: AvailableKnowledgeFileResponse
      description: Response model for an available knowledge file.
    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
    KnowledgeFileFormat:
      type: string
      enum:
        - text
        - pdf
      title: KnowledgeFileFormat
      description: Format of the knowledge file.
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      description: Your Beyond Presence API Key.
      in: header
      name: x-api-key

````