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

# Update Document

> Update a [knowledge base](/line/knowledge-base) document's name, content, metadata, or folder



## OpenAPI

````yaml /latest.yml PATCH /agents/documents/{document_id}
openapi: 3.0.1
info:
  title: Cartesia API
  version: 0.0.1
servers:
  - url: https://api.cartesia.ai
    description: Production
security: []
paths:
  /agents/documents/{document_id}:
    patch:
      tags:
        - Documents
      summary: Update Document
      description: >-
        Update a [knowledge base](/line/knowledge-base) document's name,
        content, metadata, or folder
      operationId: documents_update
      parameters:
        - $ref: '#/components/parameters/CartesiaVersionHeader'
        - name: document_id
          in: path
          description: The ID of the document.
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateDocumentBody'
      responses:
        '200':
          description: Document updated.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DocumentResponse'
        '404':
          description: >-
            Document not found (`error_code: kb_document_not_found`) or target
            folder not found (`error_code: kb_folder_not_found`).
        '413':
          description: Document content exceeds the 1 MB limit.
      security:
        - APIKeyAuth: []
components:
  parameters:
    CartesiaVersionHeader:
      name: Cartesia-Version
      in: header
      description: API version header.
      required: true
      schema:
        type: string
        format: date
        example: '2026-03-01'
        enum:
          - '2026-03-01'
  schemas:
    UpdateDocumentBody:
      title: UpdateDocumentBody
      type: object
      description: Fields to update on a document
      properties:
        content:
          type: string
          minLength: 1
          description: |-
            New document text. Maximum 1 MB.
            Updating this property triggers re-indexing of the document.
        name:
          type: string
          nullable: true
          description: New display name. Pass `null` to clear.
        metadata:
          type: object
          additionalProperties:
            type: string
          description: |-
            Replacement metadata map.
            Updating this property triggers re-indexing of the document.
        folder_id:
          type: string
          description: Move the document to a different folder.
    DocumentResponse:
      title: DocumentResponse
      type: object
      properties:
        id:
          type: string
          description: The ID of the document.
        name:
          type: string
          nullable: true
          description: The document's display name, or `null` if unnamed.
        content:
          type: string
          description: The full document text.
        created_at:
          type: string
          format: date-time
          description: When the document was uploaded.
        metadata:
          type: object
          additionalProperties:
            type: string
          description: User-defined string-keyed metadata.
      required:
        - id
        - name
        - content
        - created_at
        - metadata
  securitySchemes:
    APIKeyAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: >-
        Cartesia API key (`sk_car_...`). Get one at
        [play.cartesia.ai/keys](https://play.cartesia.ai/keys).

````