Contents

Replace text as a tracked change

find_text must match existing document text (smart quotes, dashes, and whitespace are normalized before matching). Ambiguous matches are rejected; pass replace_all or occurrence to choose a scope.

POST /documents/{documentId}/edits/find-and-replace

Path parameters

  • documentId string Required

Headers

  • Authorization string Required

    Bearer <session token>: the signed-in user’s Scaffold session token.

  • x-org-id string Required

Body

  • find_text string Required
  • replacement_text string Required
  • replace_all boolean

    Default false

  • occurrence integer

    1-based occurrence to replace when find_text matches more than once.

  • justification string

    Shown to the human reviewer alongside the tracked change.

  • preserve_run_style boolean

    Default true

  • author string

Returns

  • document object

    The persisted upload/document row, as returned by every route that creates or mutates upload content (create, save draft, rename, delete, new version, revision-apply, redline edits).

    Show 19 fields
    • id string
    • artifactId string | null
    • orgId string
    • createdByUserId string | null
    • fileName string
    • mimeType string
    • sizeBytes integer
    • purpose string

      One of source_doc playbook

    • clientReferenceId string | null
    • documentSeriesId string
    • documentVersion integer
    • parentUploadId string | null
    • versionKind string

      One of original working_draft

    • storageKey string | null
    • contentSha256 string | null
    • hasBinary boolean
    • status string
    • createdAt string
    • updatedAt string
  • replacements integer
  • revisions object[]
    Show 7 fields
    • ordinal integer Required

      The change's position in document order.

    • change_id string Required

      The id to pass in accepted_change_ids or rejected_change_ids.

    • kind string Required

      insert and delete are text changes, paragraph_mark is an inserted or deleted paragraph mark (a paragraph split or join; it carries no text of its own), proposed is a Scaffold change marker, and the -prop-change kinds are tracked formatting or structure changes.

      One of insert delete paragraph_mark proposed r-prop-change p-prop-change tbl-prop-change tr-prop-change tc-prop-change sect-prop-change

    • author string | null
    • date string | null
    • text_preview string Required

      A short excerpt of the changed text.

    • justification string | null

      The reason recorded with the change, shown to the reviewer.

  • redlinePreview object