> 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 # Method name: getDownloadUrl(fileUrl: string, expirationTime: number, downloadedFileName: string, expiredTokenRedirectUrl: string) # Method package: wixMediaBackend # Method menu location: wixMediaBackend --> MediaManager --> getDownloadUrl # Method Link: https://dev.wix.com/docs/velo/apis/wix-media-backend/media-manager/get-download-url.md # Method Description: Gets a temporary download URL with a token for a specified file in the Media Manager. The `getDownloadUrl()` function returns a Promise that resolves to a download URL for a specified file in the Media Manager. Pass the file's URL in the `fileUrl` parameter, as returned in the `fileUrl` property of the `getFileInfo()`, `importFile()`, `upload()`, and `listFiles()` functions. When the download URL is clicked, the specified file downloads to your device. You can use the `getDownloadUrl()` function to allow external clients to download a file from the Media Manager to their device. This function provides a temporary URL for downloading a single file. If you need permanent download URLs for one or more files, use the [`downloadFiles()`](#downloadFiles) function. >**Notes:** > + The download URL with the token is valid for a single file download only. `getDownloadUrl()` must be called for each file that you want to download. > + This function's parameters are positional, and must be specified in the sequence shown in the syntax below. When specifying a parameter, use `null` as a placeholder for any unspecified parameters. For example, to specify `downloadedFileName` only, call `getDownloadUrl(fileUrl, null, downloadedFileName, null)`. # Method Code Examples: *** Note: do not assume any prop names or enum values other than the ones in the example. ## Get a temporary download URL ```javascript import { Permissions, webMethod } from 'wix-web-module'; import { mediaManager } from 'wix-media-backend'; // Sample fileUrl value: 'wix:image://v1/0abec0_51b1141c839c4d349035941cb9427ebe~mv2.jpg/child-on-bike.jpg#originWidth=768&originHeight=1024' export const myGetDownloadUrlFunction = webMethod(Permissions.Anyone, async (fileUrl) => { const myFileDownloadUrl = await mediaManager.getDownloadUrl(fileUrl); return myFileDownloadUrl; }); /* Promise resolves to: * "https://download-files.wix.com/_api/download/file?downloadToken=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9eyJpc3MiO..." */ ``` ## Get a temporary download URL with an expiration date and redirect URL ```javascript import { Permissions, webMethod } from 'wix-web-module'; import { mediaManager } from 'wix-media-backend'; /* Sample fileUrl value: 'wix:image://v1/0abec0_51b1141c839c4d349035941cb9427ebe~mv2.jpg/child-on-bike.jpg#originWidth=768&originHeight=1024' * Sample expirationTime value: 10 * Sample expiredTokenRedirectUrl value: 'https://www.my-redirect-url.com' */ export const myGetDownloadUrlFunction = webMethod(Permissions.Anyone, async (fileUrl, expirationTime, downloadedFileName, expiredTokenRedirectUrl) => { const myFileDownloadUrl = await mediaManager.getDownloadUrl(fileUrl, expirationTime, null, expiredTokenRedirectUrl); return myFileDownloadUrl; }); /* Promise resolves to: * "https://download-files.wix.com/_api/download/file?downloadToken=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9eyJpc3MiO..." */ ``` ## Get a temporary download URL with an expiration date and redirect URL ```javascript import { Permissions, webMethod } from 'wix-web-module'; import { mediaManager } from 'wix-media-backend'; /* Sample fileUrl value: 'wix:image://v1/0abec0_51b1141c839c4d349035941cb9427ebe~mv2.jpg/child-on-bike.jpg#originWidth=768&originHeight=1024' * Sample expirationTime value: 10 * Sample downloadedFileName value: 'my-audio-clip-1' * Sample expiredTokenRedirectUrl value: 'https://www.my-redirect-url.com' */ export const myGetDownloadUrlFunction = webMethod(Permissions.Anyone, async (fileUrl, expirationTime, downloadedFileName, expiredTokenRedirectUrl) => { const myFileDownloadUrl = await mediaManager.getDownloadUrl(fileUrl, expirationTime, downloadedFileName, expiredTokenRedirectUrl); return myFileDownloadUrl; }); /* Promise resolves to: * "https://download-files.wix.com/_api/download/file?downloadToken=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9eyJpc3MiO..." */ ``` ---