Apply exact HTML edits to one documentation page
Applies an ordered batch of exact HTML search-and-replace edits atomically. Use canonical HTML, contentGeneration, and contentEtag from a current tree, search, partial-read, page-detail, or prior edit response. Each search must match exactly once in the same current document. The server rejects missing, ambiguous, overlapping, stale, malformed, or schema-lossy edits. HTML fragments are normalized with the editor HTML parser before matching. The edit stays in the active collaboration generation and connected editors receive its incremental update. The response is a small receipt and does not include the page body.
POST
/projects/documentation/{id}/content-editsAuthorization
AuthorizationOAuth2 access token · headerrequiredScopes:
api:writeor
AuthorizationBearer token (JWT) · headerrequiredPath parameters
idstring<uuid>requiredProject documentation page UUID. Folder UUIDs cannot receive content edits.
Request body
requiredapplication/jsoncommandIdstringrequiredStable client command identity. An exact retry returns the stored receipt. Reusing it for another request returns a conflict.
max length 100
contentEtagstringrequiredCurrent content ETag from a tree, search, partial-read, page-detail, or previous edit response. Treat it as opaque and send the complete string unchanged, including quotes when present.
contentGenerationnumberrequiredCurrent content generation from the page detail or a previous edit receipt.
min 1
editsProjectDocumentationHtmlEditDto[]requiredShow propertiesHide properties
Array of
ProjectDocumentationHtmlEditDtoreplacestringrequiredReplacement HTML fragment. Use an empty string to remove the matched fragment.
searchstringrequiredExact HTML fragment from the canonical content returned by the API.
Responses
200
commandIdstringrequiredcontentEtagstringrequiredQuoted strong ETag after the edit. Keep the double quotes for the next exact edit.
contentGenerationnumberrequiredmin 1
duplicatebooleanrequiredTrue when the server returned the stored command receipt.
matchesProjectDocumentationHtmlEditMatchDto[]requiredShow propertiesHide properties
Array of
ProjectDocumentationHtmlEditMatchDtoeditIndexnumberrequiredmatchCountnumberrequiredAllowed:
1matchedCharactersnumberrequiredstateBytesnumberrequiredBytes in the durable aggregate editor state.
updateBytesnumberrequiredBytes in the incremental live-editor update.
400Invalid page identifier, malformed HTML, or HTML that the editor schema cannot preserve.
errorstring | objectHTTP error name or a structured HTTP exception response.
Show propertiesHide properties
One of:
string
stringobject
objectmessagestring | string[] | objectrequiredError message, validation message list, or request-field validation message map.
Show propertiesHide properties
One of:
string
stringstring[]
Array of
stringstringobject
objectstatusCodenumberrequiredHTTP status code for this response.
401Unauthorized - Invalid or missing authentication token
403Forbidden - Insufficient API scopes or permissions
404The page does not exist or is not accessible.
errorstring | objectHTTP error name or a structured HTTP exception response.
Show propertiesHide properties
One of:
string
stringobject
objectmessagestring | string[] | objectrequiredError message, validation message list, or request-field validation message map.
Show propertiesHide properties
One of:
string
stringstring[]
Array of
stringstringobject
objectstatusCodenumberrequiredHTTP status code for this response.
409Stale content, a missing or ambiguous search, overlapping matches, or command identity reuse.
errorstring | objectHTTP error name or a structured HTTP exception response.
Show propertiesHide properties
One of:
string
stringobject
objectmessagestring | string[] | objectrequiredError message, validation message list, or request-field validation message map.
Show propertiesHide properties
One of:
string
stringstring[]
Array of
stringstringobject
objectstatusCodenumberrequiredHTTP status code for this response.
Request
curl -X POST "https://leadtime.app/api/public/projects/documentation/550e8400-e29b-41d4-a716-446655440000/content-edits" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"commandId": "revise-risk-section-2026-08-08",
"contentEtag": "8e2ffa0587a5c9e89d3a5228fc2b6693b8941588d06a249dd7bfb6b7e8d871a1",
"contentGeneration": 3,
"edits": [
{
"replace": "<p>The revised text.</p>",
"search": "<p>The old text.</p>"
}
]
}'const response = await fetch("https://leadtime.app/api/public/projects/documentation/550e8400-e29b-41d4-a716-446655440000/content-edits", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_ACCESS_TOKEN",
"Content-Type": "application/json"
},
body: JSON.stringify({
"commandId": "revise-risk-section-2026-08-08",
"contentEtag": "8e2ffa0587a5c9e89d3a5228fc2b6693b8941588d06a249dd7bfb6b7e8d871a1",
"contentGeneration": 3,
"edits": [
{
"replace": "<p>The revised text.</p>",
"search": "<p>The old text.</p>"
}
]
})
});import requests
response = requests.post(
"https://leadtime.app/api/public/projects/documentation/550e8400-e29b-41d4-a716-446655440000/content-edits",
headers={
"Authorization": "Bearer YOUR_ACCESS_TOKEN",
"Content-Type": "application/json"
},
json={
"commandId": "revise-risk-section-2026-08-08",
"contentEtag": "8e2ffa0587a5c9e89d3a5228fc2b6693b8941588d06a249dd7bfb6b7e8d871a1",
"contentGeneration": 3,
"edits": [
{
"replace": "<p>The revised text.</p>",
"search": "<p>The old text.</p>"
}
]
},
)Response
{
"commandId": "string",
"contentEtag": "\"pd-3-DykV4wYdAQ\"",
"contentGeneration": 1,
"duplicate": true,
"matches": [
{
"editIndex": 0,
"matchCount": 1,
"matchedCharacters": 24
}
],
"stateBytes": 0,
"updateBytes": 0
}{
"error": "string",
"message": "string",
"statusCode": 0
}Unauthorized - Invalid or missing authentication token
Forbidden - Insufficient API scopes or permissions
{
"error": "string",
"message": "string",
"statusCode": 0
}{
"error": "string",
"message": "string",
"statusCode": 0
}