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 |
|---|---|---|---|
id (path) |
integer | yes | Document identifier |
Request fields (body)
| Field | Type | Required | Description |
|---|---|---|---|
title |
string | yes¹ | New document title |
markdown |
string | yes¹ | New content in Markdown. Completely replaces the current one. Maximum 1 048 576 bytes (1 MiB) |
overwrite |
boolean | no | Overwrite 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 |
|---|---|---|
success |
boolean | Always true on success |
data.updated |
boolean | true on a successful update |
Response example
{
"success": true,
"data": { "updated": true }
}
Error response example
400 — no mutable field was passed:
{
"success": false,
"error": {
"code": "INVALID_PARAMS",
"message": "at least one of `title` or `markdown` must be provided"
}
}
Errors
| HTTP | Code | Description |
|---|---|---|
| 400 | INVALID_PARAMS |
Neither title nor markdown is passed, or id has the wrong type |
| 403 | BITRIX_ACCESS_DENIED |
No permission to edit the document |
| 403 | WRITE_BLOCKED_READONLY_KEY |
The access key is read-only |
| 404 | ENTITY_NOT_FOUND |
The document does not exist, is archived, or is in the recycle bin |
| 422 | BITRIX_ERROR |
There are unsaved changes and overwrite: false was passed, or the markdown size exceeds the limit. Error text in error.message |
| 403 | SCOPE_DENIED |
The key lacks the note scope |
| 401 | TOKEN_MISSING |
The 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.