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

# Upload

> Upload content (files, URLs, or text) to a collection.

Args:

    collection_id (str): Required. ID of the collection to upload to.

    file (UploadFile, optional): Single file to upload.

    files (List[UploadFile], optional): Multiple files to upload.

    content (str, optional): Direct text content to upload.
    
    urls (List[str], optional): List of URLs to download and upload.

    content_type (str, optional): Type of content - 'file', 'url', or 'text'. Default: 'file'.

    metadata (Dict[str, Any], optional): Additional metadata to attach to uploaded content.

    label (str, optional): Custom label for the content.
    description (str, optional): Description of the content.
    crawl (bool, optional): Whether to crawl linked content from URLs. Default: False.
    ingest (bool, optional): Whether to ingest content into vector database. Default: True.
        If False, only file metadata is stored. Use POST /v1/chunks/create to ingest later.
    reader (str, optional): Reader to use for processing files. Default: 'native'.

Reader Parameter:
    Controls how uploaded files are processed. Supported formats:
    
    Provider Format:
        - 'native': Use native implementation (default, fastest)
        - 'langchain': Use LangChain readers for all files
        - 'markitdown': Use MarkItDown for universal conversion to markdown
    
    Provider + Type Format:
        - 'langchain_pdfplumber': LangChain with PDFPlumber (better OCR, tables)
        - 'langchain_pypdf': LangChain with PyPDF (faster for text-based PDFs)
    
    Specific Reader:
        - 'pdf', 'csv', 'docx', 'json', 'markdown', 'text'

Returns:
    UploadResponse: Contains upload status, successful uploads, and any errors.
        - collection_id: ID of the collection
        - content_type: Type of content uploaded
        - uploads: List of successfully uploaded content
        - errors: List of failed uploads with error details
        - total_uploads: Total number attempted
        - successful_uploads: Number successful
        - failed_uploads: Number failed

Examples:
    Upload a single file with native reader:
        POST /upload
        Form data:
            - file: document.pdf
            - collection_id: "my_docs"
            - reader: "native"
    
    Upload PowerPoint with MarkItDown (converts to markdown):
        POST /upload
        Form data:
            - file: presentation.pptx
            - collection_id: "presentations"
            - reader: "markitdown"
    
    Upload scanned PDF with better OCR:
        POST /upload
        Form data:
            - file: scanned.pdf
            - collection_id: "scans"
            - reader: "langchain_pdfplumber"
    
    Upload from URLs:
        POST /upload
        Form data:
            - urls: ["https://example.com/doc1.pdf", "https://example.com/doc2.pdf"]
            - collection_id: "web_docs"
            - content_type: "url"
    
    Upload direct text content:
        POST /upload
        Form data:
            - content: "This is my text content"
            - collection_id: "notes"
            - content_type: "text"
            - label: "Quick Note"
    
    Upload file without ingesting (metadata only):
        POST /upload
        Form data:
            - file: document.pdf
            - collection_id: "pending_docs"
            - ingest: false
        Note: Use POST /v1/chunks/create later to ingest content

Raises:
    HTTPException: 403 if collection not accessible

    HTTPException: 400 if invalid parameters
    
    HTTPException: 500 if upload processing fails



## OpenAPI

````yaml api-reference/openapi.json post /api/v1/upload
openapi: 3.1.0
info:
  title: FastAPI app
  version: 0.1.0
