> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # GenerateFileDownloadUrl # Package: channels # Namespace: CommunicationChannelsMedia # Method link: https://dev.wix.com/docs/api-reference/crm/communication/channels/communication-channels-media/generate-file-download-url.md ## Permission Scopes: Manage Inbox Messages: SCOPE.DC-INBOX.MANAGE-MSGS ## Introduction Generates a temporary and secure download URL for a file stored in the Media Manager. The `downloadUrl` is only valid for 10 hours. --- ## REST API ### Schema ``` Method: generateFileDownloadUrl Description: Generates a temporary and secure download URL for a file stored in the Media Manager. The `downloadUrl` is only valid for 10 hours. URL: https://www.wixapis.com/v1/download-url Method: POST # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: fileId Method parameters: param name: downloadFileName | type: downloadFileName | description: Temporary file name to identify the file type. For example, a file named "myFile.jpeg" identifies as an "image/jpeg" file type. If not specified, the original file name from the Media Manager is used. The name that appears in the Media Manager is taken from the `filename` parameter in the Generate File Upload Url call. param name: fileId | type: fileId | description: File GUID. You can also specify the file's Wix media URL. For example, `wix:image://v1/0abec0_b291a9349a0b4da59067f76287e386fb~mv2.jpg/leon.jpg#originWidth=3024&originHeight=4032`. Learn more about the [file GUID parameter](https://dev.wix.com/docs/api-reference/assets/media/media-manager/files/file-id.md). | required: true Return type: GenerateFileDownloadUrlResponse - name: downloadUrl | type: string | description: URL for accessing the file from the Media Manager. Possible Errors: HTTP Code: 404 | Status Code: NOT_FOUND | Application Code: FILE_NOT_FOUND | Description: File not found. ``` ### Examples ### Generate a file download URL ```curl curl -X POST \ 'https://www.wixapis.com/communication-channels-media/v1/download-url' \ -H 'Authorization: ' ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.channels.CommunicationChannelsMedia.generateFileDownloadUrl(fileId, options) Description: Generates a temporary and secure download URL for a file stored in the Media Manager. The `downloadUrl` is only valid for 10 hours. # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: fileId Method parameters: param name: fileId | type: string | description: File GUID. You can also specify the file's Wix media URL. For example, `wix:image://v1/0abec0_b291a9349a0b4da59067f76287e386fb~mv2.jpg/leon.jpg#originWidth=3024&originHeight=4032`. Learn more about the [file GUID parameter](https://dev.wix.com/docs/api-reference/assets/media/media-manager/files/file-id.md). | required: true param name: options | type: GenerateFileDownloadUrlOptions none - name: downloadFileName | type: string | description: Temporary file name to identify the file type. For example, a file named "myFile.jpeg" identifies as an "image/jpeg" file type. If not specified, the original file name from the Media Manager is used. The name that appears in the Media Manager is taken from the `filename` parameter in the Generate File Upload Url call. Return type: PROMISE - name: downloadUrl | type: string | description: URL for accessing the file from the Media Manager. Possible Errors: HTTP Code: 404 | Status Code: NOT_FOUND | Application Code: FILE_NOT_FOUND | Description: File not found. ``` ### Examples ### generateFileDownloadUrl ```javascript import { communicationChannelsMedia } from '@wix/comm-channels-media'; async function generateFileDownloadUrl(fileId,options) { const response = await communicationChannelsMedia.generateFileDownloadUrl(fileId,options); }; ``` ### generateFileDownloadUrl (with elevated permissions) ```javascript import { communicationChannelsMedia } from '@wix/comm-channels-media'; import { auth } from '@wix/essentials'; async function myGenerateFileDownloadUrlMethod(fileId,options) { const elevatedGenerateFileDownloadUrl = auth.elevate(communicationChannelsMedia.generateFileDownloadUrl); const response = await elevatedGenerateFileDownloadUrl(fileId,options); } ``` ### generateFileDownloadUrl (self-hosted) Self-hosted SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md). ```javascript import { createClient } from '@wix/sdk'; import { communicationChannelsMedia } from '@wix/comm-channels-media'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { communicationChannelsMedia }, // Include the auth strategy and host as relevant }); async function generateFileDownloadUrl(fileId,options) { const response = await myWixClient.communicationChannelsMedia.generateFileDownloadUrl(fileId,options); }; ``` ---