For AI agents: markdown of this page — /docs-content-en/note/documents/update.md documentation index — /llms.txt
Update a document
PATCH /v1/note/documents/:id
Updates the title and/or the content of a document. Passing markdown completely replaces the current content.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
Parameterid (path) |
Typeinteger | Requiredyes | DescriptionDocument identifier. List: GET /v1/note/documents |
Request fields (body)
| Field | Type | Required | Description |
|---|---|---|---|
Fieldtitle |
Typestring | Requiredyes¹ | DescriptionNew document title |
Fieldmarkdown |
Typestring | Requiredyes¹ | DescriptionNew content in Markdown. Completely replaces the current one. Maximum 1 048 576 bytes (1 MiB) |
Fieldoverwrite |
Typeboolean | Requiredno | DescriptionOverwrite the content when there are unsaved changes. Defaults to false |
¹ At least one of the fields title or markdown must be present.
Examples
curl — personal key
curl -X PATCH https://vibecode.bitrix24.com/v1/note/documents/77 \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"title": "Chapter 1 (ed.)",
"markdown": "# Chapter 1\n\nUpdated text",
"overwrite": false
}'
curl — OAuth application
curl -X PATCH https://vibecode.bitrix24.com/v1/note/documents/77 \
-H "X-Api-Key: YOUR_APP_KEY" \
-H "Authorization: Bearer USER_SESSION_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"title": "Chapter 1 (ed.)",
"markdown": "# Chapter 1\n\nUpdated text",
"overwrite": false
}'
JavaScript — personal key
const res = await fetch('https://vibecode.bitrix24.com/v1/note/documents/77', {
method: 'PATCH',
headers: {
'X-Api-Key': 'YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
title: 'Chapter 1 (ed.)',
markdown: '# Chapter 1\n\nUpdated text',
overwrite: false,
}),
})
const { success, data } = await res.json()
console.log(data.updated)
JavaScript — OAuth application
const res = await fetch('https://vibecode.bitrix24.com/v1/note/documents/77', {
method: 'PATCH',
headers: {
'X-Api-Key': 'YOUR_APP_KEY',
'Authorization': 'Bearer USER_SESSION_TOKEN',
'Content-Type': 'application/json',
},
body: JSON.stringify({
title: 'Chapter 1 (ed.)',
markdown: '# Chapter 1\n\nUpdated text',
overwrite: false,
}),
})
const { success, data } = await res.json()
Response fields
| Field | Type | Description |
|---|---|---|
Fieldsuccess |
Typeboolean | DescriptionAlways true on success |
Fielddata |
Typeobject | DescriptionUpdate result |
Fielddata.updated |
Typeboolean | Descriptiontrue on a successful update |
Response example
{
"success": true,
"data": { "updated": true }
}
Error response example
400 — no updatable field was passed:
{
"success": false,
"error": {
"code": "INVALID_PARAMS",
"message": "at least one of `title` or `markdown` must be provided"
}
}
Errors
| HTTP | Code | Description |
|---|---|---|
| HTTP400 | CodeINVALID_PARAMS |
DescriptionNeither title nor markdown is passed, or id has the wrong type |
| HTTP403 | CodeBITRIX_ACCESS_DENIED |
DescriptionNo permission to edit the document |
| HTTP403 | CodeWRITE_BLOCKED_READONLY_KEY |
DescriptionThe access key is read-only |
| HTTP404 | CodeENTITY_NOT_FOUND |
DescriptionThe document does not exist, is archived, or is in the recycle bin |
| HTTP422 | CodeBITRIX_ERROR |
DescriptionThere are unsaved changes and overwrite: false was passed, or the markdown size exceeds the limit. Error text in error.message |
| HTTP403 | CodeSCOPE_DENIED |
DescriptionThe key lacks the note scope |
| HTTP401 | CodeTOKEN_MISSING |
DescriptionThe API key has no tokens configured |
Full list of common API errors — Errors.
Known specifics
Resolving a collaborative-editing conflict. If the document still has unsaved changes from a collaborative editor, a request with overwrite: false does not overwrite the content and returns 422 BITRIX_ERROR. A repeated request with overwrite: true writes markdown over the unsaved changes.