Documents: Overview of Methods

Documents in the Bitrix24 document generator can be created from a template for a CRM entity or uploaded as a ready-made file and attached to a CRM entity.

If you are developing integrations for Bitrix24 using AI tools (Codex, Claude Code, Cursor), connect to the MCP server so that the assistant can utilize the official REST documentation.

Quick navigation: all methods and events

User documentation: Documents in CRM: Create and send to customers

Getting Started

  1. Prepare the document template and obtain the templateId in the Document Templates section.
  2. Determine the entityTypeId of the CRM entity for which the document is needed.
  3. Obtain the entityId of the required CRM entity.
  4. If you need to check the available document fields, use the crm.documentgenerator.document.getfields method.
  5. Create a document from the template using the crm.documentgenerator.document.add method or upload a ready-made file using the crm.documentgenerator.document.upload method.
  6. If you know the document's id and want to retrieve its data, use the crm.documentgenerator.document.get method.
  7. If you need to get a list of documents, use the crm.documentgenerator.document.list method.
  8. To modify a document, use the crm.documentgenerator.document.update method.
  9. If you need a public link to the document, use the crm.documentgenerator.document.enablepublicurl method.
  10. Delete an unnecessary document using the crm.documentgenerator.document.delete method.

Important Considerations

The pdfUrl and imageUrl links may not be available immediately after creating or updating the document, as the conversion is performed asynchronously. If you need the links right away, repeat the request using the crm.documentgenerator.document.get method after 30-40 seconds.

Relationships with Other Objects

Document Templates. To create a document from a template, pass the templateId to the crm.documentgenerator.document.add method. Obtain the templateId from the response of crm.documentgenerator.template.add or retrieve it from the list using the crm.documentgenerator.template.list method.

CRM Entities. To create or upload a document, pass the entityTypeId and entityId. Typical values for entityTypeId for CRM entities are provided in the article Features of Passed Values. For SPAs, the entityTypeId can be obtained using the crm.type.list method. The identifier of the required object, entityId, can be obtained using the universal crm.item.list method.

Numbering. When creating a document, the number is usually generated based on the numbering system associated with the template. If you are creating a new numbering system, obtain the id from the response of crm.documentgenerator.numerator.add. If you are using an existing one, retrieve the id using the crm.documentgenerator.numerator.list method.

Files. In the crm.documentgenerator.document.upload method, the file content is passed in Base64. The upload format is described in the article How to Upload Files.

Overview of Methods and Events

Scope: crm

Who can execute the method: depends on the method

Method

Description

crm.documentgenerator.document.add

Creates a document from a template

crm.documentgenerator.document.update

Updates a document

crm.documentgenerator.document.get

Returns information about the document

crm.documentgenerator.document.list

Returns a list of documents

crm.documentgenerator.document.delete

Deletes a document

crm.documentgenerator.document.enablepublicurl

Enables or disables a public link

crm.documentgenerator.document.upload

Uploads a ready document and attaches it to a CRM entity

crm.documentgenerator.document.getfields

Returns the fields of the created document

Event

Triggered

onCrmDocumentGeneratorDocumentAdd

When generating a document manually or using the crm.documentgenerator.document.add method

onCrmDocumentGeneratorDocumentUpdate

When modifying a document manually or using the crm.documentgenerator.document.update method

onCrmDocumentGeneratorDocumentDelete

When deleting a document manually or using the crm.documentgenerator.document.delete method