For AI agents: markdown of this page — /docs-content-en/entities/crm-document-templates/update.md documentation index — /llms.txt
Update a CRM document template
PATCH /v1/crm-document-templates/:id
Partially updates a CRM document template: pass only the fields you change at the root of the JSON. The template's other values are kept.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
Parameterid (path) |
Typenumber | Requiredyes | DescriptionTemplate ID, a positive integer. List: GET /v1/crm-document-templates |
Request fields (body)
All fields are optional, but the body must contain at least one of them.
| Field | Type | Description |
|---|---|---|
Fieldname |
Typestring | DescriptionTemplate name |
Fieldfile |
Typestring | DescriptionNew .docx file as a base64 string, at most 2 MiB after decoding. Replaces the template file |
FieldnumeratorId |
Typenumber | DescriptionID of the numerator that assigns numbers to documents. The list of numerators is not exposed through /v1/... |
Fieldregion |
Typestring | DescriptionTemplate region, for example uk |
FieldentityTypeId |
Typearray | DescriptionNon-empty array of CRM record types, numbers or strings: 2 — deal, 3 — contact, 4 — company. Smart process types — GET /v1/smart-processes. Replaces the bindings entirely: [3] on a deal template leaves only the contact. Without the field, the bindings do not change |
Fieldusers |
Typearray | DescriptionNon-empty array of access codes as strings: UA — all employees, U<id> — the employee with this ID from GET /v1/users |
Fieldactive |
Typestring | DescriptionWhether the template is active: Y or N |
FieldwithStamps |
Typestring | DescriptionStamps and signatures in documents: Y or N |
Fieldsort |
Typenumber | DescriptionSort index |
Fieldcode |
Typestring | DescriptionTemplate symbolic code |
The fields id, fileId, moduleId, download, downloadMachine, isDeleted, isDefault, createTime, updateTime, createdBy, updatedBy, providers are read-only. A request with any of them is rejected with 400 READONLY_FIELD. Field names are matched case-insensitively and ignoring underscores: module_id and ModuleId are rejected too.
Examples
curl — personal key
curl -X PATCH "https://vibecode.bitrix24.com/v1/crm-document-templates/263" \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Supply agreement, revision 2",
"sort": 200
}'
curl — OAuth application
curl -X PATCH "https://vibecode.bitrix24.com/v1/crm-document-templates/263" \
-H "X-Api-Key: YOUR_APP_KEY" \
-H "Authorization: Bearer USER_SESSION_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Supply agreement, revision 2",
"sort": 200
}'
JavaScript — personal key
const res = await fetch('https://vibecode.bitrix24.com/v1/crm-document-templates/263', {
method: 'PATCH',
headers: {
'X-Api-Key': 'YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
name: 'Supply agreement, revision 2',
sort: 200,
}),
})
const { success, data } = await res.json()
JavaScript — OAuth application
const res = await fetch('https://vibecode.bitrix24.com/v1/crm-document-templates/263', {
method: 'PATCH',
headers: {
'X-Api-Key': 'YOUR_APP_KEY',
'Authorization': 'Bearer USER_SESSION_TOKEN',
'Content-Type': 'application/json',
},
body: JSON.stringify({
name: 'Supply agreement, revision 2',
sort: 200,
}),
})
const { success, data } = await res.json()
Response fields
| Field | Type | Description |
|---|---|---|
Fieldsuccess |
Typeboolean | DescriptionAlways true on success |
Fielddata |
Typeobject | DescriptionThe full template after the change |
Fielddata.id |
Typestring | DescriptionTemplate ID, as a string |
Fielddata.name |
Typestring | DescriptionTemplate name |
Fielddata.region |
Typestring | DescriptionTemplate region |
Fielddata.code |
Typestring | null | DescriptionTemplate symbolic code, null — no code set |
Fielddata.download |
Typestring | DescriptionTemplate file download URL in the Bitrix24 web interface. To download through the API, use downloadMachine |
Fielddata.active |
Typestring | DescriptionWhether the template is active: Y or N |
Fielddata.moduleId |
Typestring | DescriptionOwner module, always crm |
Fielddata.numeratorId |
Typestring | DescriptionNumerator ID, as a string |
Fielddata.withStamps |
Typestring | DescriptionStamps and signatures: Y or N |
Fielddata.users |
Typeobject | DescriptionAccess codes as an object, each code is both the key and the value: {"UA": "UA"} |
Fielddata.isDeleted |
Typestring | DescriptionDeletion flag: N for an active template |
Fielddata.sort |
Typestring | DescriptionSort index, as a string |
Fielddata.createTime |
Typestring | DescriptionCreation date in ISO 8601 with a time zone offset |
Fielddata.updateTime |
Typestring | DescriptionLast modification date in ISO 8601 with a time zone offset |
Fielddata.entityTypeId |
Typearray | DescriptionCRM record types as strings. If entityTypeId was in the request body, the values match those sent. Without it, the deal type comes back expanded by funnel — see What to know before you start |
Fielddata.downloadMachine |
Typestring | DescriptionDownload URL of the .docx through the Vibecode API — GET /v1/crm-document-templates/:id/download |
Response example
{
"success": true,
"data": {
"id": "263",
"name": "Supply agreement, revision 2",
"region": "uk",
"code": null,
"download": "https://example.bitrix24.com/bitrix/services/main/ajax.php?action=crm.documentgenerator.template.download&SITE_ID=s1&id=263",
"active": "Y",
"moduleId": "crm",
"numeratorId": "1",
"withStamps": "N",
"users": {
"UA": "UA"
},
"isDeleted": "N",
"sort": "200",
"createTime": "2026-10-08T13:20:29+00:00",
"updateTime": "2026-10-08T13:20:41+00:00",
"entityTypeId": [
"2_category_0",
"2_category_1",
"2_category_11",
"2_category_13",
"2_category_21",
"2_category_3",
"2_category_5",
"2_category_9"
],
"downloadMachine": "https://vibecode.bitrix24.com/v1/crm-document-templates/263/download"
}
}
Error response example
404 — template not found:
{
"success": false,
"error": {
"code": "ENTITY_NOT_FOUND",
"message": "CRM template not found."
}
}
Errors
| HTTP | Code | Description |
|---|---|---|
| HTTP404 | CodeENTITY_NOT_FOUND |
DescriptionNo template with this id, or it is not a CRM template, for example an application template from the Document templates section |
| HTTP400 | CodeINVALID_PARAMS |
Descriptionid is not a positive integer |
| HTTP400 | CodeMISSING_REQUIRED_FIELDS |
DescriptionEmpty body {} |
| HTTP400 | CodeINVALID_PARAMS |
Descriptionusers is an empty array or contains a value that is not a non-empty string |
| HTTP400 | CodeINVALID_PARAMS |
DescriptionentityTypeId is an empty array, not an array, or contains a value that is neither a positive number nor a non-empty string |
| HTTP400 | CodeINVALID_PARAMS |
Descriptionfile is not a base64 string |
| HTTP400 | CodeINVALID_PARAMS |
DescriptionThe request body is not a JSON object |
| HTTP400 | CodeREADONLY_FIELD |
DescriptionThe body contains a read-only field. The check runs before the template lookup, so this error is also returned for a nonexistent id |
| HTTP413 | CodePAYLOAD_TOO_LARGE |
DescriptionThe file is larger than 2 MiB after decoding file, or the JSON body is larger than 3 MiB |
| HTTP429 | CodeLARGE_BODY_BACKEND_BUSY |
DescriptionThe body is larger than 1 MiB and the platform is already processing the maximum volume of large bodies. Retry the request after Retry-After seconds |
| HTTP422 | CodeBITRIX_WRITE_NOT_APPLIED |
DescriptionBitrix24 did not save the passed entityTypeId or users. The other fields from the body are already written — read the template through GET /v1/crm-document-templates/:id before retrying |
| HTTP422 | CodeBITRIX_ERROR |
DescriptionBitrix24 rejected the change. The reason text is in error.message |
| HTTP403 | CodeWRITE_BLOCKED_READONLY_KEY |
DescriptionThe key works in read-only mode |
| HTTP403 | CodeSCOPE_DENIED |
DescriptionThe key lacks the crm scope |
| HTTP401 | CodeTOKEN_MISSING |
DescriptionThe key has no configured tokens |
| HTTP429 | CodeRATE_LIMITED |
DescriptionBitrix24 rate-limited requests to the portal. Retry after the delay in the Retry-After header |
Full list of common API errors — Errors.