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

Terminal
curl "https://vibecode.bitrix24.com/v1/doc-templates/fields" \
  -H "X-Api-Key: YOUR_API_KEY"

curl — OAuth application

Terminal
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

javascript
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

javascript
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

The label and description field captions are returned in English. Request headers do not switch the language.

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 uk or de
code code string | null System code of the template used to reference it from application code. null if no code is set
moduleId moduleId string yes Identifier of the module that owns the template. Bitrix24 always stamps it as rest for templates created over the REST API
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 added
sort sort number Template order in the list: the lower the value, the higher the template appears
users users array Identifiers of employees who have access to the template. List: GET /v1/users
fileId fileId number Drive 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 the template
updatedBy updatedBy number | null yes Identifier of the employee who changed the template. null if the template has never been 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 programmatic access to the file, 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

JSON
{
  "success": true,
  "data": {
    "fields": {
      "id": { "type": "number", "readonly": true, "label": "Template ID", "description": "Unique identifier of the document template." },
      "name": { "type": "string", "readonly": false, "required": true, "label": "Template name", "description": "Name of the document template 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": "Region code of the template, for example ru or by." },
      "code": { "type": "string", "readonly": false, "label": "System code", "description": "System code of the template used to reference it from application code." },
      "moduleId": { "type": "string", "readonly": true, "label": "Owner module ID", "description": "Identifier of the Bitrix24 module that owns the template. Assigned by the server." },
      "active": { "type": "string", "readonly": false, "label": "Active", "description": "Whether the template is available: enabled or disabled." },
      "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 order", "description": "Value used to sort the template in the list: lower values come first." },
      "users": { "type": "array", "readonly": false, "label": "Available employees", "description": "List of employee IDs who have access to the template." },
      "fileId": { "type": "number", "readonly": false, "label": "Disk file ID", "description": "Identifier of the template file uploaded to Disk." },
      "file": { "type": "string", "readonly": false, "label": "File content", "description": "Content of the template file in .docx format, base64-encoded." },
      "createdBy": { "type": "number", "readonly": true, "label": "Created by employee", "description": "Identifier of the employee who created the template." },
      "updatedBy": { "type": "number", "readonly": true, "label": "Modified by employee", "description": "Identifier of the employee who last modified 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 when the template was created." },
      "updateTime": { "type": "datetime", "readonly": true, "label": "Modification date", "description": "Date and time when the template was last modified." },
      "download": { "type": "string", "readonly": true, "label": "Download link", "description": "Link for downloading the original 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": "Providers list", "description": "List of available storage providers for the template file along with their settings." },
      "isDefault": { "type": "string", "readonly": true, "label": "Default template", "description": "Whether the template is used as the default one." },
      "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:

JSON
{
  "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
429 RATE_LIMITED Rate limit exceeded: 300 requests per minute per portal, all API keys of the portal share one limit. The exact value arrives in the x-ratelimit-limit header (the cap is divided across replicas). Retry after the delay in the Retry-After header

Full list of common API errors — Errors.

See also