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

# Upload Document To Editor

> Upload a document file and load it into the editor.

Converts the file to HTML with formatting preserved (tables, colors, images).
Images are extracted to cloud storage and referenced by URL.
Returns the HTML for the editor to display.

AI indexing happens automatically on the first chat message.
For API clients who want immediate indexing, pass ?index=true.



## OpenAPI

````yaml /openapi.json post /v1/documents/upload
openapi: 3.1.0
info:
  title: Universal Document AI API
  description: AI-powered document editing with multi-tenant organization support
  version: 2.0.0
servers: []
security: []
paths:
  /v1/documents/upload:
    post:
      tags:
        - v1
        - documents
      summary: Upload Document To Editor
      description: >-
        Upload a document file and load it into the editor.


        Converts the file to HTML with formatting preserved (tables, colors,
        images).

        Images are extracted to cloud storage and referenced by URL.

        Returns the HTML for the editor to display.


        AI indexing happens automatically on the first chat message.

        For API clients who want immediate indexing, pass ?index=true.
      operationId: upload_document_to_editor
      parameters:
        - name: index
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: >-
              Set to 'true' for immediate AI indexing (API clients). Default:
              conversion only.
            title: Index
          description: >-
            Set to 'true' for immediate AI indexing (API clients). Default:
            conversion only.
        - name: authorization
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Authorization
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/Body_upload_document_to_editor'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    Body_upload_document_to_editor:
      properties:
        file:
          type: string
          format: binary
          title: File
        session_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Session Id
        open_mode:
          anyOf:
            - type: string
            - type: 'null'
          title: Open Mode
          default: replace
      type: object
      required:
        - file
      title: Body_upload_document_to_editor
    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:
    HTTPBearer:
      type: http
      scheme: bearer

````