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.
/documents/{documentId}/edits/find-and-replace Path parameters
documentIdstring Required
Headers
Authorizationstring RequiredBearer <session token>: the signed-in user’s Scaffold session token.
x-org-idstring Required
Body
find_textstring Requiredreplacement_textstring Requiredreplace_allbooleanDefault
falseoccurrenceinteger1-based occurrence to replace when find_text matches more than once.
justificationstringShown to the human reviewer alongside the tracked change.
preserve_run_stylebooleanDefault
trueauthorstring
Returns
documentobjectThe 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
idstringartifactIdstring | nullorgIdstringcreatedByUserIdstring | nullfileNamestringmimeTypestringsizeBytesintegerpurposestringOne of
source_docplaybookclientReferenceIdstring | nulldocumentSeriesIdstringdocumentVersionintegerparentUploadIdstring | nullversionKindstringOne of
originalworking_draftstorageKeystring | nullcontentSha256string | nullhasBinarybooleanstatusstringcreatedAtstringupdatedAtstring
replacementsintegerrevisionsobject[]Show 7 fields
ordinalinteger RequiredThe change's position in document order.
change_idstring RequiredThe id to pass in accepted_change_ids or rejected_change_ids.
kindstring Requiredinsert 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
insertdeleteparagraph_markproposedr-prop-changep-prop-changetbl-prop-changetr-prop-changetc-prop-changesect-prop-changeauthorstring | nulldatestring | nulltext_previewstring RequiredA short excerpt of the changed text.
justificationstring | nullThe reason recorded with the change, shown to the reviewer.
redlinePreviewobject