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

# Upload Document

> Upload one or more documents (up to 10 files)



## OpenAPI

````yaml api-reference/openapi.json post /document/upload
openapi: 3.0.0
info:
  title: Stax API
  version: 1.0.0
  description: API for Stax automated document classifier and trust accounting system
  contact:
    name: Stax.ai
    url: https://stax.ai
servers:
  - url: https://api.stax.ai
    description: Production server
security: []
paths:
  /document/upload:
    post:
      tags:
        - Document
      summary: Upload Document
      description: Upload one or more documents (up to 10 files)
      operationId: documentUpload
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                files:
                  type: array
                  items:
                    type: string
                    format: binary
                  maxItems: 10
                  description: Files to upload
                stackId:
                  $ref: '#/components/schemas/ObjectId'
                source:
                  type: string
                  default: Uploaded
                metadata:
                  type: string
                  description: JSON string of metadata array
                importKey:
                  type: string
                skipProcessing:
                  type: boolean
                  description: Skip document processing
      responses:
        '200':
          description: Documents uploaded successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  uploads:
                    type: array
                    items:
                      $ref: '#/components/schemas/Document'
        '400':
          $ref: '#/components/responses/Error'
      security:
        - cookieAuth: []
        - bearerAuth: []
        - moduleAuth: []
