> ## 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.

# Update Document

> Update document properties and metadata



## OpenAPI

````yaml api-reference/openapi.json post /document/update
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/update:
    post:
      tags:
        - Document
      summary: Update Document
      description: Update document properties and metadata
      operationId: documentUpdate
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - docDiff
              properties:
                docId:
                  $ref: '#/components/schemas/ObjectId'
                  description: Single document ID
                docIds:
                  type: array
                  items:
                    $ref: '#/components/schemas/ObjectId'
                  description: Multiple document IDs for bulk update
                docDiff:
                  type: object
                  description: Fields to update
                  properties:
                    name:
                      type: string
                    stack:
                      $ref: '#/components/schemas/ObjectId'
                    metadata:
                      type: array
                      items:
                        $ref: '#/components/schemas/Metadata'
                    tables:
                      type: array
                      items:
                        $ref: '#/components/schemas/Table'
                    reviewed:
                      type: boolean
                    archived:
                      type: boolean
                    urgent:
                      type: boolean
                    flagged:
                      type: boolean
                    pinned:
                      type: boolean
                    assignee:
                      $ref: '#/components/schemas/ObjectId'
                    deadline:
                      type: string
                      format: date-time
                    sharing:
                      $ref: '#/components/schemas/DocumentSharing'
                    notes:
                      type: array
                      items:
                        $ref: '#/components/schemas/DocumentNote'
                    sync:
                      type: array
                      items:
                        $ref: '#/components/schemas/SyncInfo'
                    indexStatement:
                      type: boolean
                      description: Create TPA statement from metadata
      responses:
        '200':
          description: Document updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SuccessResponse'
        '400':
          $ref: '#/components/responses/Error'
      security:
        - cookieAuth: []
        - bearerAuth: []
        - moduleAuth: []
components:
  schemas:
    ObjectId:
      type: string
      pattern: ^[0-9a-fA-F]{24}$
      description: MongoDB ObjectId
    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
    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'
    DocumentSharing:
      type: object
      properties:
        public:
          type: boolean
        protected:
          $ref: '#/components/schemas/ProtectedSharing'
        access:
          type: array
          items:
            $ref: '#/components/schemas/AccessRecord'
    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
    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
    SuccessResponse:
      type: object
      properties:
        success:
          type: boolean
          example: true
      required:
        - success
    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
    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
    NoteThread:
      type: object
      properties:
        text:
          type: string
        user:
          $ref: '#/components/schemas/ObjectId'
        timestamp:
          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
    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

````