For AI agents: markdown of this page — /docs-content-en/entities/doc-templates/fields.md documentation index — /llms.txt
Template fields
GET /v1/doc-templates/fields
Returns the full field schema of a document template: field name, type, read-only flag, and whether it is required on creation. Fields marked ★ are required in the request body when creating a template.
Examples
curl — personal key
curl "https://vibecode.bitrix24.com/v1/doc-templates/fields" \
-H "X-Api-Key: YOUR_API_KEY"
curl — OAuth application
curl "https://vibecode.bitrix24.com/v1/doc-templates/fields" \
-H "X-Api-Key: YOUR_APP_KEY" \
-H "Authorization: Bearer USER_SESSION_TOKEN"
JavaScript — personal key
const res = await fetch('https://vibecode.bitrix24.com/v1/doc-templates/fields', {
headers: {
'X-Api-Key': 'YOUR_API_KEY',
},
})
const { success, data } = await res.json()
console.log('Total fields:', Object.keys(data.fields).length)
JavaScript — OAuth application
const res = await fetch('https://vibecode.bitrix24.com/v1/doc-templates/fields', {
headers: {
'X-Api-Key': 'YOUR_APP_KEY',
'Authorization': 'Bearer USER_SESSION_TOKEN',
},
})
const { success, data } = await res.json()
Response fields
| Field | Bitrix24 | Type | RO | Description |
|---|---|---|---|---|
id |
id |
number | yes | Template ID |
name |
name |
string | ★ Template name | |
numeratorId |
numeratorId |
number | ★ ID of the numerator that assigns sequential numbers to documents | |
region |
region |
string | ★ Template region code, for example us or gb |
|
code |
code |
string | null | System code of the template for binding in application code. null if no code is set |
|
moduleId |
moduleId |
string | Identifier of the module that owns the template | |
active |
active |
string | Template availability: Y — enabled, N — disabled |
|
bodyType |
bodyType |
string | Document body format, for example DOCX |
|
withStamps |
withStamps |
string | Facsimile and stamp printing: Y — added, N — not |
|
sort |
sort |
number | Template order in the list: the smaller the value, the higher | |
users |
users |
array | Identifiers of employees who have access to the template. List: GET /v1/users |
|
fileId |
fileId |
number | Disk file ID. Upload via POST /v1/files/upload |
|
file |
file |
string | .docx content in base64, accepted on creation | |
createdBy |
createdBy |
number | yes | Identifier of the employee who created it |
updatedBy |
updatedBy |
number | null | yes | Identifier of the employee who changed it. null if the template was not changed |
isDeleted |
isDeleted |
boolean | yes | Template marked as deleted |
createTime |
createTime |
datetime | yes | Creation date |
updateTime |
updateTime |
datetime | yes | Update date |
download |
download |
string | yes | Download link for the template's source file |
downloadMachine |
downloadMachine |
string | yes | Download link for the file via machine access without browser authorization |
providers |
providers |
object | yes | List of available storage providers with their settings |
isDefault |
isDefault |
string | yes | Whether the template is used by default |
productsTableVariant |
productsTableVariant |
string | yes | Layout variant of the products table in the generated document |
★ — the name, numeratorId, region fields are required in the request body when creating a template.
Response example
{
"success": true,
"data": {
"fields": {
"id": { "type": "number", "readonly": true, "label": "Template ID", "description": "Unique document template identifier." },
"name": { "type": "string", "readonly": false, "required": true, "label": "Template name", "description": "Document template name shown to the user." },
"numeratorId": { "type": "number", "readonly": false, "required": true, "label": "Numerator ID", "description": "Identifier of the numerator that assigns sequential numbers to documents." },
"region": { "type": "string", "readonly": false, "required": true, "label": "Template region", "description": "Template region code, for example ru or by." },
"code": { "type": "string", "readonly": false, "label": "System code", "description": "System code of the template for binding to it in application code." },
"moduleId": { "type": "string", "readonly": false, "label": "Owner module ID", "description": "Identifier of the Bitrix24 module the template belongs to." },
"active": { "type": "string", "readonly": false, "label": "Active", "description": "Template availability flag: on or off." },
"bodyType": { "type": "string", "readonly": false, "label": "Body format", "description": "Format of the generated document content, for example DOCX." },
"withStamps": { "type": "string", "readonly": false, "label": "Print stamps", "description": "Whether facsimiles and stamps are added when generating the document." },
"sort": { "type": "number", "readonly": false, "label": "Sort", "description": "Value for sorting the template in the list: the lower, the higher." },
"users": { "type": "array", "readonly": false, "label": "Allowed employees", "description": "List of identifiers of employees who can use the template." },
"fileId": { "type": "number", "readonly": false, "label": "Drive file ID", "description": "Identifier of the template file uploaded to the Drive." },
"file": { "type": "string", "readonly": false, "label": "File content", "description": "Content of the .docx template file encoded in base64." },
"createdBy": { "type": "number", "readonly": true, "label": "Created by", "description": "Identifier of the employee who created the template." },
"updatedBy": { "type": "number", "readonly": true, "label": "Changed by", "description": "Identifier of the employee who last changed the template." },
"isDeleted": { "type": "boolean", "readonly": true, "label": "Deleted", "description": "Whether the template is marked as deleted." },
"createTime": { "type": "datetime", "readonly": true, "label": "Creation date", "description": "Date and time the template was created." },
"updateTime": { "type": "datetime", "readonly": true, "label": "Change date", "description": "Date and time of the last change to the template." },
"download": { "type": "string", "readonly": true, "label": "Download link", "description": "Link for downloading the source template file." },
"downloadMachine": { "type": "string", "readonly": true, "label": "Machine link", "description": "Link for downloading the file without browser authorization, for programmatic access." },
"providers": { "type": "object", "readonly": true, "label": "Provider list", "description": "List of available file storage providers for the template with their settings." },
"isDefault": { "type": "string", "readonly": true, "label": "Default template", "description": "Whether the template is used by default." },
"productsTableVariant": { "type": "string", "readonly": true, "label": "Products table variant", "description": "Layout variant of the products table in the generated document." }
}
}
}
Error response example
403 — the key lacks the required scope:
{
"success": false,
"error": {
"code": "SCOPE_DENIED",
"message": "This endpoint requires 'documentgenerator' scope"
}
}
Errors
| HTTP | Code | Description |
|---|---|---|
| 403 | SCOPE_DENIED |
The API key lacks the documentgenerator scope |
| 401 | TOKEN_MISSING |
the key has no configured tokens |
Full list of common API errors — Errors.