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

# Re-apply the AI's intended edit on top of the user's current version of one section.

> Resolve a concurrent-edit conflict on ONE section. When a user edited a section while the AI
was also changing it, this re-applies the AI's intended change on top of the user's current text
(mode="redo"), or blends the user's and AI's versions into one (mode="merge"). Returns only the
rewritten section HTML. Performs one AI edit and counts as one billable operation.



## OpenAPI

````yaml /openapi.json post /v1/sessions/{session_id}/chunks/{chunk_id}/re-edit
openapi: 3.1.0
info:
  title: Universal Document AI API
  description: AI-powered document editing with multi-tenant organization support
  version: 2.0.0
servers: []
security: []
paths:
  /v1/sessions/{session_id}/chunks/{chunk_id}/re-edit:
    post:
      tags:
        - v1
        - sessions
      summary: >-
        Re-apply the AI's intended edit on top of the user's current version of
        one section.
      description: >-
        Resolve a concurrent-edit conflict on ONE section. When a user edited a
        section while the AI

        was also changing it, this re-applies the AI's intended change on top of
        the user's current text

        (mode="redo"), or blends the user's and AI's versions into one
        (mode="merge"). Returns only the

        rewritten section HTML. Performs one AI edit and counts as one billable
        operation.
      operationId: re_edit_chunk_on_user_version
      parameters:
        - name: session_id
          in: path
          required: true
          schema:
            type: string
            title: Session Id
        - name: chunk_id
          in: path
          required: true
          schema:
            type: string
            title: Chunk 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/ReEditChunkRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReEditChunkResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    ReEditChunkRequest:
      properties:
        user_current_html:
          type: string
          title: User Current Html
        ai_original_old_html:
          anyOf:
            - type: string
            - type: 'null'
          title: Ai Original Old Html
        ai_proposed_new_html:
          anyOf:
            - type: string
            - type: 'null'
          title: Ai Proposed New Html
        ai_explanation:
          anyOf:
            - type: string
            - type: 'null'
          title: Ai Explanation
        model_tier:
          anyOf:
            - type: string
            - type: 'null'
          title: Model Tier
        mode:
          anyOf:
            - type: string
            - type: 'null'
          title: Mode
          default: redo
      type: object
      required:
        - user_current_html
      title: ReEditChunkRequest
      description: >-
        Re-apply the AI's intended change on the user's current section HTML, OR
        (mode='merge')

        combine the user's version and the AI's version into one.
    ReEditChunkResponse:
      properties:
        chunk_id:
          type: string
          title: Chunk Id
        new_html:
          anyOf:
            - type: string
            - type: 'null'
          title: New Html
        error:
          anyOf:
            - type: string
            - type: 'null'
          title: Error
      type: object
      required:
        - chunk_id
      title: ReEditChunkResponse
    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
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````