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.

The type column and the type values returned by this endpoint describe canonical stored and response values. Create-only input forms are documented on the Create template page: in particular, POST /v1/doc-templates also accepts fileId as a positive decimal string, while responses keep it as a number.

Field Bitrix24 Type RO Description
Fieldid Bitrix24id Typenumber ROyes DescriptionTemplate ID
Fieldname Bitrix24name Typestring RO Description★ Template name
FieldnumeratorId Bitrix24numeratorId Typenumber RO Description★ ID of the numerator that assigns sequential numbers to documents
Fieldregion Bitrix24region Typestring RO Description★ Template region code, for example uk or de
Fieldcode Bitrix24code Typestring | null RO DescriptionSystem code of the template used to reference it from application code. null if no code is set
FieldmoduleId Bitrix24moduleId Typestring ROyes DescriptionIdentifier of the module that owns the template. Bitrix24 always sets it to rest for templates created over the REST API
Fieldactive Bitrix24active Typestring RO DescriptionTemplate availability: Y — enabled, N — disabled
FieldbodyType Bitrix24bodyType Typestring RO DescriptionDocument body format, for example DOCX
FieldwithStamps Bitrix24withStamps Typestring RO DescriptionFacsimile and stamp printing: Y — added, N — not added
Fieldsort Bitrix24sort Typenumber RO DescriptionTemplate order in the list: the lower the value, the higher the template appears
Fieldusers Bitrix24users Typearray RO DescriptionIdentifiers of employees who have access to the template. List: GET /v1/users
FieldfileId Bitrix24fileId Typenumber RO DescriptionOn creation, the Drive object ID whose content the platform imports. Not applied in an update request. In a response, an ID from the separate Document Generator registry, not a Drive object ID
Fieldfile Bitrix24file Typestring RO Description.docx content in base64. Pass exactly one of file and fileId on creation. On update, replaces the template file
FieldcreatedBy Bitrix24createdBy Typenumber ROyes DescriptionIdentifier of the employee who created the template
FieldupdatedBy Bitrix24updatedBy Typenumber | null ROyes DescriptionIdentifier of the employee who changed the template. null if the template has never been changed
FieldisDeleted Bitrix24isDeleted Typeboolean ROyes DescriptionTemplate marked as deleted
FieldcreateTime Bitrix24createTime Typedatetime ROyes DescriptionCreation date
FieldupdateTime Bitrix24updateTime Typedatetime ROyes DescriptionUpdate date
Fielddownload Bitrix24download Typestring ROyes DescriptionDownload link for the template's source file
FielddownloadMachine Bitrix24downloadMachine Typestring ROyes DescriptionVibe API URL; requires X-Api-Key with documentgenerator scope
Fieldproviders Bitrix24providers Typeobject ROyes DescriptionList of available storage providers with their settings
FieldisDefault Bitrix24isDefault Typestring ROyes DescriptionWhether the template is used by default
FieldproductsTableVariant Bitrix24productsTableVariant Typestring ROyes DescriptionLayout variant of the products table in the generated document

★ — the name, numeratorId, and region fields are required in the request body when creating a template.

On POST /v1/doc-templates, fileId requires the documentgenerator and disk scopes; file requires only documentgenerator. The file may be up to 2 MiB after decoding or downloading, and the JSON body may be up to 3 MiB. This rule applies to creation and does not change the PATCH /v1/doc-templates/:id contract.

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": "On POST /v1/doc-templates this is the Disk object ID whose bytes the platform imports into Document Generator. A fileId returned in a template response belongs to the separate Document Generator file registry and must not be used with /v1/files endpoints." },
      "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": "Vibe API URL; requires X-Api-Key with documentgenerator scope." },
      "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
HTTP403 CodeSCOPE_DENIED DescriptionThe API key lacks the documentgenerator scope
HTTP401 CodeTOKEN_MISSING DescriptionThe key has no configured tokens
HTTP429 CodeRATE_LIMITED DescriptionRate limit exceeded: 300 requests per minute per portal. All API keys of the portal share one limit. The current limit is returned in the x-ratelimit-limit header. Retry after the delay in the Retry-After header

For the full list of common API errors, see Errors.

See also