How to Work with Files
If you are developing integrations for Bitrix24 using AI tools (Codex, Claude Code, Cursor), connect the MCP server so that the assistant can utilize the official REST documentation.
Files can be transmitted to Bitrix24 fields in Base64 format or uploaded to Drive. The choice of method depends on the type of field and the method that accepts the file.
Quick Navigation: choose tutorial
Types of File Fields
- File. The field is not linked to Drive. It accepts a Base64 string or an array containing the file name and Base64 string.
- File (Drive). The field is linked to Drive. It stores the
IDof the Drive object. The methods disk.folder.uploadfile, disk.storage.uploadfile, and disk.file.* are suitable for uploading and updating such files.
Relationships with Other Objects
Files are associated with CRM entities, Drive, catalogs, chats, tasks, sites, and other Bitrix24 tools.
- CRM. Files can be transmitted to the fields of objects using the methods crm.item.add and crm.item.update, as well as attached to comments using the methods crm.timeline.comment.add and crm.timeline.comment.update.
- Catalog. Product images are transmitted to fields using the methods catalog.product.add and catalog.product.update.
- Lists. Files in list item fields are added and updated using the methods lists.element.add and lists.element.update.
- Feed. Files in feed messages are added and updated using the methods log.blogpost.add and log.blogpost.update.
- Documents. Document templates are uploaded using the methods documentgenerator.template.add and crm.documentgenerator.template.add.
- Users. A user's photo is transmitted using the method user.add.
- Chats. A file is uploaded to a chat using the method im.v2.File.upload, and a download link is obtained using the method im.v2.File.download.
- Chat-bots. A file is uploaded on behalf of the bot using the method imbot.v2.File.upload, and a download link is obtained using the method imbot.v2.File.download.
- Tasks. Files from Drive are attached to a task using the method tasks.task.file.attach.
- Sites. An image for a site block is uploaded and linked using the method landing.block.uploadfile.
Main Methods for Working with Files
|
Task |
Methods |
|
Upload a file to Drive |
|
|
Update a file on Drive |
|
|
Get information about a file on Drive |
|
|
Delete a file on Drive |
|
|
Get a link to a file on Drive |
How to Get Started
- Determine the type of field: file or file (Drive).
- Encode the file in Base64 if you need to transmit the file to a regular field.
- URL-encode the Base64 string if the file is transmitted via a GET request or cURL.
- Upload the file to Drive and provide the
IDof the Drive object if the field is linked to Drive.
How to Choose a Tutorial
|
If you need |
Open |
|
To transmit a new file to a Bitrix24 field or upload it to Drive |
|
|
To replace a file, delete a file, or keep other files in a multiple field |