Files in Chats: Overview of Methods
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.
A file in a chat is a Drive object linked to a message. For new development, files are handled by the im.v2.File.* methods: a single call uploads the file, creates a message with it, and returns the file data. The subsection is part of the Chats in Bitrix24 section.
Quick navigation: all methods
User documentation: Chats in Bitrix24: Interface and Capabilities
Which Methods to Choose
|
If You Need To |
What to Use |
|
Upload a file to a chat |
|
|
Get a link to download a file |
|
|
Save a file from a chat to your Drive |
|
|
Delete a file from the chat folder |
|
|
Maintain an integration built on a chain of Drive calls |
|
|
Work with files on behalf of a chatbot |
Order of Work with Files
- Upload the file with the im.v2.File.upload method
- Retain
result.file.idfrom the response — the file identifier, andresult.messageId— the identifier of the created message - When you need to provide the file to the user again, get the link with the im.v2.File.download method — it needs both the file identifier and the
dialogIdof the chat
If the file is already in the chat and its identifier is unknown, retrieve the message history with the im.dialog.messages.get method: it returns a files array where every file has an id field. This identifier is accepted by the download, save-to-Drive, and delete methods.
Identifiers and Limits
- the current methods accept
dialogId:chat{chatId}for a group chat,{userId}for a private dialog - in the
im.disk.*methods the identifiers are written in uppercase and differ from method to method — see the exact set in the parameters of the required method - the file content is passed as a Base64 string — how to prepare it is described in the How to Upload Files article
- the maximum file size is 100 MB
Relationship with Other Objects
Drive. A chat file is stored on Drive: the result.file.id field is the identifier of the Drive object. The im.v2.File.upload method addresses Drive itself. In the old scenario, Drive was called manually: the chat folder was returned by the im.disk.folder.get method, the file was uploaded by disk.folder.uploadfile, and the list of folder files — by disk.folder.getchildren.
Messages. Uploading a file creates a message in the chat and returns its messageId, so a separate im.message.add call is not needed. From then on, this message is handled by the methods of the Messages subsection.
Events. A subscribed application learns about a new message with a file from the messenger events — they are collected in the im.v2 Events section.
Chatbots. The same operations on behalf of a bot are performed by the methods of the Files imbot.v2 subsection.
Overview of Methods
Scope:
imWho can execute the method: a user with access to the chat. Only the participant who sent the file can delete it
Current Methods
|
Method |
Description |
|
Uploads a file to the chat |
|
|
Returns a link for downloading the file |
Methods with No Replacement in im.v2
These methods belong to the im.disk.* group, but they have no replacement in the new generation of the API yet — use them.
|
Method |
Description |
|
Saves a file from the chat to your Drive |
|
|
Deletes a file from the chat folder |
Deprecated Methods
These two methods are needed only by integrations already built on the old scenario. They are not recommended for new development.
|
Method |
Description |
Replacement in |
|
Obtains the chat file storage folder |
Not required: the upload method determines the folder itself |
|
|
Adds a file to the chat |