servers: []
security: []
paths:
  /api/v1/upload:
    post:
      tags:
        - Content Upload
      summary: Upload
      description: |-
        Upload content (files, URLs, or text) to a collection.

        Args:

            collection_id (str): Required. ID of the collection to upload to.

            file (UploadFile, optional): Single file to upload.

            files (List[UploadFile], optional): Multiple files to upload.

            content (str, optional): Direct text content to upload.
            
            urls (List[str], optional): List of URLs to download and upload.

            content_type (str, optional): Type of content - 'file', 'url', or 'text'. Default: 'file'.

            metadata (Dict[str, Any], optional): Additional metadata to attach to uploaded content.

            label (str, optional): Custom label for the content.
            description (str, optional): Description of the content.
            crawl (bool, optional): Whether to crawl linked content from URLs. Default: False.
            ingest (bool, optional): Whether to ingest content into vector database. Default: True.
                If False, only file metadata is stored. Use POST /v1/chunks/create to ingest later.
            reader (str, optional): Reader to use for processing files. Default: 'native'.

        Reader Parameter:
            Controls how uploaded files are processed. Supported formats:
            
            Provider Format:
                - 'native': Use native implementation (default, fastest)
                - 'langchain': Use LangChain readers for all files
                - 'markitdown': Use MarkItDown for universal conversion to markdown
            
            Provider + Type Format:
                - 'langchain_pdfplumber': LangChain with PDFPlumber (better OCR, tables)
                - 'langchain_pypdf': LangChain with PyPDF (faster for text-based PDFs)
            
            Specific Reader:
                - 'pdf', 'csv', 'docx', 'json', 'markdown', 'text'

        Returns:
            UploadResponse: Contains upload status, successful uploads, and any errors.
                - collection_id: ID of the collection
                - content_type: Type of content uploaded
                - uploads: List of successfully uploaded content
                - errors: List of failed uploads with error details
                - total_uploads: Total number attempted
                - successful_uploads: Number successful
                - failed_uploads: Number failed

        Examples:
            Upload a single file with native reader:
                POST /upload
                Form data:
                    - file: document.pdf
                    - collection_id: "my_docs"
                    - reader: "native"
            
            Upload PowerPoint with MarkItDown (converts to markdown):
                POST /upload
                Form data:
                    - file: presentation.pptx
                    - collection_id: "presentations"
                    - reader: "markitdown"
            
            Upload scanned PDF with better OCR:
                POST /upload
                Form data:
                    - file: scanned.pdf
                    - collection_id: "scans"
                    - reader: "langchain_pdfplumber"
            
            Upload from URLs:
                POST /upload
                Form data:
                    - urls: ["https://example.com/doc1.pdf", "https://example.com/doc2.pdf"]
                    - collection_id: "web_docs"
                    - content_type: "url"
            
            Upload direct text content:
                POST /upload
                Form data:
                    - content: "This is my text content"
                    - collection_id: "notes"
                    - content_type: "text"
                    - label: "Quick Note"
            
            Upload file without ingesting (metadata only):
                POST /upload
                Form data:
                    - file: document.pdf
                    - collection_id: "pending_docs"
                    - ingest: false
                Note: Use POST /v1/chunks/create later to ingest content

        Raises:
            HTTPException: 403 if collection not accessible

            HTTPException: 400 if invalid parameters
            
            HTTPException: 500 if upload processing fails
      operationId: upload_api_v1_upload_post
      parameters:
        - name: X-Workspace-Id
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: The workspace ID
            title: X-Workspace-Id
          description: The workspace ID
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/Body_upload_api_v1_upload_post'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - DualAuthScheme: []
components:
  schemas:
    Body_upload_api_v1_upload_post:
      properties:
        collection_id:
          type: string
          title: Collection Id
        file:
          anyOf:
            - type: string
              format: binary
            - type: 'null'
          title: File
        files:
          anyOf:
            - items:
                type: string
                format: binary
              type: array
            - type: 'null'
          title: Files
        content:
          anyOf:
            - type: string
            - type: 'null'
          title: Content
        urls:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Urls
        content_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Content Type
          default: file
        metadata:
          anyOf:
            - type: string
            - type: 'null'
          title: Metadata
        user_id:
          anyOf:
            - type: string
            - type: 'null'
          title: User Id
        label:
          anyOf:
            - type: string
            - type: 'null'
          title: Label
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
        crawl:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Crawl
          default: false
        ingest:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Ingest
          default: true
        reader:
          anyOf:
            - type: string
            - type: 'null'
          title: Reader
          description: |2-

                    Reader to use for processing files. Supported values:
                    - 'native': Use native implementation (default)
                    - 'langchain': Use LangChain readers for all files
                    - 'markitdown': Use MarkItDown for universal conversion to markdown
                    
                    Provider + Type Format:
                        - 'langchain_pdfplumber': LangChain with PDFPlumber (better OCR, tables)
                        - 'langchain_pypdf': LangChain with PyPDF (faster for text-based PDFs)
                    
                    Specific Reader:
                        - 'pdf', 'csv', 'docx', 'json', 'markdown', 'text'
                
      type: object
      required:
        - collection_id
      title: Body_upload_api_v1_upload_post
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    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
  securitySchemes:
    DualAuthScheme:
      type: http
      scheme: bearer

````