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

# Replace document text

> Edit a document by replacing exact text.

**Operation ID:** `http.documents.edit`

```http theme={null}
POST /v1/orgs/{org}/projects/{project}/files/document-edits
```


## OpenAPI

````yaml openapi.json POST /v1/orgs/{org}/projects/{project}/files/document-edits
openapi: 3.1.0
info:
  title: Penumbra API
  version: v1
  description: >-
    HTTP reference for Files, search, extraction, reviews, Graph, Shapes and
    sharing.
servers:
  - url: https://api.pnbr.io
    description: Penumbra API
security: []
paths:
  /v1/orgs/{org}/projects/{project}/files/document-edits:
    post:
      tags:
        - Documents
      summary: Replace document text
      description: |-
        Edit a document by replacing exact text.

        Product guidance: [Document](/concepts/document).
      operationId: http.documents.edit
      parameters:
        - name: org
          in: path
          required: true
          schema:
            type: string
        - name: project
          in: path
          required: true
          schema:
            type: string
        - name: Idempotency-Key
          in: header
          required: true
          description: >-
            1–200 printable ASCII characters, no surrounding spaces; '.' and
            '..' are reserved. Reuse this key with the same request when
            retrying an uncertain outcome.
          schema:
            type: string
            minLength: 1
            maxLength: 200
            pattern: ^(?!\.{1,2}$)[!-~](?:[ -~]*[!-~])?$
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/http_documents_edit_request'
      responses:
        2XX:
          description: Success.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/http_documents_edit_response'
      security:
        - bearerAuth: []
components:
  schemas:
    http_documents_edit_request:
      anyOf:
        - type: object
          properties:
            path:
              type: string
            expected_version_id:
              type: string
              pattern: >-
                ^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$
            edits:
              minItems: 1
              maxItems: 50
              type: array
              items:
                type: object
                properties:
                  old_text:
                    type: string
                  new_text:
                    type: string
                  replace_all:
                    type: boolean
                required:
                  - old_text
                  - new_text
                additionalProperties: false
          required:
            - path
            - expected_version_id
            - edits
          additionalProperties: false
        - type: object
          properties:
            path:
              type: string
            expected_version_id:
              type: string
              pattern: >-
                ^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$
            markdown:
              type: string
          required:
            - path
            - expected_version_id
            - markdown
          additionalProperties: false
    http_documents_edit_response:
      anyOf:
        - type: object
          properties:
            request_id:
              type: string
            outcome:
              type: string
              const: applied
            replayed:
              type: boolean
            data:
              type: object
              properties:
                mode:
                  type: string
                  const: managed_atomic
                outcome:
                  type: string
                  const: applied
                replayed:
                  type: boolean
                request_id:
                  type: string
                delta_id:
                  type: string
                save_id:
                  type: string
                file_operation_id:
                  type: string
                file_id:
                  type: string
                node_id:
                  type: string
                canonical_path:
                  type: string
                base_version_id:
                  type: string
                committed_version_id:
                  type: string
                semantic_status:
                  type: string
                  enum:
                    - pending
                    - not_requested
                    - not_applicable
                lineage:
                  type: array
                  items:
                    type: object
                    properties:
                      type:
                        type: string
                        enum:
                          - created
                          - edited
                          - moved
                          - split
                          - merged
                          - duplicated
                          - deleted
                          - restored
                      from:
                        type: array
                        items:
                          type: string
                      to:
                        type: array
                        items:
                          type: string
                    required:
                      - type
                      - from
                      - to
                    additionalProperties: {}
                changed_blocks:
                  type: array
                  items:
                    type: object
                    properties:
                      block_id:
                        type: string
                      content_fingerprint:
                        anyOf:
                          - type: string
                          - type: 'null'
                    required:
                      - block_id
                      - content_fingerprint
                    additionalProperties: {}
                timings_ms:
                  type: object
                  propertyNames:
                    type: string
                  additionalProperties:
                    type: number
              required:
                - mode
                - outcome
                - replayed
                - request_id
                - delta_id
                - save_id
                - file_operation_id
                - file_id
                - node_id
                - canonical_path
                - base_version_id
                - committed_version_id
                - semantic_status
                - lineage
                - changed_blocks
                - timings_ms
              additionalProperties: {}
          required:
            - request_id
            - outcome
            - replayed
            - data
          additionalProperties: {}
        - type: object
          properties:
            request_id:
              type: string
            outcome:
              type: string
              const: unchanged
            replayed:
              type: boolean
              const: false
            data:
              type: object
              properties:
                path:
                  type: string
                version_id:
                  type: string
              required:
                - path
                - version_id
              additionalProperties: {}
          required:
            - request_id
            - outcome
            - replayed
            - data
          additionalProperties: {}
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````

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