Files API Key Features

In this article we describe the features from the user’s point of view

Uploading a file to Kommo

The life cycle of the file begins with the upload process. Each file is uploaded in parts, and the maximum size of each part that can be uploaded in one request is returned when the session is opened.

If your file exceeds the maximum part size obtained when opening a session, you'll need to split it into smaller parts that do not exceed the maximum size.

To start uploading a file, you must first open a session for uploading the file and specify the size and type of the uploaded file. This is important so that in case of network issues, you can resume uploading from where you left off instead of starting the upload all over again. A session for uploading a file lasts until the file is uploaded, but no more than 24 hours after creation.

When opening a session, you'll receive information about the maximum size of uploaded parts of the file and a link to upload the first part of the file. After uploading each part of the file, you'll receive a link to upload the next part. Once the file is completely uploaded, the session will automatically close and information about the file will be returned.

When uploading a file, you can pass the ID of an existing file to upload a new version of the file. When you manage a file through the API, you can use and reuse it in different places, such as in a note and in the file field.

Getting a list of files

The Files API provides a way to retrieve a list of files (both active or deleted). Additionally, you can filter the results based on certain parameters such as file extension or size.

This method is especially helpful for integrations that need to keep track of their file storage status, or those that want to make the most out of their reusable files.

Deleting files

When granted the Deleting files scope, integrations can utilize the batch file deletion method. Along with this, a file recovery method is also available in case a file was accidentally deleted.

These methods are separated into their own scope to make sure the user is aware that the integration has the potential to delete files, and that the responsibility for file deletion lies with the integration.

Integrations can benefit from these methods by having more flexibility and control over their files.

Once a file is deleted, it goes into the trash and is permanently deleted after 30 days. This frees up space once moved to the trash.

Deleted files cannot be used in notes, fields, or any other part of the system.

A file as a note

You can use the uploaded file as an attachment to a note by adding a note via the Notes API and passing the uuid and name of the file to be displayed in the note. Remember that if you want a file to display in a note, you must add two notes with the same creation date.

A file in a custom field

You can also use the uploaded file as the value of a custom field with "type": "file". Files in fields support versioning, so if you make adjustments to a file, you can create a new version for the already uploaded one. This allows the client to see all versions of the file and download each of them. For example, an integration can generate a contract for a specific transaction, load it into files, and then specify it as a field value.

Attaching a file to an entity

When you upload a file, you can attach it to one or more main entities, including leads, contacts, and companies. The files you attach will be displayed in the Media tab on the corresponding entity card.

The Media tab shows all the files received from the client or uploaded to the note, as well as those added to the card via the API. However, files loaded into custom fields will not be displayed in the Media tab.

The API not only allows you to attach files, but also to unlink them and get a list of all the attached files.