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

# Update document

> Updates the document's `name`, `labels`, or rendered output (`stringDocument` / `structuredDocument`).
Use this to persist edits made to a previously generated document.




## OpenAPI

````yaml /api-reference/auto-generated-openapi.yml patch /documents/{documentID}
openapi: 3.0.0
info:
  title: Corti API
  version: 2.0.0
servers:
  - url: https://api.{environment}.corti.app/v2/
    variables:
      environment:
        default: eu
        enum:
          - us
          - eu
security:
  - AuthorizationHeader:
      - bearer
tags:
  - name: Interactions
  - name: Recordings
  - name: Transcripts
  - name: Facts
  - name: Codes
  - name: Languages
  - name: Guided Documents
  - name: Guided Templates
  - name: Guided Sections
  - name: Documents (Classic)
  - name: Templates (Classic)
paths:
  /documents/{documentID}:
    parameters:
      - $ref: '#/components/parameters/Tenant-Name'
      - $ref: '#/components/parameters/DocumentId'
    patch:
      tags:
        - Guided Documents
      summary: Update document
      description: >
        Updates the document's `name`, `labels`, or rendered output
        (`stringDocument` / `structuredDocument`).

        Use this to persist edits made to a previously generated document.
      operationId: guided_documents_update
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GuidedDocumentsUpdateRequest'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GuidedDocument'
        '400':
          $ref: '#/components/responses/BadRequest'
        '404':
          $ref: '#/components/responses/NotFound'
components:
  parameters:
    Tenant-Name:
      name: Tenant-Name
      in: header
      description: >-
        Identifies a distinct entity within Corti's multi-tenant system. Ensures
        correct routing and authentication of the request.
      required: true
      example: base
      schema:
        type: string
        description: >-
          Identifies a distinct entity within Corti's multi-tenant system.
          Ensures correct routing and authentication of the request.
        example: base
    DocumentId:
      name: documentID
      in: path
      required: true
      schema:
        type: string
        format: uuid
  schemas:
    GuidedDocumentsUpdateRequest:
      type: object
      properties:
        name:
          type: string
        stringDocument:
          type: object
          additionalProperties:
            type: string
        structuredDocument:
          type: object
          additionalProperties: true
        labels:
          type: array
          description: >-
            Replace the document's labels. Omit to leave labels unchanged; pass
            `[]` to clear all labels.
          items:
            $ref: '#/components/schemas/GuidedLabel'
    GuidedDocument:
      type: object
      required:
        - id
        - name
        - templateId
        - templateVersionId
        - language
        - stringDocument
        - labels
        - createdAt
        - updatedAt
      description: A generated document saved to the database.
      properties:
        id:
          type: string
          format: uuid
        name:
          type: string
        templateId:
          type: string
          format: uuid
          description: >
            The template ID used for generation. For a plain `templateRef` with
            no overrides this is the referenced template. For other paths it is
            the newly saved auto-generated template aggregate.
        templateVersionId:
          type: string
          format: uuid
          description: The specific template version that was used for generation.
        language:
          type: string
          description: The BCP 47 language tag of the generated output.
        interactionId:
          type: string
          format: uuid
          nullable: true
          description: >-
            The interaction whose context was used to generate this document, if
            supplied.
        stringDocument:
          type: object
          description: >-
            The generated document as a map of section key to rendered string
            output.
          additionalProperties:
            type: string
        structuredDocument:
          description: The generated document as a structured object keyed by section.
          type: object
          additionalProperties: true
          nullable: true
        labels:
          type: array
          description: Key/value labels attached to this document.
          items:
            $ref: '#/components/schemas/GuidedLabel'
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    GuidedLabel:
      type: object
      required:
        - key
        - value
      properties:
        key:
          type: string
        value:
          type: string
    ErrorResponse:
      type: object
      required:
        - requestid
        - status
        - type
        - detail
      properties:
        requestid:
          type: string
        status:
          type: integer
        type:
          type: string
        detail:
          type: string
        validationErrors:
          type: array
          items:
            type: object
            additionalProperties:
              type: string
  responses:
    BadRequest:
      description: Bad Request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    NotFound:
      description: Not Found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    AuthorizationHeader:
      type: http
      description: Input your token
      scheme: bearer

````