# Setting "Auto Download"

The "Auto Download" feature in Whapi.Cloud allows you to automatically download incoming media content to your Whapi channel, such as documents, photos, videos, and audio files sent to you in chats or groups.&#x20;

Initially, this information is stored by WhatsApp and marked with unique identifiers (`mediaID`). To obtain the original file, you will need to use a separate method designed for downloading received and sent files.

{% hint style="info" %}
We've written more about file storage here: [file-expiration-period](https://support.whapi.cloud/help-desk/receiving/file-expiration-period "mention")
{% endhint %}

We have simplified this process for you, and with the "Auto Download" setting enabled on your channel, you will not only receive mediaIDs but also a direct link to the media file.

### For what purpose?

1. Enhanced efficiency and convenience: You don't need to manually process file identifiers using additional methods. Files are automatically downloaded, and you receive direct links, allowing you to immediately use them in your work.
2. Resource savings. You don't need to worry about your own file storage.

{% hint style="success" %}
All media files uploaded through the API have a 30-day expiration date. After this period expires, all files, whether audio, PDF, images, etc., will be deleted from the repository.
{% endhint %}

### Where is it applicable?

If you are developing your own chat interface or messaging processing application, automatic file upload to the cloud can significantly simplify the process of handling incoming and outgoing data, as direct link to files will be available to you.

{% embed url="<https://youtu.be/aJQS6dChA3Y>" %}

### How it works?

Without the Auto setting enabled, incoming messages with files on the webhook will be displayed like this:

<figure><img src="https://lh7-us.googleusercontent.com/jRA7CrTyRNnbWMSuNbL5gFI8vDbvUqof-NWj2fWgs2BztJPXpfOAqUMLqvJIJfmZLsZc-0NKQqTgbBtReNUHDh7Y2bLATFzPQRaiZSWcp7WwogQV4HJalYhWSOvs7tvzZb5UgMTKbtUKwfauXZp04g" alt=""><figcaption><p>This is what the webhook looks like without the "Auto Download" setting enabled</p></figcaption></figure>

You can always use the [method](https://whapi.readme.io/reference/getmedia) to retrieve this file by mediaID.

Enabling the setting will add the Link parameter to the JSON array, where you will immediately receive a direct link to the file:

<figure><img src="https://lh7-us.googleusercontent.com/hCW59AUSpMkxLQojEOX8BBTo3DZSKyaFSzPaEUMP6FVf7RaDMPaBilLY9GGMjahUjaZU_Z4VLEioVLh5lwlqghkt_2Mmz_DdNpaPIMv0uEgt8H6b_jBe5YKjG5bjl-Lo-RyO6Zi7W-hgfkQVBo0GIQ" alt=""><figcaption><p>With the "Auto Download" setting enabled, you get a direct link to the file</p></figcaption></figure>

The link to the media files processed by your number at the time of the enabled setting is bound to the message, which means that you will be able to get a link to the media file via API Call.&#x20;

{% hint style="warning" %}
Attention, this does not apply to media that was sent or received BEFORE this setting was enabled.
{% endhint %}

### How to enable?

We will show you two options for configuration:

1. **Personal account**

The most optimal way to configure "Auto Download" can be found in the "channel settings".&#x20;

On the channel page, go to settings by clicking on the "Settings" button.

<figure><img src="https://lh7-us.googleusercontent.com/8CCTtTke7cjMNXIWjHlcOtbhe-phDBqSXFDcbgsI6G0NUolYVeKEnfwc4PleZMk3Kjtd0_E2_mktydxyT0gZ-rlj9JYLD9BGsdnjGMJjfxhcVym-pXZC7cG5Q9iXA1z8cRk7NUST9uzuvYwL1b-mAQ" alt=""><figcaption></figcaption></figure>

Next, in the popup window, you need to select the types of media files that you want to automatically save to the cloud.&#x20;

Then, click the "Save" button.

<figure><img src="https://lh7-us.googleusercontent.com/TMAZX5V4jQwv8f6VnKVzMq7JvGYc6FLPvr00VlQ4jVbIQ2z_f5PgY4GvntyndCv0b9taHRMFd8r-9XlXgEqn6qq8y_33y2yI_4Nr9wapGaNRHhCcVRr2bF3l3ZHnvGAcjkLdAQZXHXQQ_fDdK0_A2g" alt=""><figcaption></figcaption></figure>

2. **API**

We will need the [PATCH method /settings](https://whapi.readme.io/reference/updatechannelsettings).

{% embed url="<https://whapi.readme.io/reference/updatechannelsettings>" %}

For enabling this setting, you will need the Media parameter.

```sh
curl --request PATCH \
     --url https://gate.whapi.cloud/settings \
     --header 'accept: application/json' \
     --header 'authorization: Bearer Yq6xa91PMoplB8Y9M0ajpZshpqtQKxo' \
     --header 'content-type: application/json' \
     --data '
{
  "media": {
    "auto_download": [
      "image",
      "document"
    ]
  }
}
'
```

In our documentation, you will also find snippets and code examples in other programming languages.

{% hint style="info" %}
If you need assistance, just message us in the support chat on any page of the website.
{% endhint %}
