Update a document body
View as MarkdownPATCH
/v1/documents/{id}/bodyReplaces the body with markdown, or applies edits (exact old/new string replacements against the Markdown returned by doc.get). Edits that do not match exactly once are skipped and reported in warnings. Pass expectedVersion to fail with a conflict if the body changed since you read it.
docs:writeUndoable
curl -X PATCH "https://api.lydie.co/v1/documents/01JCQ3V5MZ8G4ZK2X7T9R6N1PB/body" \
-H "Authorization: Bearer $LYDIE_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"edits": [
{
"oldStr": "Ship the developer docs",
"newStr": "Shipped the developer docs"
}
]
}'Path parameters
Body
- markdownstring
Show 3 fieldsHide fields
- replaceAllboolean
Default
false
- expectedVersionstring
Response
{
"document": {
"id": "01JCQ3V5MZ8G4ZK2X7T9R6N1PB",
"workspaceId": "01JCQ3TZ0WJ8K4M2X7T9R6N1PA",
"parentId": null,
"title": "Meeting notes",
"sortKey": "a0",
"properties": {
"status": "draft"
},
"createdAt": "2026-11-12T09:30:00.000Z",
"updatedAt": "2026-11-12T09:30:00.000Z",
"deletedAt": null,
"createdBy": null,
"updatedBy": null
},
"version": "3f9c2a71",
"warnings": [
{
"code": "no_match",
"message": "string",
"editIndex": 0
}
]
}Errors use one envelope for every endpoint. See Errors and versions.