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

# Update Document Text

> Update a document by replacing its text content and queueing re-ingestion.



## OpenAPI

````yaml https://app.stainless.com/api/spec/documented/morphik/openapi.documented.yml post /documents/{document_id}/update_text
openapi: 3.1.0
info:
  title: FastAPI
  version: 0.1.0
servers: []
security: []
paths:
  /documents/{document_id}/update_text:
    post:
      tags:
        - Documents
      summary: Update Document Text
      description: >-
        Update a document by replacing its text content and queueing
        re-ingestion.
      operationId: update_document_text_documents__document_id__update_text_post
      parameters:
        - name: document_id
          in: path
          required: true
          schema:
            type: string
            title: Document Id
        - name: authorization
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Authorization
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/IngestTextRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Document'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      x-codeSamples:
        - lang: JavaScript
          source: >-
            import Morphik from 'morphik';


            const client = new Morphik({
              apiKey: process.env['MORPHIK_API_KEY'], // This is the default and can be omitted
            });


            const document = await client.documents.updateText('document_id', {
            content: 'content' });


            console.log(document.app_id);
        - lang: cURL
          source: |-
            curl https://api.morphik.ai/documents/$DOCUMENT_ID/update_text \
                -H 'Content-Type: application/json' \
                -H "Authorization: Bearer $MORPHIK_API_KEY" \
                -d '{
                      "content": "content"
                    }'
components:
  schemas:
    IngestTextRequest:
      properties:
        content:
          type: string
          title: Content
          description: Raw text content to store as a document.
        filename:
          anyOf:
            - type: string
            - type: 'null'
          title: Filename
          description: >-
            Optional filename hint used when inferring MIME type or displaying
            the document.
        metadata:
          additionalProperties: true
          type: object
          title: Metadata
          description: User-defined metadata stored with the document (JSON-serializable).
        metadata_types:
          anyOf:
            - additionalProperties:
                type: string
              type: object
            - type: 'null'
          title: Metadata Types
          description: >-
            Optional per-field type hints: 'string', 'number', 'decimal',
            'datetime', 'date', 'boolean', 'array', 'object'. Enables typed
            comparisons with $eq, $gt, etc. Types are inferred if omitted.
        use_colpali:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Use Colpali
          description: >-
            When provided, uses Morphik's finetuned ColPali style embeddings
            (recommended to be True for high quality retrieval).
        folder_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Folder Name
          description: Optional folder scope for the operation
        end_user_id:
          anyOf:
            - type: string
            - type: 'null'
          title: End User Id
          description: Optional end-user scope for the operation
      additionalProperties: true
      type: object
      required:
        - content
      title: IngestTextRequest
      description: Request model for ingesting text content
    Document:
      properties:
        external_id:
          type: string
          title: External Id
        content_type:
          type: string
          title: Content Type
        filename:
          anyOf:
            - type: string
            - type: 'null'
          title: Filename
        metadata:
          additionalProperties: true
          type: object
          title: Metadata
        metadata_types:
          additionalProperties:
            type: string
          type: object
          title: Metadata Types
        storage_info:
          additionalProperties: true
          type: object
          title: Storage Info
        system_metadata:
          additionalProperties: true
          type: object
          title: System Metadata
        additional_metadata:
          additionalProperties: true
          type: object
          title: Additional Metadata
        chunk_ids:
          items:
            type: string
          type: array
          title: Chunk Ids
        summary_storage_key:
          anyOf:
            - type: string
            - type: 'null'
          title: Summary Storage Key
        summary_version:
          anyOf:
            - type: integer
            - type: 'null'
          title: Summary Version
        summary_bucket:
          anyOf:
            - type: string
            - type: 'null'
          title: Summary Bucket
        summary_updated_at:
          anyOf:
            - type: string
            - type: 'null'
          title: Summary Updated At
        folder_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Folder Name
        end_user_id:
          anyOf:
            - type: string
            - type: 'null'
          title: End User Id
        app_id:
          anyOf:
            - type: string
            - type: 'null'
          title: App Id
        folder_path:
          anyOf:
            - type: string
            - type: 'null'
          title: Folder Path
        folder_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Folder Id
      type: object
      required:
        - content_type
      title: Document
      description: Represents a document stored in the database documents collection
    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

````