For AI agents: markdown of this page — /docs-content-en/entities/doc-templates/update.md documentation index — /llms.txt
Update template
PATCH /v1/doc-templates/:id
Partially updates a document template. Pass only the fields you change, flat at the root of the JSON — the other values are preserved.
Parameters
| Parameter | Type | Req. | Description |
|---|---|---|---|
id (path) |
number | yes | Template identifier |
Request fields (body)
| Field | Type | Description |
|---|---|---|
name |
string | Template name |
numeratorId |
number | ID of the numerator that assigns sequential numbers to documents |
region |
string | Template region code, for example us or gb |
code |
string | System code of the template for binding in application code |
active |
string | Template availability: Y — enabled, N — disabled |
withStamps |
string | Facsimile and stamp printing: Y — added, N — not added |
sort |
number | Template order in the list: the smaller the value, the higher |
users |
array | Identifiers of employees who have access to the template. List: GET /v1/users |
Read-only fields (id, createdBy, updatedBy, createTime, updateTime, isDeleted, download, downloadMachine, providers, isDefault, productsTableVariant) are not accepted in the request body.
Examples
curl — personal key
curl -X PATCH "https://vibecode.bitrix24.com/v1/doc-templates/209" \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Contract template (ed.)"
}'
curl — OAuth application
curl -X PATCH "https://vibecode.bitrix24.com/v1/doc-templates/209" \
-H "X-Api-Key: YOUR_APP_KEY" \
-H "Authorization: Bearer USER_SESSION_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Contract template (ed.)"
}'
JavaScript — personal key
const res = await fetch('https://vibecode.bitrix24.com/v1/doc-templates/209', {
method: 'PATCH',
headers: {
'X-Api-Key': 'YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
name: 'Contract template (ed.)',
}),
})
const { success, data } = await res.json()
JavaScript — OAuth application
const res = await fetch('https://vibecode.bitrix24.com/v1/doc-templates/209', {
method: 'PATCH',
headers: {
'X-Api-Key': 'YOUR_APP_KEY',
'Authorization': 'Bearer USER_SESSION_TOKEN',
'Content-Type': 'application/json',
},
body: JSON.stringify({
name: 'Contract template (ed.)',
}),
})
const { success, data } = await res.json()
Response fields
| Field | Type | Description |
|---|---|---|
success |
boolean | Always true on success |
data |
object | The full updated template |
data.id |
number | Template identifier |
data.name |
string | Name |
data.region |
string | Region |
data.code |
string | null | System code of the template |
data.active |
string | Availability: Y / N |
data.moduleId |
string | Source module of the template |
data.numeratorId |
number | Numerator identifier |
data.withStamps |
string | Stamps and signatures: Y / N |
data.sort |
number | Order in the list |
data.users |
object | Mapping of identifiers of employees who have access to the template |
data.providers |
object | Template data providers |
data.isDeleted |
boolean | Whether the template is marked deleted |
data.createTime |
string | Creation date (ISO 8601) |
data.updateTime |
string | Change date (ISO 8601) |
data.download |
string | Document download URL |
data.downloadMachine |
string | Download URL for programmatic access |
Full template field schema — Template fields.
Response example
{
"success": true,
"data": {
"id": 209,
"name": "Contract template (ed.)",
"region": "us",
"code": null,
"download": "/bitrix/services/main/ajax.php?action=documentgenerator.api.template.download&SITE_ID=s1&id=209&ts=0",
"active": "Y",
"moduleId": "rest",
"numeratorId": 1,
"withStamps": "N",
"providers": {
"bitrix\\documentgenerator\\dataprovider\\rest": "bitrix\\documentgenerator\\dataprovider\\rest"
},
"users": {
"U1": "U1"
},
"isDeleted": false,
"sort": 500,
"createTime": "2026-05-12T09:03:38.000Z",
"updateTime": "2026-05-25T10:00:11.000Z",
"downloadMachine": "https://<portal>/rest/1/<token>/documentgenerator.api.template.download/?token=<token>"
}
}
Error response example
404 — template not found:
{
"success": false,
"error": {
"code": "ENTITY_NOT_FOUND",
"message": "Template not found"
}
}
Errors
| HTTP | Code | Description |
|---|---|---|
| 404 | ENTITY_NOT_FOUND |
No template with the given id (message "Template not found") |
| 403 | SCOPE_DENIED |
The key lacks the documentgenerator scope |
| 401 | TOKEN_MISSING |
The key has no configured tokens |
Full list of common API errors — Errors.