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

# Update Document

> Update an existing document's status, error message, or metadata



## OpenAPI

````yaml api/openapi.json patch /api/documents/{id}
openapi: 3.1.0
info:
  version: '0.1'
  title: Orchata API
servers:
  - url: https://api.orchata.ai
    description: Orchata API Server
security:
  - ApiKey: []
paths:
  /api/documents/{id}:
    patch:
      tags:
        - Documents
      summary: Update Document
      description: Update an existing document's status, error message, or metadata
      parameters:
        - schema:
            type: string
            example: document_123
          required: true
          name: id
          in: path
      requestBody:
        description: Document update data
        content:
          application/json:
            schema:
              type: object
              properties:
                status:
                  type: string
                  enum:
                    - PENDING
                    - PROCESSING
                    - COMPLETED
                    - FAILED
                errorMessage:
                  type:
                    - string
                    - 'null'
                metadata:
                  type: object
                  additionalProperties: {}
                content:
                  type: string
                  minLength: 1
                  maxLength: 10000000
                spaceId:
                  type: string
                  description: The ID of the space containing the document
                  example: space_123
              required:
                - spaceId
      responses:
        '200':
          description: Document updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  document:
                    type: object
                    properties:
                      id:
                        type: string
                      orgId:
                        type: string
                      spaceId:
                        type: string
                      filename:
                        type: string
                      mimeType:
                        type: string
                      fileSize:
                        type: string
                      storageUrl:
                        type: string
                      status:
                        type: string
                      errorMessage:
                        type:
                          - string
                          - 'null'
                      embeddingModel:
                        type: string
                      indexingType:
                        type: string
                      metadata: {}
                      createdAt:
                        type: string
                        format: date-time
                      updatedAt:
                        type: string
                        format: date-time
                    required:
                      - id
                      - orgId
                      - spaceId
                      - filename
                      - mimeType
                      - fileSize
                      - storageUrl
                      - status
                      - errorMessage
                      - embeddingModel
                      - indexingType
                      - createdAt
                      - updatedAt
                required:
                  - document
        '404':
          description: Document not found
components:
  securitySchemes:
    ApiKey:
      type: apiKey
      in: header
      name: Oai-Api-Key

````