components:
  schemas:
    ObjectId:
      type: string
      pattern: ^[0-9a-fA-F]{24}$
      description: MongoDB ObjectId
    Document:
      type: object
      properties:
        _id:
          $ref: '#/components/schemas/ObjectId'
        team:
          $ref: '#/components/schemas/ObjectId'
        stack:
          $ref: '#/components/schemas/ObjectId'
        name:
          type: string
        originalName:
          type: string
        format:
          type: string
        download:
          type: string
        thumbnail:
          type: string
        source:
          type: string
        sourceUrl:
          type: string
        provider:
          type: object
        importKey:
          type: string
        pages:
          type: array
          items:
            type: string
        rotations:
          type: object
        aspects:
          type: object
        job:
          $ref: '#/components/schemas/DocumentJob'
        urgent:
          type: boolean
        deadline:
          type: string
          format: date-time
        flagged:
          type: boolean
        pinned:
          type: boolean
        flags:
          type: array
          items:
            $ref: '#/components/schemas/DocumentFlag'
        reviewed:
          type: boolean
        archived:
          type: boolean
        assignee:
          $ref: '#/components/schemas/ObjectId'
        sharing:
          $ref: '#/components/schemas/DocumentSharing'
        checksum:
          type: string
        metadata:
          type: array
          items:
            $ref: '#/components/schemas/Metadata'
        fillable:
          $ref: '#/components/schemas/Fillable'
        keywords:
          type: array
          items:
            type: string
        bounds:
          type: array
          items:
            $ref: '#/components/schemas/Bound'
        tables:
          type: array
          items:
            $ref: '#/components/schemas/Table'
        split:
          type: array
          items:
            $ref: '#/components/schemas/Split'
        notes:
          type: array
          items:
            $ref: '#/components/schemas/DocumentNote'
        canvas:
          type: object
        bulk:
          type: boolean
        original:
          $ref: '#/components/schemas/ObjectId'
        splitFrom:
          $ref: '#/components/schemas/ObjectId'
        attachments:
          type: array
          items:
            $ref: '#/components/schemas/Attachment'
        time:
          type: array
          items:
            $ref: '#/components/schemas/TimeEvent'
        viewed:
          type: object
        sync:
          type: array
          items:
            $ref: '#/components/schemas/SyncInfo'
        receivedOn:
          type: string
          format: date-time
        lastModified:
          type: string
          format: date-time
        nextStack:
          $ref: '#/components/schemas/ObjectId'
        sender:
          type: string
    DocumentJob:
      type: object
      properties:
        upload:
          type: string
        working:
          type: boolean
        worker:
          type: string
        status:
          type: string
        success:
          type: boolean
        error:
          type: string
        read:
          $ref: '#/components/schemas/ReadInfo'
        rc:
          $ref: '#/components/schemas/RCInfo'
    DocumentFlag:
      type: object
      properties:
        timestamp:
          type: string
          format: date-time
        title:
          type: string
        description:
          type: string
        level:
          type: string
          enum:
            - info
            - warn
            - error
        pages:
          type: array
          items:
            type: number
    DocumentSharing:
      type: object
      properties:
        public:
          type: boolean
        protected:
          $ref: '#/components/schemas/ProtectedSharing'
        access:
          type: array
          items:
            $ref: '#/components/schemas/AccessRecord'
    Metadata:
      type: object
      properties:
        key:
          type: string
        value:
          type: string
        expression:
          type: string
        class:
          type: string
        tags:
          type: array
          items:
            type: number
        pages:
          type: array
          items:
            type: number
        ref:
          type: string
        confidence:
          type: number
    Fillable:
      type: object
      properties:
        enabled:
          type: boolean
        fields:
          type: array
          items:
            $ref: '#/components/schemas/FillableField'
        recipients:
          type: array
          items:
            $ref: '#/components/schemas/Recipient'
    Bound:
      type: object
      properties:
        label:
          type: string
        data:
          type: object
        page:
          type: number
        x:
          type: number
        'y':
          type: number
        width:
          type: number
        height:
          type: number
    Table:
      type: object
      properties:
        raw:
          type: boolean
        title:
          type: string
        lastModified:
          type: string
          format: date-time
        createdON:
          type: string
          format: date-time
        page:
          type: number
        x:
          type: number
        'y':
          type: number
        width:
          type: number
        height:
          type: number
        headers:
          type: array
          items:
            type: string
        tags:
          type: array
          items:
            $ref: '#/components/schemas/TableTag'
        rows:
          type: array
          items:
            $ref: '#/components/schemas/TableRow'
    Split:
      type: object
      properties:
        pages:
          type: array
          items:
            type: number
        toNext:
          type: boolean
        name:
          type: string
    DocumentNote:
      type: object
      properties:
        page:
          type: number
        thread:
          type: array
          items:
            $ref: '#/components/schemas/NoteThread'
        tags:
          type: array
          items:
            $ref: '#/components/schemas/ObjectId'
        x:
          type: number
        'y':
          type: number
    Attachment:
      type: object
      properties:
        filename:
          type: string
        document:
          $ref: '#/components/schemas/ObjectId'
        filepath:
          type: string
    TimeEvent:
      type: object
      properties:
        event:
          type: string
        stamp:
          type: string
          format: date-time
        user:
          $ref: '#/components/schemas/ObjectId'
    SyncInfo:
      type: object
      properties:
        user:
          $ref: '#/components/schemas/ObjectId'
        key:
          type: string
        path:
          type: string
        override:
          type: boolean
        error:
          type: string
        step:
          type: string
        job:
          type: string
        isSynced:
          type: boolean
        queuedOn:
          type: string
          format: date-time
        syncedOn:
          type: string
          format: date-time
    Error:
      type: object
      properties:
        success:
          type: boolean
          example: false
        error:
          type: string
          description: Error message
        authError:
          type: boolean
          description: Indicates if this is an authentication error
      required:
        - success
        - error
    ReadInfo:
      type: object
      properties:
        operationUrls:
          type: array
          items:
            type: string
        fetchTime:
          type: string
          format: date-time
    RCInfo:
      type: object
      properties:
        preproc:
          type: string
        sort:
          type: string
        postproc:
          type: string
    ProtectedSharing:
      type: object
      properties:
        emails:
          type: array
          items:
            type: string
        teams:
          type: array
          items:
            $ref: '#/components/schemas/ObjectId'
        password:
          type: string
    AccessRecord:
      type: object
      properties:
        email:
          type: string
        usage:
          type: number
    FillableField:
      type: object
      properties:
        key:
          type: string
        required:
          type: boolean
        hint:
          type: string
        dataType:
          type: string
          enum:
            - textbox
            - textarea
            - date
            - today
            - checkbox
            - signature
        fontSize:
          type: number
        page:
          type: number
        x:
          type: number
        'y':
          type: number
        width:
          type: number
        height:
          type: number
    Recipient:
      type: object
      properties:
        document:
          $ref: '#/components/schemas/ObjectId'
        email:
          type: string
        name:
          type: string
        sentOn:
          type: string
          format: date-time
        viewedOn:
          type: string
          format: date-time
        filledOn:
          type: string
          format: date-time
    TableTag:
      type: object
      properties:
        row:
          type: number
        col:
          type: number
        key:
          type: string
    TableRow:
      type: object
      properties:
        x:
          type: number
        'y':
          type: number
        width:
          type: number
        height:
          type: number
        page:
          type: number
        cells:
          type: array
          items:
            $ref: '#/components/schemas/TableCell'
        class:
          type: string
        classConfidence:
          type: number
    NoteThread:
      type: object
      properties:
        text:
          type: string
        user:
          $ref: '#/components/schemas/ObjectId'
        timestamp:
          type: string
          format: date-time
    TableCell:
      type: object
      properties:
        x:
          type: number
        'y':
          type: number
        width:
          type: number
        height:
          type: number
        text:
          type: string
        confidence:
          type: number
  responses:
    Error:
      description: Error response
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    cookieAuth:
      type: apiKey
      in: cookie
      name: authToken
      description: Cookie-based authentication using userId and authToken cookies
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: >-
        Bearer token authentication requires two headers: 1) Authorization
        header with 'Bearer {apiKey}' format, and 2) email header with the
        user's email address for identification.
    moduleAuth:
      type: apiKey
      in: header
      name: module
      description: Module authentication using module ID header and Bearer token

````