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

# Replace document content and re-index

> Replace editable document content using expected_file_hash from the read response. A stale hash or processing conflict returns 409. Re-indexing runs asynchronously; prior content remains available until replacement succeeds.



## OpenAPI

````yaml /api-reference/openapi.json put /api/v1/knowledge-base/documents/{document_uuid}/content
openapi: 3.1.0
info:
  title: Athena API
  version: 1.0.0
  description: >-
    Hosted Athena customer API. Authenticate backend management and call-trigger
    requests with X-API-Key. Website embeds and artifact playback use their own
    scoped tokens. Provider availability, feature settings, and verification
    limits are described in the guides.
servers:
  - url: https://athena.tryopencomputer.com
    description: Hosted Athena API
security: []
paths:
  /api/v1/knowledge-base/documents/{document_uuid}/content:
    put:
      tags:
        - Knowledge Base
      summary: Replace document content and re-index
      description: >-
        Replace editable document content using expected_file_hash from the read
        response. A stale hash or processing conflict returns 409. Re-indexing
        runs asynchronously; prior content remains available until replacement
        succeeds.
      operationId: >-
        save_document_content_api_v1_knowledge_base_documents__document_uuid__content_put
      parameters:
        - name: document_uuid
          in: path
          required: true
          schema:
            type: string
            title: Document Uuid
        - name: authorization
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Authorization
        - name: X-API-Key
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-Api-Key
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DocumentContentUpdateRequestSchema'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DocumentResponseSchema'
        '400':
          description: Bad Request
        '401':
          description: Authentication is missing or invalid.
        '404':
          description: Not found
        '409':
          description: Conflict
        '413':
          description: Content Too Large
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '500':
          description: Internal Server Error
      security:
        - ApiKeyAuth: []
        - BearerAuth: []
components:
  schemas:
    DocumentContentUpdateRequestSchema:
      properties:
        content:
          type: string
          title: Content
          description: New full text of the document
        expected_file_hash:
          type: string
          title: Expected File Hash
          description: >-
            file_hash returned when the content was loaded. The save is rejected
            if the document has changed since.
      type: object
      required:
        - content
        - expected_file_hash
      title: DocumentContentUpdateRequestSchema
      description: Request schema for replacing an editable document's text.
    DocumentResponseSchema:
      properties:
        id:
          type: integer
          title: Id
        document_uuid:
          type: string
          title: Document Uuid
        filename:
          type: string
          title: Filename
        file_size_bytes:
          type: integer
          title: File Size Bytes
        file_hash:
          type: string
          title: File Hash
        mime_type:
          type: string
          title: Mime Type
        processing_status:
          type: string
          title: Processing Status
        processing_error:
          anyOf:
            - type: string
            - type: 'null'
          title: Processing Error
        total_chunks:
          type: integer
          title: Total Chunks
        retrieval_mode:
          type: string
          title: Retrieval Mode
          default: chunked
        custom_metadata:
          additionalProperties: true
          type: object
          title: Custom Metadata
        docling_metadata:
          additionalProperties: true
          type: object
          title: Docling Metadata
        source_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Source Url
        created_at:
          type: string
          format: date-time
          title: Created At
        updated_at:
          type: string
          format: date-time
          title: Updated At
        organization_id:
          type: integer
          title: Organization Id
        created_by:
          type: integer
          title: Created By
        is_active:
          type: boolean
          title: Is Active
        has_live_content:
          type: boolean
          title: Has Live Content
          description: >-
            Whether agents can currently retrieve this document's content. Stays
            true while an edited document is re-indexed or after its re-index
            fails, because the previous version keeps serving until a new one
            succeeds.
          default: false
      type: object
      required:
        - id
        - document_uuid
        - filename
        - file_size_bytes
        - file_hash
        - mime_type
        - processing_status
        - total_chunks
        - custom_metadata
        - docling_metadata
        - created_at
        - updated_at
        - organization_id
        - created_by
        - is_active
      title: DocumentResponseSchema
      description: Response schema for document metadata.
    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
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
    BearerAuth:
      type: http
      scheme: bearer

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.