Document Generator: Overview of Methods and Events
The document generator in CRM allows you to prepare a template, configure a numbering system, create a document from a template, or upload a ready-made file. It supports deals, leads, contacts, companies, invoices, estimates, and elements of Smart Process Automation (SPA).
The section consists of three main parts. In Numerators, you configure the number template and counter. In Document Templates, you upload a .docx file, link it to the numerator, region, and types of CRM entities. In Documents, you create a document from a template or upload a ready-made file, obtain links to the file, include a public link, and modify or delete the document.
For example, you can create a numerator for deals, link it to the deal template, and then create documents for specific deals.
If you are developing integrations for Bitrix24 using AI tools (Codex, Claude Code, Cursor), connect the MCP server so that the assistant uses the official REST documentation.
Quick navigation: all methods and events
User documentation:
Getting Started
- Create a numerator using the method crm.documentgenerator.numerator.add — this sets the number template for documents.
- Prepare a
.docxtemplate file in Base64 format — How to upload files. - Define the
entityTypeIdof the required CRM entity — typical values are provided in the article Features of transmitted values. - Upload the template using the method crm.documentgenerator.template.add: pass the name, file,
numeratorId,entityTypeId, andregion. - Obtain the
entityIdof the required CRM entity using the method crm.item.list. - Choose how to work with the document:
- to create a document from a template, use crm.documentgenerator.document.add.
- to upload a ready-made file, use crm.documentgenerator.document.upload.
Typical use-cases and scenarios
Important Considerations
- When creating a document from a template, the link between the template and the Sales Funnel is not automatically checked — the document is created even if the template is configured for a different funnel.
- The
pdfUrlandimageUrllinks may be absent immediately after creating or updating the document, as conversion is performed asynchronously. If you need the links right away, repeat the request using the method crm.documentgenerator.document.get after 30-40 seconds.
Relationships with Other Objects
Numerators. The numerator sets the number template and counter for documents. The document template uses it via the numeratorId parameter. If you are creating a new numerator, take the id from the response of crm.documentgenerator.numerator.add. If you are using an existing one, obtain the id using the method crm.documentgenerator.numerator.list.
Document Templates. The template stores the .docx file, region, linkage to types of CRM entities, and connection with the numerator. To create a document, you need the templateId — take the id from the response of crm.documentgenerator.template.add or the id of the required template from the response of crm.documentgenerator.template.list.
Documents. A document is created from a template using the method crm.documentgenerator.document.add or a ready-made file is uploaded using the method crm.documentgenerator.document.upload — in both cases, the document is attached to a CRM entity.
CRM Entities. Templates and documents use entityTypeId and entityId. Typical values of entityTypeId for CRM entities are provided in the article Features of transmitted values. For Smart Processes, entityTypeId can be obtained using the method crm.type.list. The identifier of the required object entityId is obtained using the method crm.item.list.
Regions. The template is linked to the country via the region parameter. The region value is passed in the method crm.documentgenerator.template.add, for example, de. A list of available regions can be obtained using the method documentgenerator.region.list.
Files. Templates use a .docx file, and in the method crm.documentgenerator.document.upload, the content of the ready-made DOCX file is passed in Base64. The upload format is described in the article How to upload files.
Overview of Methods and Events
Scope:
crmWho can perform the method: depends on the method
Numerators
|
Method |
Description |
|
Adds a new numerator |
|
|
Updates an existing numerator |
|
|
Returns information about the numerator by identifier |
|
|
Returns a list of numerators |
|
|
Deletes a numerator |
Document Templates
|
Method |
Description |
|
Adds a new template |
|
|
Updates an existing template |
|
|
Returns information about the template by identifier |
|
|
Returns a list of templates |
|
|
Deletes a template |
|
|
Returns the fields of the template for the specified CRM entity |
Documents
|
Method |
Description |
|
Creates a document from a template |
|
|
Updates a document |
|
|
Returns information about the document |
|
|
Returns a list of documents |
|
|
Deletes a document |
|
|
Enables or disables the public link |
|
|
Uploads a ready document and attaches it to a CRM entity |
|
|
Returns the fields of the created document |
|
Event |
Triggered |
|
When generating a document manually or using the method crm.documentgenerator.document.add |
|
|
When modifying a document manually or using the method crm.documentgenerator.document.update |
|
|
When deleting a document manually or using the method crm.documentgenerator.document.delete |