Skip to main content
POST
Replace an exact saved Google Docs passage only at the revision the member read

Authorizations

x-api-key
string
header
required

Organization API key passed as the x-api-key header. The raw key is the header value; do not prefix it with Bearer.

Path Parameters

documentId
string
required
Required string length: 1 - 512
Pattern: ^[A-Za-z0-9_-]+$

Body

application/json
tabId
string
required
Required string length: 1 - 512
revisionId
string
required

Required revisionId from a fresh outline or text read by this same connected account. A stale revision is never merged automatically.

Required string length: 1 - 512
startIndex
integer
required

UTF-16 offset of the exact passage being changed; add its offset within the returned excerpt.

Required range: 1 <= x <= 10000000
expectedText
string
required

Exact, case-sensitive saved text at startIndex, inside one paragraph. Cannot cross table cells, embedded objects, or paragraph boundaries.

Required string length: 1 - 5000
Pattern: ^[^\r\n\x00-\x08\x0b\x0c\x0e-\x1f]+$
replacement
string
required

User-requested replacement. Empty string deletes the matched passage. This edits the native Google Doc, not an unsaved local draft; require the user's explicit request before calling.

Maximum string length: 12000
Pattern: ^[^\x00-\x08\x0b-\x1f\uE000-\uF8FF]*$

Response

Google-confirmed result.

ok
boolean
required
documentId
string
required
Required string length: 1 - 512
Pattern: ^[A-Za-z0-9_-]+$
tabId
string
required
Required string length: 1 - 512
revisionId
string
required
Required string length: 1 - 512
replacedCharacters
integer
required
Required range: -9007199254740991 <= x <= 9007199254740991
insertedCharacters
integer
required
Required range: -9007199254740991 <= x <= 9007199254740991