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 are changing, flat at the root of the JSON — all 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 uk or de
code string System code of the template used to reference it from 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 lower the value, the higher the template appears
users array Identifiers of employees who have access to the template. List: GET /v1/users

Read-only fields (id, moduleId, createdBy, updatedBy, createTime, updateTime, isDeleted, download, downloadMachine, providers, isDefault, productsTableVariant) are not accepted in the request body: a request carrying any of them is refused with 400 READONLY_FIELD. The owner module moduleId is assigned by the platform.

Examples

curl — personal key

Terminal
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 (updated)"
  }'

curl — OAuth application

Terminal
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 (updated)"
  }'

JavaScript — personal key

javascript
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 (updated)',
  }),
})

const { success, data } = await res.json()

JavaScript — OAuth application

javascript
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 (updated)',
  }),
})

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 Map of employee identifiers with access to the template
data.providers object Template data providers
data.isDeleted boolean Whether the template is marked as deleted
data.createTime string Creation date (ISO 8601)
data.updateTime string Last update 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

JSON
{
  "success": true,
  "data": {
    "id": 209,
    "name": "Contract template (updated)",
    "region": "uk",
    "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:

JSON
{
  "success": false,
  "error": {
    "code": "ENTITY_NOT_FOUND",
    "message": "Template was not found."
  }
}

Errors

HTTP Code Description
400 READONLY_FIELD The body carried a read-only field — for example the owner module moduleId, which the platform assigns. The check runs before the call to Bitrix24, so this refusal arrives even for a non-existent id
404 ENTITY_NOT_FOUND No template with the given id (message "Template was 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.

See also